mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-08 03:08:45 +00:00
fix(router): persist max fallback setting updates
This commit is contained in:
parent
f005afa146
commit
c49f1ba30d
3 changed files with 19 additions and 0 deletions
|
|
@ -10456,6 +10456,7 @@ class Router:
|
|||
"allowed_fails",
|
||||
"cooldown_time",
|
||||
"num_retries",
|
||||
"max_fallbacks",
|
||||
"timeout",
|
||||
"max_retries",
|
||||
"retry_after",
|
||||
|
|
@ -10494,6 +10495,7 @@ class Router:
|
|||
"allowed_fails",
|
||||
"cooldown_time",
|
||||
"num_retries",
|
||||
"max_fallbacks",
|
||||
"timeout",
|
||||
"max_retries",
|
||||
"retry_after",
|
||||
|
|
@ -10510,6 +10512,7 @@ class Router:
|
|||
_int_settings: Final = [
|
||||
"timeout",
|
||||
"num_retries",
|
||||
"max_fallbacks",
|
||||
"retry_after",
|
||||
"allowed_fails",
|
||||
"cooldown_time",
|
||||
|
|
|
|||
|
|
@ -117,6 +117,7 @@ class UpdateRouterConfig(BaseModel):
|
|||
allowed_fails: int | None = None
|
||||
cooldown_time: float | None = None
|
||||
num_retries: int | None = None
|
||||
max_fallbacks: int | None = None
|
||||
timeout: float | None = None
|
||||
max_retries: int | None = None
|
||||
retry_after: float | None = None
|
||||
|
|
|
|||
|
|
@ -44,6 +44,13 @@ def test_update_router_config_exposes_retry_policy_field():
|
|||
assert "retry_policy" in UpdateRouterConfig.model_fields
|
||||
|
||||
|
||||
def test_update_router_config_preserves_max_fallbacks():
|
||||
value = 10
|
||||
config = UpdateRouterConfig(max_fallbacks=value)
|
||||
|
||||
assert config.model_dump(exclude_none=True)["max_fallbacks"] == value
|
||||
|
||||
|
||||
def test_update_router_config_accepts_retry_policy_payload():
|
||||
"""The exact payload the Admin UI Model Retry Settings tab sends must
|
||||
round-trip through the schema's ``dict(exclude_none=True)`` form, since
|
||||
|
|
@ -122,6 +129,14 @@ def test_update_settings_persists_retry_policy_dict():
|
|||
assert router.retry_policy.TimeoutErrorRetries == 3
|
||||
|
||||
|
||||
def test_update_settings_applies_max_fallbacks():
|
||||
router = _build_router()
|
||||
|
||||
router.update_settings(max_fallbacks=10)
|
||||
|
||||
assert router.max_fallbacks == 10
|
||||
|
||||
|
||||
def test_update_settings_accepts_retry_policy_object_unchanged():
|
||||
"""A pre-built ``RetryPolicy`` instance must pass through verbatim so
|
||||
callers that already constructed one (e.g. tests or programmatic
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue