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:
Sameer Kankute 2026-03-26 11:54:32 +05:30
parent 4aebebadf6
commit aebac76ddb
No known key found for this signature in database
2 changed files with 1 additions and 3 deletions

View file

@ -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 []

View file

@ -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"