Load seed benchmark data. Checks two locations in order: 1. User data dir: ~/.uncommon-route/benchmark_seed.json (user overrides) 2. Package data: uncommon_route/router/benchmark_seed.json (shipped default) Seed data bootstraps quality estimation before the first API fetch.
()
| 218 | |
| 219 | |
| 220 | def _load_seed_data() -> dict[str, float]: |
| 221 | """Load seed benchmark data. |
| 222 | |
| 223 | Checks two locations in order: |
| 224 | 1. User data dir: ~/.uncommon-route/benchmark_seed.json (user overrides) |
| 225 | 2. Package data: uncommon_route/router/benchmark_seed.json (shipped default) |
| 226 | |
| 227 | Seed data bootstraps quality estimation before the first API fetch. |
| 228 | The package ships with PinchBench baseline data so routing works |
| 229 | correctly from the first request. |
| 230 | """ |
| 231 | for path in [ |
| 232 | _DATA_DIR / "benchmark_seed.json", |
| 233 | Path(__file__).parent / "router" / "benchmark_seed.json", |
| 234 | ]: |
| 235 | if path.exists(): |
| 236 | try: |
| 237 | raw = json.loads(path.read_text(encoding="utf-8")) |
| 238 | if isinstance(raw, dict): |
| 239 | result = {str(k): float(v) for k, v in raw.items() if isinstance(v, (int, float))} |
| 240 | if result: |
| 241 | return result |
| 242 | except Exception: |
| 243 | continue |
| 244 | return {} |
| 245 | |
| 246 | |
| 247 | _PINCHBENCH_SEED: dict[str, float] = _load_seed_data() |