litellm/tests/unit/llms/base_llm
owen-hj fcdc25831e
fix(streaming): surface upstream abort on azure_ai, databricks, Vertex Model Garden and text completion streams (#54443)
* fix(streaming): surface upstream abort on azure_ai, databricks, Vertex Model Garden and text completion streams

* fix(streaming): keep OpenAIError for aborts on OpenAI-compatible streams

Streams parsed by the OpenAI streaming handler raised the base exception on an upstream abort, so failure callbacks lost the OpenAIError class they got before. The handler now names its abort error class, and the Bedrock OpenAI-compatible decoder passes it through

* fix(streaming): record partial usage when a sync stream fails mid-stream

A sync stream that raised after content logged its failure with zero tokens and no spend, while the async path billed the partial output. The sync failure path now records the partial usage the same way

* fix(streaming): raise the route's own error class on aborts and check azure_text streams

* fix(streaming): log every upstream abort with its provider's error class

Parsers raise one UpstreamAbortError, and the stream wrapper swaps it for the class the route's provider config returns before the failure log and fallback handling

* fix(streaming): keep the abort error each route already raised and raise InternalServerError on the new routes

Round 2 swapped the abort for each provider's HTTP error class, which renamed it on openai, azure and other SDK routes that already raised InternalServerError. The #48328 raises in the openai SDK path and the OpenAI-compatible stream parser are back as they shipped, and the shared check now runs after the provider's own parser, so only routes that never raised get the stream wrapper's InternalServerError. The shared SSE parser only validates a line that mentions abort

* fix(anthropic,content_filter): end sync /v1/messages streams with an error event and release held guardrail text on upstream errors

The sync Anthropic adapter swallowed every mid-stream error and stopped the stream, so a sync /v1/messages stream that hit an upstream abort ended cut short with no error. It now ends with an Anthropic error event, as the async path does.

The content filter guardrail dropped the text it was holding back when the upstream stream raised. It now sends that text through its end-of-stream check before re-raising.

---------

Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
2026-11-26 05:04:26 +00:00
..
audio_transcription test: make 38 legacy live base-class translation tests offline (#45351) 2026-10-08 23:18:25 +00:00
auth feat(auth): support OAuth client credentials for inference providers (#54101) 2026-11-24 14:21:47 -05:00
batches fix(bedrock): derive the web identity session policy per AWS caller (#50592) 2026-11-08 19:13:53 +00:00
chat feat(sarvam): send a litellm User-Agent on chat requests (#52012) 2026-11-17 23:52:53 +00:00
decisions fix(ollama): send model-info lookups to the call's api_base with its key and retry failed ones (#53830) 2026-11-24 08:51:25 -08:00
embedding fix(embeddings): unwrap extra_body for providers with their own embedding handlers (#51335) 2026-11-12 15:41:50 -08:00
files test: move tests/test_litellm/llms into tests/unit/llms (#43191) 2026-09-25 12:43:23 -07:00
guardrail_translation fix(anthropic): skip a stream data line that is not a JSON object (#53393) 2026-11-22 22:54:02 +00:00
harness feat: add litellm.agent() to run claude code, codex, opencode and deep agents through the ai gateway (#43885) 2026-10-01 22:27:49 +00:00
realtime feat(elevenlabs): add scribe_v2_realtime realtime transcription (#48984) 2026-11-25 03:15:34 +00:00
rerank test: make 38 legacy live base-class translation tests offline (#45351) 2026-10-08 23:18:25 +00:00
responses fix(router): prevent Responses fallback from replaying delivered tool calls (#51683) 2026-11-13 11:43:03 -08:00
search test: move tests/test_litellm/llms into tests/unit/llms (#43191) 2026-09-25 12:43:23 -07:00
vector_store test: migrate legacy unit dirs and unrun folders into tests/unit, tests/integration and tests/e2e (#45940) 2026-10-11 06:24:57 -07:00
__init__.py test(unit): make every tests/unit directory a package so pytest collection is unique 2026-09-20 11:50:59 +00:00
test_base_managed_resource.py test: move tests/test_litellm/llms into tests/unit/llms (#43191) 2026-09-25 12:43:23 -07:00
test_base_model_iterator.py fix(streaming): surface upstream abort on azure_ai, databricks, Vertex Model Garden and text completion streams (#54443) 2026-11-26 05:04:26 +00:00
test_base_utils.py fix(llms): move later developer messages for models declared system-first (#48897) 2026-10-29 04:12:13 -07:00
test_managed_resource_isolation.py test: move tests/test_litellm/llms into tests/unit/llms (#43191) 2026-09-25 12:43:23 -07:00
test_managed_resources_utils.py test: move tests/test_litellm/llms into tests/unit/llms (#43191) 2026-09-25 12:43:23 -07:00