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
fix: preserve original behavior - always call PolicyResolver
Julio Quinteros Pro0f0b7a3f5046
diff --git a/litellm/proxy/litellm_pre_call_utils.py b/litellm/proxy/litellm_pre_call_utils.pyindex 0171b7efd79..bafd473d209 100644--- a/litellm/proxy/litellm_pre_call_utils.py+++ b/litellm/proxy/litellm_pre_call_utils.py@@ -1704,15 +1704,12 @@ def add_guardrails_from_policy_engine(f"key_alias={context.key_alias}, model={context.model}, tags={context.tags}")- # Match and track policies- applied_policy_names, _ = _match_and_track_policies(- data, context, request_body_policies- )-- if not applied_policy_names:- return+ # Match and track policies (may be empty, but resolution still happens)+ _match_and_track_policies(data, context, request_body_policies)# Apply resolved guardrails to metadata+ # Note: PolicyResolver does its own independent matching and inheritance resolution,+ # so we always call it even if applied_policy_names is empty_apply_resolved_guardrails_to_metadata(data, metadata_variable_name, context)