Buckets:
| from __future__ import annotations | |
| import json | |
| from pathlib import Path | |
| from typing import Any | |
| ROADMAP_PATH = Path(__file__).with_name("roadmap.json") | |
| def load_roadmap(path: Path = ROADMAP_PATH) -> dict[str, Any]: | |
| return json.loads(path.read_text(encoding="utf-8")) | |
| def weighted_score(candidate: dict[str, Any], weights: dict[str, float]) -> float: | |
| context_tokens = float(candidate["context_tokens"]) | |
| context_score = min(context_tokens / 131072.0, 1.0) | |
| score = ( | |
| weights["base_capability"] * float(candidate["base_capability_score"]) | |
| + weights["finance_bootstrap"] * float(candidate["finance_bootstrap_score"]) | |
| + weights["context_window"] * context_score | |
| + weights["trainability"] * float(candidate["trainability_score"]) | |
| + weights["license_and_operational_readiness"] * float(candidate["license_and_operational_readiness_score"]) | |
| ) | |
| return round(score, 4) | |
| def roadmap_report(path: Path = ROADMAP_PATH) -> dict[str, Any]: | |
| roadmap = load_roadmap(path) | |
| weights = roadmap["quantitative_decision_weights"] | |
| candidates = [] | |
| for candidate in roadmap["candidates"]: | |
| enriched = dict(candidate) | |
| enriched["weighted_score"] = weighted_score(candidate, weights) | |
| candidates.append(enriched) | |
| score_rank = sorted(candidates, key=lambda c: c["weighted_score"], reverse=True) | |
| context_rank = sorted(candidates, key=lambda c: int(c["context_tokens"]), reverse=True) | |
| current = next(c for c in candidates if c["id"] == roadmap["strategy"]["current_default_model"]) | |
| return { | |
| "policy_version": roadmap["policy_version"], | |
| "candidate_count": len(candidates), | |
| "current_default_model": current["id"], | |
| "current_default_weighted_score": current["weighted_score"], | |
| "current_default_context_tokens": current["context_tokens"], | |
| "highest_score_candidate": score_rank[0]["id"], | |
| "highest_score": score_rank[0]["weighted_score"], | |
| "highest_context_candidate": context_rank[0]["id"], | |
| "highest_context_tokens": context_rank[0]["context_tokens"], | |
| "ranked_by_score": [ | |
| { | |
| "id": c["id"], | |
| "track": c["track"], | |
| "weighted_score": c["weighted_score"], | |
| "context_tokens": c["context_tokens"], | |
| } | |
| for c in score_rank | |
| ], | |
| "ranked_by_context": [ | |
| { | |
| "id": c["id"], | |
| "track": c["track"], | |
| "weighted_score": c["weighted_score"], | |
| "context_tokens": c["context_tokens"], | |
| } | |
| for c in context_rank | |
| ], | |
| "promotion_rules": roadmap["promotion_rules"], | |
| } | |
| def candidate_evidence(model_id: str, path: Path = ROADMAP_PATH) -> dict[str, Any]: | |
| report = roadmap_report(path) | |
| ranked_by_score = report["ranked_by_score"] | |
| ranked_by_context = report["ranked_by_context"] | |
| score_rank = next((index + 1 for index, item in enumerate(ranked_by_score) if item["id"] == model_id), None) | |
| context_rank = next((index + 1 for index, item in enumerate(ranked_by_context) if item["id"] == model_id), None) | |
| score_record = next((item for item in ranked_by_score if item["id"] == model_id), None) | |
| if score_record is None: | |
| return { | |
| "policy_version": report["policy_version"], | |
| "model_id": model_id, | |
| "known_to_roadmap": False, | |
| "score_rank": None, | |
| "context_rank": None, | |
| "weighted_score": None, | |
| "context_tokens": None, | |
| "promotion_rules": report["promotion_rules"], | |
| } | |
| return { | |
| "policy_version": report["policy_version"], | |
| "model_id": model_id, | |
| "known_to_roadmap": True, | |
| "score_rank": score_rank, | |
| "context_rank": context_rank, | |
| "weighted_score": score_record["weighted_score"], | |
| "context_tokens": score_record["context_tokens"], | |
| "highest_score_candidate": report["highest_score_candidate"], | |
| "highest_context_candidate": report["highest_context_candidate"], | |
| "highest_context_tokens": report["highest_context_tokens"], | |
| "promotion_rules": report["promotion_rules"], | |
| } | |
Xet Storage Details
- Size:
- 4.24 kB
- Xet hash:
- e1561830cac185a3bc47322b366da7bf27610ea60417328b7186e9a235f133a7
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.