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

Function quality_rank

uncommon_route/router/quality.py:43–50  ·  view source on GitHub ↗
(value: ServedQuality | str | None)

Source from the content-addressed store, hash-verified

41
42
43def quality_rank(value: ServedQuality | str | None) -> int:
44 if isinstance(value, ServedQuality):
45 return _QUALITY_RANK[value]
46 normalized = str(value or "").strip().lower()
47 for quality, rank in _QUALITY_RANK.items():
48 if quality.value == normalized:
49 return rank
50 return _QUALITY_RANK[ServedQuality.ECONOMY]
51
52
53def normalize_served_quality(value: ServedQuality | str | None) -> ServedQuality | None:

Callers 10

_apply_cost_sanity_guardFunction · 0.90
fallback_keyFunction · 0.90
stronger_qualityFunction · 0.85
quality_alignment_scoreFunction · 0.85
apply_quality_guardsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected