forked from phoenix/litellm-mirror
feat - set custom routing strategy
This commit is contained in:
parent
3d90b25005
commit
b6066d1ece
3 changed files with 45 additions and 1 deletions
|
@ -69,6 +69,7 @@ from litellm.types.router import (
|
|||
AlertingConfig,
|
||||
AllowedFailsPolicy,
|
||||
AssistantsTypedDict,
|
||||
CustomRoutingStrategy,
|
||||
Deployment,
|
||||
DeploymentTypedDict,
|
||||
LiteLLM_Params,
|
||||
|
@ -4814,6 +4815,18 @@ class Router:
|
|||
except Exception as e:
|
||||
pass
|
||||
|
||||
def set_custom_routing_strategy(self, CustomRoutingStrategy: CustomRoutingStrategy):
|
||||
setattr(
|
||||
self,
|
||||
"get_available_deployment",
|
||||
CustomRoutingStrategy.get_available_deployment,
|
||||
)
|
||||
setattr(
|
||||
self,
|
||||
"async_get_available_deployment",
|
||||
CustomRoutingStrategy.async_get_available_deployment,
|
||||
)
|
||||
|
||||
def flush_cache(self):
|
||||
litellm.cache = None
|
||||
self.cache.flush_cache()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue