litellm/litellm
Chesars 3794fd25cf
fix: preserve role='assistant' in Azure streaming with include_usage
When Azure sends stream_options.include_usage=True, it emits an initial
chunk with choices=[] (prompt_filter_results) before the first content
chunk. Previously, LiteLLM inflated this empty-choices chunk with a
default StreamingChoices, which consumed the sent_first_chunk flag and
caused strip_role_from_delta to strip role from the real first chunk.
Additionally, the first real chunk with role='assistant' and content=''
was discarded by is_chunk_non_empty as "empty".

This fix:
- Forwards chunks with choices=[] faithfully (no inflated default)
- Only marks sent_first_chunk for chunks with real choices
- Treats chunks with role in delta as non-empty
- Guards choices[0] access in __next__/__anext__ and stream_chunk_builder

Fixes #24221
2026-04-13 09:00:33 -07:00
..
a2a_protocol fix(a2a): default create_a2a_client timeout to DEFAULT_A2A_AGENT_TIMEOUT 2026-04-10 21:06:44 +03:00
anthropic_interface style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
assistants
batch_completion fix: prompt registry 2026-02-18 00:34:54 +05:30
batches Merge pull request #23957 from Sameerlite/litellm_vertex-cancel-batch 2026-03-20 23:32:50 +05:30
caching Litellm ishaan march 20 (#24303) 2026-03-21 12:40:11 -07:00
completion_extras fix(lint): apply Black formatting to 14 files (#24532) 2026-03-31 07:45:55 -07:00
containers feat(containers): Azure routing, managed container IDs, delete response parsing (#25287) 2026-04-11 09:21:01 -07:00
endpoints/speech/speech_to_completion_bridge
evals Root cause fix - migrate all logging update to use 1 function - for centralized kwarg updates (#23659) 2026-03-15 23:21:01 -07:00
experimental_mcp_client Litellm ishaan march30 (#24887) (#25151) 2026-04-04 14:44:07 -07:00
files Update streaming.py. Provide Type Annotation for empty dict 2026-04-11 13:04:25 -07:00
fine_tuning address greptile review feedback (greploop iteration 1) 2026-03-27 20:04:41 +05:30
google_genai Root cause fix - migrate all logging update to use 1 function - for centralized kwarg updates (#23659) 2026-03-15 23:21:01 -07:00
images Root cause fix - migrate all logging update to use 1 function - for centralized kwarg updates (#23659) 2026-03-15 23:21:01 -07:00
integrations Merge remote-tracking branch 'origin' into litellm_internal_staging_04_11_2026 2026-04-11 15:41:03 -07:00
interactions Root cause fix - migrate all logging update to use 1 function - for centralized kwarg updates (#23659) 2026-03-15 23:21:01 -07:00
litellm_core_utils fix: preserve role='assistant' in Azure streaming with include_usage 2026-04-13 09:00:33 -07:00
llms Merge pull request #25616 from BerriAI/main 2026-04-13 08:43:43 +05:30
ocr Root cause fix - migrate all logging update to use 1 function - for centralized kwarg updates (#23659) 2026-03-15 23:21:01 -07:00
passthrough style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
proxy fix(auth): gate post-custom-auth DB lookups behind opt-in flag (#25634) 2026-04-13 08:02:16 -07:00
proxy_auth fix: prompt registry 2026-02-18 00:34:54 +05:30
rag style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
realtime_api Root cause fix - migrate all logging update to use 1 function - for centralized kwarg updates (#23659) 2026-03-15 23:21:01 -07:00
rerank_api Root cause fix - migrate all logging update to use 1 function - for centralized kwarg updates (#23659) 2026-03-15 23:21:01 -07:00
responses feat(containers): Azure routing, managed container IDs, delete response parsing (#25287) 2026-04-11 09:21:01 -07:00
router_strategy Litellm ishaan march30 (#24887) (#25151) 2026-04-04 14:44:07 -07:00
router_utils fix(router): don't create litellm_metadata for non-Responses API calls in encrypted_content_affinity_check (#25347) 2026-04-08 21:11:19 -07:00
search Root cause fix - migrate all logging update to use 1 function - for centralized kwarg updates (#23659) 2026-03-15 23:21:01 -07:00
secret_managers Litellm ishaan march30 (#24887) (#25151) 2026-04-04 14:44:07 -07:00
skills Root cause fix - migrate all logging update to use 1 function - for centralized kwarg updates (#23659) 2026-03-15 23:21:01 -07:00
types Merge pull request #25616 from BerriAI/main 2026-04-13 08:43:43 +05:30
vector_store_files Root cause fix - migrate all logging update to use 1 function - for centralized kwarg updates (#23659) 2026-03-15 23:21:01 -07:00
vector_stores Root cause fix - migrate all logging update to use 1 function - for centralized kwarg updates (#23659) 2026-03-15 23:21:01 -07:00
videos [Staging] - Ishaan March 17th (#23903) 2026-03-18 15:09:01 -07:00
__init__.py Reduce default latency histogram bucket cardinality (#25527) 2026-04-11 09:34:45 -07:00
_lazy_imports.py style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
_lazy_imports_registry.py feat: add sagemaker_nova provider for Amazon Nova models on SageMaker (#21542) 2026-03-14 15:10:01 -07:00
_logging.py Litellm oss staging 04 02 2026 p1 (#25055) 2026-04-08 21:37:10 -07:00
_redis.py Litellm ishaan march23 - MCP Toolsets + GCP Caching fix (#25146) (#25155) 2026-04-04 16:23:21 -07:00
_redis_credential_provider.py Litellm ishaan march23 - MCP Toolsets + GCP Caching fix (#25146) (#25155) 2026-04-04 16:23:21 -07:00
_service_logger.py style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
_uuid.py
_version.py
anthropic_beta_headers_config.json feat(anthropic): register advisor-tool-2026-03-01 in beta headers config 2026-04-10 12:39:30 -07:00
anthropic_beta_headers_manager.py Refactor: Filtering beta header after transformation 2026-03-16 10:47:15 +05:30
blog_posts.json docs(blog): add WebRTC blog post link 2026-03-13 17:54:33 +05:30
budget_manager.py
constants.py feat(mcp): add per-user OAuth token storage for interactive MCP flows 2026-04-09 21:49:06 -07:00
cost.json
cost_calculator.py [Test Fix] fix gov pricing tests (#25022) 2026-04-02 15:55:55 -07:00
exceptions.py style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
main.py fix: preserve role='assistant' in Azure streaming with include_usage 2026-04-13 09:00:33 -07:00
model_prices_and_context_window_backup.json Merge pull request #25616 from BerriAI/main 2026-04-13 08:43:43 +05:30
mypy.ini
policy_templates_backup.json feat(add-new-block_code_execution-guardrail): prevent agent from executing code (#22154) 2026-02-25 22:02:14 -08:00
provider_endpoints_support_backup.json feat(search): add Serper (serper.dev) as search provider (#23112) 2026-03-09 08:40:37 -07:00
py.typed
router.py fix(router): pass custom_llm_provider to get_llm_provider for unprefixed model names (#25334) 2026-04-08 21:27:13 -07:00
scheduler.py style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
setup_wizard.py Litellm fix update bedrock models (#24947) 2026-04-01 19:22:54 -07:00
timeout.py
utils.py Merge pull request #25616 from BerriAI/main 2026-04-13 08:43:43 +05:30