Skip to content

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]

test: update tests

Krrish Dholakiab23e35f75e00
diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py
index bccca574b13..547aaf50788 100644
--- a/litellm/proxy/proxy_server.py
+++ b/litellm/proxy/proxy_server.py
@@ -2679,12 +2679,14 @@ class ProxyConfig:
config_router_settings = config_data.get("router_settings", {})
combined_router_settings = {}
- if config_router_settings is not None and isinstance(
- config_router_settings, dict
- ) and db_router_settings is not None and isinstance(
- db_router_settings.param_value, dict
+ if (
+ config_router_settings is not None
+ and isinstance(config_router_settings, dict)
+ and db_router_settings is not None
+ and isinstance(db_router_settings.param_value, dict)
):
from litellm.utils import _update_dictionary
+
combined_router_settings = _update_dictionary(
config_router_settings, db_router_settings.param_value
)
@@ -2697,7 +2699,7 @@ class ProxyConfig:
):
combined_router_settings = db_router_settings.param_value
- if combined_router_settings is not None:
+ if combined_router_settings:
llm_router.update_settings(**combined_router_settings)
def _add_general_settings_from_db_config(
diff --git a/tests/test_litellm/proxy/test_proxy_server.py b/tests/test_litellm/proxy/test_proxy_server.py
index 28410edd533..d2b516a55d2 100644
--- a/tests/test_litellm/proxy/test_proxy_server.py
+++ b/tests/test_litellm/proxy/test_proxy_server.py
@@ -1722,8 +1722,11 @@ async def test_add_router_settings_from_db_config_merge_logic():
assert combined_settings["retry_delay"] == 2
# Nested dictionaries should be merged (but this is shallow merge)
- # The entire nested_config dict gets replaced by DB value
- expected_nested = {"setting2": "db_value2", "setting3": "db_value3"}
+ expected_nested = {
+ "setting1": "config_value1",
+ "setting2": "db_value2",
+ "setting3": "db_value3",
+ }
assert combined_settings["nested_config"] == expected_nested