litellm/tests/test_litellm/llms/bedrock
devin-ai-integration[bot] 47bba14336
fix(passthrough): parse Bedrock stream spend incrementally instead of buffering the whole response (#40724)
* fix(passthrough): parse Bedrock stream spend incrementally instead of buffering the whole response

Bedrock pass-through streaming kept every relayed chunk in memory until EOF and
then decoded, parsed and translated the whole stream again for spend logging.
Large or concurrent streams could exhaust proxy worker memory.

Sync and async passthrough wrappers now hand each chunk to a provider stream
collector as it is relayed. Bedrock decodes event-stream frames incrementally,
folds consecutive text deltas, and keeps only what stream_chunk_builder needs
for usage, tool calls and metadata. Text deltas are no longer retained in the
Bedrock and Anthropic stream decoders either. Providers without a collector
keep the previous raw-bytes behavior. Collector failures are isolated so spend
tracking can never interrupt the customer stream

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* test(passthrough): assert the spend payload the collector builds instead of mock internals

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* test(passthrough): type the Bedrock collector helpers by the collector protocol instead of asserting the class

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

---------

Co-authored-by: yassin <yassin@berri.ai>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-11 09:53:37 -07:00
..
batches fix(bedrock): forward aws_session_tags in batch cancel 2026-09-09 15:08:21 -07:00
chat Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_bedrock_aws_session_tags 2026-09-10 09:42:22 -07:00
count_tokens test(bedrock): type the probe credential overrides 2026-09-09 16:14:00 -07:00
embed Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_bedrock_aws_session_tags 2026-09-10 09:42:22 -07:00
files fix(bedrock): keep deletion response IDs in request context 2026-09-08 19:02:08 -07:00
image fix(bedrock): skip the SigV4 credential chain when a bearer token is configured 2026-09-02 14:28:40 -07:00
image_edit fix(bedrock): skip the SigV4 credential chain when a bearer token is configured 2026-09-02 14:28:40 -07:00
invoke_agent test: drop the cwd-relative sys.path.insert calls from the test suite (#37802) 2026-08-22 09:25:58 -07:00
messages/invoke_transformations fix(bedrock): forward native structured outputs on Invoke instead of silently inlining the schema 2026-08-31 23:19:22 -07:00
passthrough fix(passthrough): parse Bedrock stream spend incrementally instead of buffering the whole response (#40724) 2026-09-11 09:53:37 -07:00
realtime fix(bedrock): per-response realtime usage deltas, spend-log event filter, single transcript completed 2026-08-31 11:49:09 -07:00
rerank Merge branch 'litellm_internal_staging' of https://github.com/BerriAI/litellm into litellm_lit5458_rerank_sigv4_bearer_fix 2026-08-25 16:03:38 -07:00
search test: unwind environment writes in tests/test_litellm with monkeypatch (#37806) 2026-08-21 20:28:37 -07:00
vector_stores fix: encode upstream URL path identifiers 2026-04-29 22:02:39 -07:00
__init__.py test(batches): add 1:1 test file scaffold for batches component paths (#30529) 2026-06-29 09:22:58 +05:30
event_loop_probe.py refactor: keep the AWS JSON signing helper under llms and bound the probe's refresh wait 2026-09-08 16:20:50 -07:00
test_anthropic_beta_support.py fix(bedrock): allowlist Bedrock Invoke body fields and filter all anthropic-beta values 2026-04-21 11:26:15 -07:00
test_base_aws_llm.py Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_bedrock_aws_session_tags 2026-09-10 09:42:22 -07:00
test_bedrock_common_utils.py feat(bedrock): thread aws_session_tags into STS AssumeRole 2026-09-09 12:37:36 -07:00
test_bedrock_ssl_verify.py test: drop the cwd-relative sys.path.insert calls from the test suite (#37802) 2026-08-22 09:25:58 -07:00
test_claude_platform_provider.py Litellm OSS Staging 010626 (#29422) 2026-06-01 21:42:51 -07:00
test_converse_context_management.py feat(context_management): compact_20260112 polyfill for non-Anthropic providers (#28868) 2026-05-30 09:20:05 -07:00
test_cross_region_inference_profile_mapping.py test: collapse blank lines left by removed tests 2026-09-08 02:21:55 +00:00
test_mantle.py fix(bedrock): drop the OpenAI base suffix from BEDROCK_MANTLE_API_BASE before the mantle messages path 2026-09-02 11:51:27 -07:00
test_nova_imported_models.py test: run the 30 test files stranded in the second mirror (#37595) 2026-08-20 10:59:43 -07:00
test_request_metadata.py test: drop the cwd-relative sys.path.insert calls from the test suite (#37802) 2026-08-22 09:25:58 -07:00
test_web_identity_session_policy.py fix(bedrock): grant bedrock:CountTokens in OIDC session policy (#33145) 2026-08-05 14:55:46 -07:00