The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
Merge remote-tracking branch 'origin/litellm_fix_post_call_policy_pipeline' into litellm_legacy_hook_streaming_pipeline_step
mateo-berrif4b939113b74
diff --cc litellm/proxy/utils.pyindex 106fab7af8a,d40cc34476a..aa952a436a0--- a/litellm/proxy/utils.py+++ b/litellm/proxy/utils.py@@@ -560,6 -555,24 +560,24 @@@ def _pipeline_is_streamable(policy_namereturn False+ def _route_supports_streaming_pipelines(user_api_key_dict: UserAPIKeyAuth) -> bool:+ return not user_api_key_dict.request_route or resolve_endpoint_translation(user_api_key_dict, None) is not None++-def _stream_gated_guardrail_names(++def stream_gated_guardrail_names(+ request_data: Mapping[str, object], user_api_key_dict: UserAPIKeyAuth+ ) -> frozenset[str]:+ if not _route_supports_streaming_pipelines(user_api_key_dict):+ return frozenset()+ return _pipeline_step_guardrail_names(+ tuple(+ (policy_name, pipeline)+ for policy_name, pipeline in _post_call_pipelines(request_data)- if all(_pipeline_step_supports_unified_streaming(step.guardrail) for step in pipeline.steps)++ if not _pipeline_unsupported_streaming_guardrails(pipeline)+ )+ )++def _streamable_post_call_pipelines(request_data: Mapping[str, object], user_api_key_dict: UserAPIKeyAuth) -> tuple[tuple[str, "GuardrailPipeline"], ...]:@@@ -3300,8 -3288,8 +3294,8 @@@ class ProxyLogging# dict lookups + llm_router.get_deployment() per callback per chunk._cached_guardrail_data: dict | None = None_guardrail_data_computed = False- pipeline_managed: Final = (- pipeline_managed_guardrail_names(data, "post_call") if caps.has_guardrail else frozenset()+ pipeline_gated: Final = (- _stream_gated_guardrail_names(data, user_api_key_dict) if caps.has_guardrail else frozenset()++ stream_gated_guardrail_names(data, user_api_key_dict) if caps.has_guardrail else frozenset())for callback in litellm.callbacks: