From a710480629dc1dd16cf75912a6fc70459267b061 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Tue, 16 Apr 2024 15:11:28 -0700 Subject: [PATCH] fix - save router settings in db --- litellm/proxy/_types.py | 4 ++++ litellm/proxy/proxy_server.py | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/litellm/proxy/_types.py b/litellm/proxy/_types.py index 10684574e2d..cd84580814f 100644 --- a/litellm/proxy/_types.py +++ b/litellm/proxy/_types.py @@ -719,6 +719,10 @@ class ConfigYAML(LiteLLMBase): description="litellm Module settings. See __init__.py for all, example litellm.drop_params=True, litellm.set_verbose=True, litellm.api_base, litellm.cache", ) general_settings: Optional[ConfigGeneralSettings] = None + router_settings: Optional[dict] = Field( + None, + description="litellm router object settings. See router.py __init__ for all, example router.num_retries=5, router.timeout=5, router.max_retries=5, router.retry_after=5", + ) class Config: protected_namespaces = () diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py index 6a55375eaf2..a6d00730356 100644 --- a/litellm/proxy/proxy_server.py +++ b/litellm/proxy/proxy_server.py @@ -8190,6 +8190,16 @@ async def update_config(config_info: ConfigYAML): "success_callback" ] = combined_success_callback + # router settings + if config_info.router_settings is not None: + config.setdefault("router_settings", {}) + _updated_router_settings = config_info.router_settings + + config["router_settings"] = { + **_updated_router_settings, + **config["router_settings"], + } + # Save the updated config await proxy_config.save_config(new_config=config)