fix(router): handle non-standard fallback formats with order-based fallback

When fallbacks use non-standard formats (e.g. ["claude-3-haiku"] or
[{"model": "...", "messages": [...]}]), detect them with
_check_non_standard_fallback_format and pass them through directly
instead of trying to parse with get_fallback_model_group which only
handles the standard dict-keyed format.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Sameer Kankute 2026-03-26 12:28:25 +05:30 • committed by Yuneng Jiang
parent 08d1303c3c
commit 6fdc29a292
No known key found for this signature in database

View file

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