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

Method _load_cache

uncommon_route/benchmark.py:625–642  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

623 logger.warning("Benchmark cache save failed: %s", exc)
624
625 def _load_cache(self) -> None:
626 if not _CACHE_PATH.exists():
627 return
628 try:
629 raw = json.loads(_CACHE_PATH.read_text(encoding="utf-8"))
630 self._last_refresh = float(raw.get("last_refresh", 0))
631 for source_name, entries_raw in raw.get("sources", {}).items():
632 entries: dict[str, ModelBenchmarkEntry] = {}
633 for model_id, values in entries_raw.items():
634 entries[model_id] = ModelBenchmarkEntry(
635 overall=float(values.get("overall", 0.5)),
636 categories=dict(values.get("categories", {})),
637 raw=dict(values.get("raw", {})),
638 fetched_at=float(values.get("fetched_at", 0)),
639 )
640 self._sources[source_name] = entries
641 except Exception as exc:
642 logger.warning("Benchmark cache load failed: %s", exc)
643
644
645_ACTIVE_CACHE: BenchmarkCache | None = None

Callers 1

__post_init__Method · 0.95

Calls 2

ModelBenchmarkEntryClass · 0.85
getMethod · 0.45

Tested by

no test coverage detected