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

Method _build_map

uncommon_route/model_map.py:417–439  ·  view source on GitHub ↗

Match every internal model name to the best upstream candidate. Priority: exact match > seed alias > learned alias > fuzzy match.

(self)

Source from the content-addressed store, hash-verified

415 return 0
416
417 def _build_map(self) -> None:
418 """Match every internal model name to the best upstream candidate.
419
420 Priority: exact match > seed alias > learned alias > fuzzy match.
421 """
422 from uncommon_route.router.config import DEFAULT_MODEL_PRICING
423
424 self._map.clear()
425 for internal in DEFAULT_MODEL_PRICING:
426 if internal in self._upstream_models:
427 continue
428 alias = self._seed_alias_match(internal)
429 if alias:
430 self._map[internal] = alias
431 continue
432 if internal in self._learned_aliases:
433 candidate = self._learned_aliases[internal]
434 if candidate in self._upstream_models:
435 self._map[internal] = candidate
436 continue
437 match = self._fuzzy_match(internal)
438 if match:
439 self._map[internal] = match
440
441 def _seed_alias_match(self, internal: str) -> str | None:
442 """Check seed alias table for known renames."""

Calls 3

_seed_alias_matchMethod · 0.95
_fuzzy_matchMethod · 0.95
clearMethod · 0.45