forked from phoenix/litellm-mirror
fix pattern match router
This commit is contained in:
parent
63c63612c2
commit
d28c6b390c
1 changed files with 8 additions and 3 deletions
|
@ -5,6 +5,8 @@ Class to handle llm wildcard routing and regex pattern matching
|
|||
import re
|
||||
from 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
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue