litellm/tests/integration/streaming
Yassin Kortam ce4a6cbf5b
perf(streaming): cut per-chunk pydantic round trips on openai-compatible streams (#47030)
* perf(streaming): skip full-chunk dump and delta rebuild on openai-compatible chunks

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

* perf(streaming): reuse the built choice and delta on plain openai-compatible chunks

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

* fix(streaming): copy upstream chunk attributes in upstream key order

The scalar fast path iterated a frozenset of keys, so the SSE key order of chunk extras like service_tier and obfuscation changed with each worker's hash seed

* test(streaming): count chunk_creator calls with a profiler instead of patching classes

* test(streaming): check service_tier still passes through chunk_creator

* fix(streaming): reuse the built choice for chunks with upstream choice extras

* test(streaming): cover ModelResponseStream chunks on the choice reuse path

* fix(streaming): keep main's delta rebuild for deltas with nested values

Clearing role in place on a delta that holds tool calls left its nested
fields unset, so chunk.model_dump() dropped keys like a custom tool call's
name on later chunks. Deltas holding only scalars keep the in-place path.

* perf(streaming): build each plain OpenAI chunk's delta once and skip pydantic attribute misses

Later plain ChatCompletionChunks now build one Delta and one StreamingChoices, with no full-chunk model_dump, and read stored values instead of attribute probes that raise and catch AttributeError. Nested-value chunks no longer pay the dict(model) misses that made them slower than the merge base.

* fix(streaming): read hidden params a chunk carries as a pydantic extra

* test(streaming): pin logprobs, Azure filter extras, and audio and image deltas on later OpenAI chunks

* test(streaming): cover role, reasoning, choice extras and billing on plain OpenAI SDK chunks

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: mateo <mateo@berri.ai>
Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
2026-10-20 02:42:32 +00:00
..
faked_responses_case.py fix(responses): open faked stream items empty so tool arguments and text arrive once (#46533) 2026-10-15 09:35:12 -07:00
test_assistants_evals_stream.py test(integration): pin assistants and evals endpoint contracts (#44734) 2026-10-14 07:08:35 +00:00
test_azure_streaming_function_calls.py test: migrate local_testing SDK and provider tests out of build_and_test (#45760) 2026-10-10 23:14:25 +00:00
test_chat_stream_guardrail_error_events.py test(integration): give each owned proxy a private database and Redis by default (#47213) 2026-10-18 03:37:41 +00:00
test_decision_model_buffering.py fix(guardrails): honor decision model streaming buffering (#46086) 2026-10-12 16:28:22 -07:00
test_decision_model_pipeline_buffering.py fix(guardrails): honor decision model streaming buffering (#46086) 2026-10-12 16:28:22 -07:00
test_fake_stream_reasoning_wire.py fix(bedrock)!: keep reasoning, thinking blocks and the json_mode finish_reason on fake streams (#46863) 2026-10-16 17:27:57 +00:00
test_faked_responses_stream_bridges.py fix(responses): open faked stream items empty so tool arguments and text arrive once (#46533) 2026-10-15 09:35:12 -07:00
test_faked_responses_stream_cache_replay.py fix(responses): open faked stream items empty so tool arguments and text arrive once (#46533) 2026-10-15 09:35:12 -07:00
test_faked_responses_stream_chaos.py test(integration): give each owned proxy a private database and Redis by default (#47213) 2026-10-18 03:37:41 +00:00
test_faked_responses_stream_guardrail_blocks.py fix(responses): open faked stream items empty so tool arguments and text arrive once (#46533) 2026-10-15 09:35:12 -07:00
test_faked_responses_stream_items.py fix(responses): open faked stream items empty so tool arguments and text arrive once (#46533) 2026-10-15 09:35:12 -07:00
test_file_content_streaming.py test(integration): regression tests for July provider translation, routing and streaming bugs (#42693) 2026-09-23 09:51:06 -07:00
test_google_genai_stream_usage_settings_wire.py test(integration): give each owned proxy a private database and Redis by default (#47213) 2026-10-18 03:37:41 +00:00
test_interception_converted_stream_options.py test(integration): give each owned proxy a private database and Redis by default (#47213) 2026-10-18 03:37:41 +00:00
test_mid_stream_fallback_continuation.py feat(router): mid-stream fallback continuation for chat completions (#41127) 2026-10-16 13:51:32 +00:00
test_noma_v2_streaming_settings.py test(integration): give each owned proxy a private database and Redis by default (#47213) 2026-10-18 03:37:41 +00:00
test_openai_like_stream_usage_wire.py fix(vertex_ai): route Model Garden models through the generateContent adapter (#41836) 2026-10-15 08:06:49 -07:00
test_openai_sdk_plain_chunk_fields.py perf(streaming): cut per-chunk pydantic round trips on openai-compatible streams (#47030) 2026-10-20 02:42:32 +00:00
test_openai_stream_passthrough_fields.py test: migrate SDK and proxy-booting legacy CircleCI tests to their tiers (#45758) 2026-10-11 00:17:21 -07:00
test_responses_bridge_stream_chaos.py test(integration): give each owned proxy a private database and Redis by default (#47213) 2026-10-18 03:37:41 +00:00
test_responses_bridge_stream_errors.py test(integration): give each owned proxy a private database and Redis by default (#47213) 2026-10-18 03:37:41 +00:00
test_responses_top_level_error_events.py fix(responses): keep the provider code and message on top-level stream error events (#46438) 2026-10-14 16:16:46 -07:00
test_stream_contracts.py test(integration): give each owned proxy a private database and Redis by default (#47213) 2026-10-18 03:37:41 +00:00
test_stream_open_error_provider_headers_proxy.py test(integration): hand every harness server a port from one per-worker block (#46761) 2026-10-15 16:56:40 -07:00
test_stream_parallel_slot_release.py test(integration): regression tests for August provider translation and streaming bugs (#42621) 2026-09-22 20:52:00 -07:00
test_ttft_keepalive.py test(integration): regression tests for August provider translation and streaming bugs (#42621) 2026-09-22 20:52:00 -07:00