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 pattern match router
Ishaan Jaffd28c6b390ca1
diff --git a/litellm/router_utils/pattern_match_deployments.py b/litellm/router_utils/pattern_match_deployments.pyindex c9ea8c1a7d1..f735c965aad 100644--- a/litellm/router_utils/pattern_match_deployments.py+++ b/litellm/router_utils/pattern_match_deployments.py@@ -5,6 +5,8 @@ Class to handle llm wildcard routing and regex pattern matchingimport refrom typing import Dict, List, Optional+from litellm._logging import verbose_router_logger+class PatternMatchRouter:"""@@ -72,9 +74,12 @@ class PatternMatchRouter:Returns:Optional[List[Deployment]]: llm deployments"""- for pattern, llm_deployments in self.patterns.items():- if re.match(pattern, request):- return llm_deployments+ try:+ for pattern, llm_deployments in self.patterns.items():+ if re.match(pattern, request):+ return llm_deployments+ except Exception as e:+ verbose_router_logger.error(f"Error in PatternMatchRouter.route: {str(e)}")return None # No matching pattern found