MCPcopy Create free account
hub / github.com/CommonstackAI/UncommonRoute / fallback_key

Function fallback_key

uncommon_route/router/selector.py:1047–1050  ·  view source on GitHub ↗
(score: CandidateScore)

Source from the content-addressed store, hash-verified

1045 selected_rank = quality_rank(selected.served_quality)
1046
1047 def fallback_key(score: CandidateScore) -> tuple[int, int, float, float]:
1048 rank_delta = quality_rank(score.served_quality) - selected_rank
1049 overbuy = 1 if rank_delta > 0 else 0
1050 return (overbuy, abs(rank_delta), score.predicted_cost, -score.total)
1051
1052 remaining = [score for score in ranked if score.model != selected.model]
1053 remaining.sort(key=fallback_key)

Callers

nothing calls this directly

Calls 1

quality_rankFunction · 0.90

Tested by

no test coverage detected