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

Method record_alias

uncommon_route/model_map.py:593–606  ·  view source on GitHub ↗

Record a mapping learned from a successful runtime fallback. Called when the proxy sends ``failed_name`` upstream, gets a model error, then falls back to ``working_name`` which succeeds.

(self, failed_name: str, working_name: str)

Source from the content-addressed store, hash-verified

591 # ---- learned aliases --------------------------------------------------
592
593 def record_alias(self, failed_name: str, working_name: str) -> None:
594 """Record a mapping learned from a successful runtime fallback.
595
596 Called when the proxy sends ``failed_name`` upstream, gets a model
597 error, then falls back to ``working_name`` which succeeds.
598 """
599 if failed_name == working_name:
600 return
601 if self._discovered and working_name not in self._upstream_models:
602 return
603 self._learned_aliases[failed_name] = working_name
604 self._map[failed_name] = working_name
605 self._save_learned_aliases()
606 logger.info("Learned alias: %s -> %s", failed_name, working_name)
607
608 def _load_learned_aliases(self) -> None:
609 path = self._learned_aliases_path()

Callers 1

_apply_attemptFunction · 0.80

Calls 2

_save_learned_aliasesMethod · 0.95
infoMethod · 0.80

Tested by

no test coverage detected