fix(model-routing): keep selected models strict (#5801)

Co-authored-by: Alexandre Teixeira <111787685+alteixeira20@users.noreply.github.com>
This commit is contained in:
RaresKeY
2026-08-12 14:10:07 +01:00
committed by GitHub
co-authored by Alexandre Teixeira
parent 53869d194d
commit b52296471b
14 changed files with 417 additions and 103 deletions
+4 -5
View File
@@ -1949,11 +1949,10 @@ def _dedupe_candidates(candidates):
"""Filter malformed entries and drop a later repeat of an already-seen
``(url, model)`` route, preserving order (first occurrence wins).
The chain is the primary target followed by the configured fallbacks, so a
fallback that repeats the session's current model — a common misconfiguration,
since callers prepend the live ``(url, model)`` to ``default_model_fallbacks``
— would otherwise make the chain re-attempt the very route that just failed:
a wasted round-trip plus a spurious ``fallback`` notice for a switch that did
The chain is the primary target followed by any caller-authorized
fallbacks. A fallback that repeats the session's current model would
otherwise make the chain re-attempt the very route that just failed: a
wasted round-trip plus a spurious ``fallback`` notice for a switch that did
not happen. Headers are not part of the key; the first tuple (with its
headers) is the one kept.
"""