(testing - litellm.Router ) add unit test coverage for pattern matching / wildcard routing (#6250)

* add testing coverage for pattern match router

* fix add_pattern

* fix typo on router_cooldown_event_callback

* add testing for pattern match router

* fix add explanation for pattern match router
This commit is contained in:
Ishaan Jaff 2024-10-16 11:58:05 +05:30 committed by GitHub
parent c390b07e29
commit 183bd5d873
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 159 additions and 5 deletions

View file

@ -32,10 +32,7 @@ class PatternMatchRouter:
regex = self._pattern_to_regex(pattern)
if regex not in self.patterns:
self.patterns[regex] = []
if isinstance(llm_deployment, list):
self.patterns[regex].extend(llm_deployment)
else:
self.patterns[regex].append(llm_deployment)
self.patterns[regex].append(llm_deployment)
def _pattern_to_regex(self, pattern: str) -> str:
"""