mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-04 02:31:27 +00:00
feat(router): add order-based fallback so higher order deployments are tried on failure
When order=1 deployments fail, the router now automatically tries order=2, then order=3, etc. before falling through to external fallbacks. This removes the need for enable_pre_call_checks and makes order work as a true priority-based fallback chain within a model group. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
4aebebadf6
commit
aebac76ddb
2 changed files with 1 additions and 3 deletions
|
|
@ -5343,7 +5343,6 @@ class Router:
|
|||
)
|
||||
if external_fallback_group is None and generic_idx is not None:
|
||||
external_fallback_group = fallbacks[generic_idx]["*"]
|
||||
|
||||
# Combined list: order fallbacks first, then external
|
||||
combined_fallbacks = order_fallback_entries + (
|
||||
external_fallback_group or []
|
||||
|
|
|
|||
|
|
@ -283,7 +283,6 @@ async def test_router_order_fallback_then_external_fallback():
|
|||
)
|
||||
assert response._hidden_params["model_id"] == "fallback"
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_router_order_fallback_with_non_standard_fallbacks():
|
||||
"""Non-standard fallback formats (e.g. fallbacks=["model-name"]) passed
|
||||
|
|
@ -328,4 +327,4 @@ async def test_router_order_fallback_with_non_standard_fallbacks():
|
|||
messages=[{"role": "user", "content": "hi"}],
|
||||
fallbacks=["fallback-model"], # non-standard format, passed per-request
|
||||
)
|
||||
assert response._hidden_params["model_id"] == "fallback"
|
||||
assert response._hidden_params["model_id"] == "fallback"
|
||||
Loading…
Add table
Reference in a new issue