Skip to content

Conversation

@deepanshululla
Copy link
Contributor

@deepanshululla deepanshululla commented Oct 25, 2025

Title

Enables Strips base64 files from SQS and adds documentation for unexposed SQS configs


[92m01:01:54 - LiteLLM:ERROR�[0m: sqs.py:339 - Error sending to SQS: Client error '413 Request Entity Too Large' for url 'https://sqs.us-west-2.amazonaws.com/....'

Relevant issues

Large files can go in base64

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • I have added a screenshot of my new test passing locally
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem
((litellm-py3.12) (base) ➜  litellm git:(feature/strip_base64_sqs2) poetry run pytest tests/logging_callback_tests/test_sqs_logger.py --tb=short -vv --maxfail=10 -n 4 
=========================================================================================== test session starts ===========================================================================================
platform darwin -- Python 3.12.2, pytest-7.4.4, pluggy-1.5.0 -- /Users/deepanshu.deepanshu/Library/Caches/pypoetry/virtualenvs/litellm-ohMn1BPm-py3.12/bin/python
cachedir: .pytest_cache
rootdir: /Users/deepanshu.deepanshu/code/code/litellm/deepanshu/litellm
configfile: pyproject.toml
plugins: respx-0.22.0, xdist-3.8.0, anyio-4.5.2, mock-3.14.1, asyncio-0.21.2, retry-1.6.3, requests-mock-1.12.1
asyncio: mode=Mode.AUTO
4 workers [15 items]    
scheduling tests via LoadScheduling

tests/logging_callback_tests/test_sqs_logger.py::test_async_sqs_logger_flush 
tests/logging_callback_tests/test_sqs_logger.py::test_appcrypto_encrypt_decrypt_roundtrip 
tests/logging_callback_tests/test_sqs_logger.py::test_async_log_failure_event_adds_to_queue 
tests/logging_callback_tests/test_sqs_logger.py::test_async_send_batch_triggers_tasks 
[gw1] [  6%] PASSED tests/logging_callback_tests/test_sqs_logger.py::test_async_log_failure_event_adds_to_queue 
tests/logging_callback_tests/test_sqs_logger.py::test_async_log_success_event_adds_to_queue 
[gw0] [ 13%] PASSED tests/logging_callback_tests/test_sqs_logger.py::test_appcrypto_encrypt_decrypt_roundtrip 
tests/logging_callback_tests/test_sqs_logger.py::test_appcrypto_invalid_key_length 
[gw2] [ 20%] PASSED tests/logging_callback_tests/test_sqs_logger.py::test_async_send_batch_triggers_tasks 
tests/logging_callback_tests/test_sqs_logger.py::test_async_sqs_logger_error_flush 
[gw0] [ 26%] PASSED tests/logging_callback_tests/test_sqs_logger.py::test_appcrypto_invalid_key_length 
tests/logging_callback_tests/test_sqs_logger.py::test_sqs_logger_init_without_encryption 
[gw1] [ 33%] PASSED tests/logging_callback_tests/test_sqs_logger.py::test_async_log_success_event_adds_to_queue 
tests/logging_callback_tests/test_sqs_logger.py::test_sqs_logger_init_with_encryption_missing_key 
[gw0] [ 40%] PASSED tests/logging_callback_tests/test_sqs_logger.py::test_sqs_logger_init_without_encryption 
[gw1] [ 46%] PASSED tests/logging_callback_tests/test_sqs_logger.py::test_sqs_logger_init_with_encryption_missing_key 
tests/logging_callback_tests/test_sqs_logger.py::test_strip_base64_keeps_non_file_content 
tests/logging_callback_tests/test_sqs_logger.py::test_strip_base64_mixed_nested_objects 
[gw0] [ 53%] PASSED tests/logging_callback_tests/test_sqs_logger.py::test_strip_base64_keeps_non_file_content 
[gw1] [ 60%] PASSED tests/logging_callback_tests/test_sqs_logger.py::test_strip_base64_mixed_nested_objects 
tests/logging_callback_tests/test_sqs_logger.py::test_strip_base64_removes_file_and_nontext_entries 
tests/logging_callback_tests/test_sqs_logger.py::test_strip_base64_recursive_redaction 
[gw0] [ 66%] PASSED tests/logging_callback_tests/test_sqs_logger.py::test_strip_base64_recursive_redaction 
[gw1] [ 73%] PASSED tests/logging_callback_tests/test_sqs_logger.py::test_strip_base64_removes_file_and_nontext_entries 
[gw3] [ 80%] PASSED tests/logging_callback_tests/test_sqs_logger.py::test_async_sqs_logger_flush 
tests/logging_callback_tests/test_sqs_logger.py::test_sqs_logger_init_with_encryption 
[gw2] [ 86%] PASSED tests/logging_callback_tests/test_sqs_logger.py::test_async_sqs_logger_error_flush 
tests/logging_callback_tests/test_sqs_logger.py::test_strip_base64_handles_empty_or_missing_messages 
[gw3] [ 93%] PASSED tests/logging_callback_tests/test_sqs_logger.py::test_sqs_logger_init_with_encryption 
[gw2] [100%] PASSED tests/logging_callback_tests/test_sqs_logger.py::test_strip_base64_handles_empty_or_missing_messages Task was destroyed but it is pending!
task: <Task pending name='Task-9' coro=<CustomBatchLogger.periodic_flush() running at /Users/deepanshu.deepanshu/code/code/litellm/deepanshu/litellm/litellm/integrations/custom_batch_logger.py:38> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Task was destroyed but it is pending!
task: <Task pending name='Task-18' coro=<CustomBatchLogger.periodic_flush() done, defined at /Users/deepanshu.deepanshu/code/code/litellm/deepanshu/litellm/litellm/integrations/custom_batch_logger.py:36> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Task was destroyed but it is pending!
task: <Task pending name='Task-21' coro=<CustomBatchLogger.periodic_flush() done, defined at /Users/deepanshu.deepanshu/code/code/litellm/deepanshu/litellm/litellm/integrations/custom_batch_logger.py:36> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Task was destroyed but it is pending!
task: <Task pending name='Task-16' coro=<CustomBatchLogger.periodic_flush() running at /Users/deepanshu.deepanshu/code/code/litellm/deepanshu/litellm/litellm/integrations/custom_batch_logger.py:38> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Task was destroyed but it is pending!
task: <Task pending name='Task-19' coro=<CustomBatchLogger.periodic_flush() done, defined at /Users/deepanshu.deepanshu/code/code/litellm/deepanshu/litellm/litellm/integrations/custom_batch_logger.py:36> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Task was destroyed but it is pending!
task: <Task pending name='Task-14' coro=<CustomBatchLogger.periodic_flush() running at /Users/deepanshu.deepanshu/code/code/litellm/deepanshu/litellm/litellm/integrations/custom_batch_logger.py:38> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Task was destroyed but it is pending!
task: <Task pending name='Task-5' coro=<CustomBatchLogger.periodic_flush() running at /Users/deepanshu.deepanshu/code/code/litellm/deepanshu/litellm/litellm/integrations/custom_batch_logger.py:38> wait_for=<Future pending cb=[Task.task_wakeup()]>>
sys:1: RuntimeWarning: coroutine 'CustomBatchLogger.periodic_flush' was never awaited
RuntimeWarning: Enable tracemalloc to get the object allocation traceback


============================================================================================ warnings summary =============================================================================================
litellm/litellm_core_utils/get_model_cost_map.py:41: 5 warnings
tests/logging_callback_tests/test_sqs_logger.py: 15 warnings
  /Users/deepanshu.deepanshu/code/code/litellm/deepanshu/litellm/litellm/litellm_core_utils/get_model_cost_map.py:41: DeprecationWarning: open_text is deprecated. Use files() instead. Refer to https://importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy for migration advice.
    with importlib.resources.open_text(

tests/logging_callback_tests/test_sqs_logger.py::test_async_log_success_event_adds_to_queue
  /opt/anaconda3/lib/python3.12/json/decoder.py:353: RuntimeWarning: coroutine 'CustomBatchLogger.periodic_flush' was never awaited
    obj, end = self.scan_once(s, idx)
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

tests/logging_callback_tests/test_sqs_logger.py::test_sqs_logger_init_with_encryption_missing_key
  /opt/anaconda3/lib/python3.12/importlib/__init__.py:131: RuntimeWarning: coroutine 'CustomBatchLogger.periodic_flush' was never awaited
    _bootstrap._exec(spec, module)
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

tests/logging_callback_tests/test_sqs_logger.py::test_strip_base64_keeps_non_file_content
  /Users/deepanshu.deepanshu/Library/Caches/pypoetry/virtualenvs/litellm-ohMn1BPm-py3.12/lib/python3.12/site-packages/httpx/_client.py:1424: RuntimeWarning: coroutine 'CustomBatchLogger.periodic_flush' was never awaited
    for key, proxy in proxy_map.items()
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

tests/logging_callback_tests/test_sqs_logger.py::test_async_sqs_logger_flush
  /Users/deepanshu.deepanshu/Library/Caches/pypoetry/virtualenvs/litellm-ohMn1BPm-py3.12/lib/python3.12/site-packages/pydantic/main.py:426: UserWarning: Pydantic serializer warnings:
    PydanticSerializationUnexpectedValue: Expected 10 fields but got 5 for type `Message` with value `Message(content='hi', role='assistant', tool_calls...unction_call=None, provider_specific_fields=None)` - serialized value may not be as expected.
    PydanticSerializationUnexpectedValue: Expected `StreamingChoices` but got `Choices` with value `Choices(finish_reason='st...r_specific_fields=None))` - serialized value may not be as expected
    return self.__pydantic_serializer__.to_python(

tests/logging_callback_tests/test_sqs_logger.py::test_async_sqs_logger_flush
tests/logging_callback_tests/test_sqs_logger.py::test_async_sqs_logger_error_flush
  /Users/deepanshu.deepanshu/Library/Caches/pypoetry/virtualenvs/litellm-ohMn1BPm-py3.12/lib/python3.12/site-packages/botocore/auth.py:425: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
    datetime_now = datetime.datetime.utcnow()

tests/logging_callback_tests/test_sqs_logger.py::test_async_sqs_logger_error_flush
  /Users/deepanshu.deepanshu/Library/Caches/pypoetry/virtualenvs/litellm-ohMn1BPm-py3.12/lib/python3.12/site-packages/httpx/_urlparse.py:186: RuntimeWarning: coroutine 'CustomBatchLogger.periodic_flush' was never awaited
    def copy_with(self, **kwargs: str | None) -> ParseResult:
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

tests/logging_callback_tests/test_sqs_logger.py::test_async_sqs_logger_error_flush
  /Users/deepanshu.deepanshu/Library/Caches/pypoetry/virtualenvs/litellm-ohMn1BPm-py3.12/lib/python3.12/site-packages/httpx/_urlparse.py:186: RuntimeWarning: coroutine 'AsyncMockMixin._execute_mock_call' was never awaited
    def copy_with(self, **kwargs: str | None) -> ParseResult:
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

tests/logging_callback_tests/test_sqs_logger.py::test_async_sqs_logger_error_flush
  /Users/deepanshu.deepanshu/Library/Caches/pypoetry/virtualenvs/litellm-ohMn1BPm-py3.12/lib/python3.12/site-packages/pydantic/main.py:426: UserWarning: Pydantic serializer warnings:
    PydanticSerializationUnexpectedValue: Expected 10 fields but got 5 for type `Message` with value `Message(content='Error occurred', role='assistant'...unction_call=None, provider_specific_fields=None)` - serialized value may not be as expected.
    PydanticSerializationUnexpectedValue: Expected `StreamingChoices` but got `Choices` with value `Choices(finish_reason='st...r_specific_fields=None))` - serialized value may not be as expected
    return self.__pydantic_serializer__.to_python(

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
===================================================================================== 15 passed, 29 warnings in 4.39s =====================================================================================
(litellm-py3.12) (base) ➜  litellm git:(feature/strip_base64_sqs2) 

Type

Bug fix

Changes

Adds an option to strip

@vercel
Copy link

vercel bot commented Oct 25, 2025

Someone is attempting to deploy a commit to the CLERKIEAI Team on Vercel.

A member of the Team first needs to authorize it.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


deepanshu seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@deepanshululla deepanshululla changed the title Add sqs logger Enable base64 stripping from sqs Oct 25, 2025
@krrishdholakia
Copy link
Contributor

hi @deepanshululla can you please fix the linting errors?
Screenshot 2025-10-26 at 10 12 20 AM

@deepanshululla
Copy link
Contributor Author

@krrishdholakia fixed. thanks

Copy link
Contributor

@ishaan-jaff ishaan-jaff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reviewed

sqs_batch_size: 10 # [OPTIONAL] Number of messages to batch before sending (default: 10)
sqs_flush_interval: 30 # [OPTIONAL] Time in seconds to wait before flushing batch (default: 30)
# --- 🧱 Required Parameters ---
sqs_queue_url: https://sqs.us-west-2.amazonaws.com/123456789012/my-queue
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's a lot more content here, can u just add the new field

• Drop entries with type == 'file' or any non-text type.
• Keep untyped or text content.
• Recursively redact inline base64 blobs in *any* string field, at any depth.
"""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add a max depth, we don't want infinite recursion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants