linvest21's picture
download
raw
2.91 kB
from __future__ import annotations
from observability.audit_log import utc_now
from model_policy.registry import DEFAULT_CANDIDATES
from model_policy.roadmap import candidate_evidence
from model_policy.profiles import resolve_model_profile
def select_model(
task: str,
env: str,
*,
strategy: str = "fingpt_first_bootstrap",
model_profile: str | None = None,
model_candidate: str | None = None,
) -> dict[str, object]:
profile = resolve_model_profile(model_profile, model_candidate=model_candidate)
candidates = DEFAULT_CANDIDATES["model_candidates"]
if model_candidate or model_profile:
selected = {
"model_id": profile["model_candidate"],
"role": profile.get("name", "configured_model_profile"),
"track": profile.get("track", "configured_profile"),
"license_status": profile.get("license", {}).get("commercial_use", "review_required"),
"provenance_recorded": True,
"private_deployable": True,
"continuation_tunable": True,
}
elif strategy == "fingpt_first_bootstrap":
selected = next(c for c in candidates if c["track"] == "fingpt_bootstrap")
else:
selected = candidates[0]
if selected["track"] == "fingpt_bootstrap":
rationale = [
"FinGPT-first bootstrap is the configured default.",
f"{selected['model_id']} is the Linvest21-owned bootstrap repo for the latest approved FinGPT multitask adapter.",
"Foundation fallback remains configured for future certified candidates.",
]
else:
license_name = profile.get("license", {}).get("name", "review required") if isinstance(profile.get("license"), dict) else "review required"
rationale = [
f"{selected['model_id']} was selected from the `{profile.get('name')}` model profile.",
f"Profile track is `{selected['track']}` with license posture `{license_name}`.",
"This profile starts from a base model unless adapter_bootstrap is explicitly enabled.",
]
return {
"selected_model": selected["model_id"],
"task": task,
"env": env,
"strategy": strategy,
"model_profile": profile,
"selected_role": selected["role"],
"candidate_track": selected["track"],
"gates": {
"license_pass": selected["license_status"] != "blocked",
"provenance_recorded": selected["provenance_recorded"],
"private_deployable": selected["private_deployable"],
"continuation_tunable": selected["continuation_tunable"],
"eval_score_pass": "pending",
"latency_cost_pass": "pending",
"rollback_supported": "pending",
},
"rationale": rationale,
"roadmap_evidence": candidate_evidence(selected["model_id"]),
"created_at": utc_now(),
}

Xet Storage Details

Size:
2.91 kB
·
Xet hash:
9d50b1bf47919436c010a7c7d083fed5531302381b86ac8c025fcca0e7185f3d

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.