mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-25 22:20:43 +00:00
* fix: Send the include_usage chunk with an empty choices array Signed-off-by: Alberto Perdomo <aperdomo@redhat.com> * test: Skip chunks with no choices when reading streams Signed-off-by: Alberto Perdomo <aperdomo@redhat.com> * fix: Strip usage from plain-iterator async stream chunks Signed-off-by: Alberto Perdomo <aperdomo@redhat.com> * test: Expect empty choices on the usage chunk in the gemma tracing test Signed-off-by: Alberto Perdomo <aperdomo@redhat.com> * fix(streaming): send the empty-choices usage chunk only to callers that asked for include_usage The usage chunk now has choices=[] only when the caller set stream_options.include_usage itself. When the OpenAI handler, the proxy's always_include_stream_usage setting, or the harness added include_usage on the caller's behalf, the chunk keeps its legacy single empty-delta choice, so clients that read choices[0] on every chunk keep working. The proxy and harness mark their injection with the private _litellm_stream_usage_injected flag, and the proxy scrubs a client-sent copy. Plain-iterator streams keep usage on their chunk when usage was not requested, and the LLM Shield trailing flush ignores chunks with no choices. * fix(proxy): mark the default stream usage injection so hooks keep the legacy usage chunk shape The proxy's default strip-mode injection adds include_usage for clients that did not ask and drops the usage chunk before it reaches them, but streaming iterator hooks still saw it with choices=[]. Marking that injection with _litellm_stream_usage_injected keeps the old single empty choice for them. * fix(router): treat deployment and router-default stream_options as injected, and drop the client flag on the queue route * refactor(router): move the stream usage injection check into router_utils * fix(router): read stream_options from pydantic deployment params when marking injected usage Update the mantle, openinference, and text-completion integration tests to expect the include_usage chunk with empty choices. * fix(proxy): keep the stream usage injection marker out of stored request bodies * test(streaming): cover who asked for stream usage on chat, queue, deployment and spend log paths * test: type the queue flag test, pin the logging start time, and build the deployment usage config without mutation --------- Signed-off-by: Alberto Perdomo <aperdomo@redhat.com> Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| akto | ||
| aporia_ai | ||
| azure | ||
| content_filter | ||
| dynamoai | ||
| guardrails_ai | ||
| ibm_guardrails | ||
| javelin | ||
| litellm_content_filter | ||
| noma | ||
| openai | ||
| semantic_guard | ||
| unified_guardrails | ||
| zscaler_ai_guard | ||
| __init__.py | ||
| _cisco_ai_defense_test_utils.py | ||
| code_execution_compliance_dataset.json | ||
| test_agent_365.py | ||
| test_aim.py | ||
| test_airia.py | ||
| test_alice.py | ||
| test_bedrock_guardrails.py | ||
| test_bedrock_invoke_guardrail_checks.py | ||
| test_block_code_execution.py | ||
| test_block_code_execution_compliance.py | ||
| test_cato_networks.py | ||
| test_cisco_ai_defense_chat.py | ||
| test_cisco_ai_defense_mcp.py | ||
| test_compresr.py | ||
| test_conduct.py | ||
| test_crowdstrike_aidr.py | ||
| test_custom_code_bounded_execution.py | ||
| test_decision_model.py | ||
| test_deepkeep.py | ||
| test_dynamoai.py | ||
| test_enkryptai.py | ||
| test_generic_guardrail_api.py | ||
| test_grayswan.py | ||
| test_headroom.py | ||
| test_hiddenlayer.py | ||
| test_javelin.py | ||
| test_lakera_ai_v2.py | ||
| test_lasso.py | ||
| test_llm_shield_proxy.py | ||
| test_mcp_end_user_permission.py | ||
| test_mcp_security.py | ||
| test_microsoft_purview.py | ||
| test_model_armor.py | ||
| test_noma.py | ||
| test_noma_v2.py | ||
| test_onyx.py | ||
| test_ovalix.py | ||
| test_pangea.py | ||
| test_panw_prisma_airs.py | ||
| test_presidio.py | ||
| test_presidio_union_fix.py | ||
| test_promptguard.py | ||
| test_qualifire.py | ||
| test_repelloai.py | ||
| test_response_rejection_guardrail_code.py | ||
| test_singulr.py | ||
| test_straiker.py | ||
| test_structured_messages_writeback.py | ||
| test_tool_permission.py | ||
| test_tool_policy_guardrail.py | ||
| test_typesafe.py | ||
| test_vigil_guard.py | ||
| test_wingback.py | ||
| test_xecguard.py | ||