mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-14 23:21:35 +00:00
fix(proxy): tolerate missing router_settings and non-list fallbacks in fallback resolution
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
dff08dcb55
commit
c064e576ee
2 changed files with 5 additions and 3 deletions
|
|
@ -2121,14 +2121,14 @@ class ProxyBaseLLMRequestProcessing:
|
|||
|
||||
fallbacks = None
|
||||
|
||||
key_router_settings: Final = user_api_key_dict.router_settings
|
||||
key_router_settings: Final = getattr(user_api_key_dict, "router_settings", None)
|
||||
if isinstance(key_router_settings, dict) and "fallbacks" in key_router_settings:
|
||||
fallbacks = key_router_settings["fallbacks"]
|
||||
|
||||
if fallbacks is None:
|
||||
fallbacks = llm_router.fallbacks
|
||||
|
||||
if not fallbacks:
|
||||
if not isinstance(fallbacks, list) or not fallbacks:
|
||||
return None
|
||||
|
||||
fallback_model_group, generic_fallback_idx = get_fallback_model_group(
|
||||
|
|
|
|||
|
|
@ -6449,7 +6449,9 @@ class TestPreCallWithFallbacksOnLocalRateLimit:
|
|||
mock_router = MagicMock()
|
||||
mock_router.fallbacks = None
|
||||
|
||||
with patch("litellm.proxy.common_request_processing.independent_snapshot") as snapshot_mock:
|
||||
with patch( # test-quality-ok: spying the snapshot seam is the only observable check that the no-fallback path skips it
|
||||
"litellm.proxy.common_request_processing.independent_snapshot"
|
||||
) as snapshot_mock:
|
||||
with patch.object(
|
||||
processor,
|
||||
"common_processing_pre_call_logic",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue