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)
| 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() |
no test coverage detected