litellm/tests/test_litellm/llms/azure_ai
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
..
chat test(azure_ai): pin the tier the messages bridge sends when astra refuses max 2026-09-05 23:18:25 -07:00
claude fix(azure_ai): let the caller's output_config from extra_body win over the legacy thinking upgrade 2026-09-02 16:23:52 -07:00
embed fix(azure_ai): route Foundry embeddings to the /models inference route 2026-08-31 11:46:33 -07:00
image_edit fix(azure_ai): honour global drop_params for image params MAI cannot serve 2026-09-08 20:20:57 -07:00
image_generation Merge pull request #40074 from mihidumh/fix/mai-image-unsupported-params 2026-09-09 19:11:11 -07:00
ocr fix(ocr): send each provider a health-check document it accepts 2026-09-04 22:52:12 -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
rerank Merge origin/litellm_internal_staging into litellm_azure_ai_entra_auth 2026-08-24 11:33:18 -07:00
test_azure_ai_agents_handler.py fix: encode additional provider path identifiers 2026-04-29 22:18:20 -07:00
test_azure_ai_cost_calculator.py test(azure_ai): charge the router fee over cached prompt tokens too 2026-09-07 22:35:19 -07:00
test_azure_ai_entra_auth.py Merge origin/litellm_internal_staging into litellm_azure_ai_entra_auth 2026-08-24 11:33:18 -07:00
test_azure_ai_foundry_catalog_model_metadata.py fix(azure_ai): drop gpt-chat-latest effort levels, test prices via calculator 2026-09-07 22:22:51 -07:00
test_azure_ai_fw_models_metadata.py test: collapse blank lines left by removed tests 2026-09-08 02:21:55 +00:00
test_azure_ai_kimi_k26_metadata.py test: collapse blank lines left by removed tests 2026-09-08 02:21:55 +00:00
test_azure_document_intelligence_ocr_transformation.py Merge origin/litellm_internal_staging into litellm_azure_ai_entra_auth 2026-08-24 11:33:18 -07:00