Spaces:
Paused
Paused
File size: 2,649 Bytes
17b22d9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | """The models this harness offers, and what is true about each one.
Kept as data rather than fetched at boot: the Space must come up and be usable
when huggingface.co is slow or down, and a model list that sometimes appears is
worse than one that is occasionally a day stale. `insight.py` fetches the live
provider mapping on demand, for the panel that exists to show exactly that.
"""
from __future__ import annotations
from dataclasses import asdict, dataclass, field
@dataclass(frozen=True)
class Model:
id: str
label: str
vendor: str
providers: list[str] = field(default_factory=list)
reasoning: bool = False
context_tokens: int | None = None
note: str = ""
def to_json(self) -> dict:
d = asdict(self)
d["contextTokens"] = d.pop("context_tokens")
return d
# Verified live on the HF router on 2026-08-28. `providers` is the routing
# order reported by the hub, not a preference of ours.
MODELS: tuple[Model, ...] = (
Model(
id="zai-org/GLM-5.3",
label="GLM-5.3",
vendor="Z.ai",
providers=["zai-org", "baseten"],
reasoning=True,
context_tokens=200_000,
note="Released 2026-08-28. Emits a separate reasoning stream and "
"defaults to maximum thinking budget.",
),
Model(
id="zai-org/GLM-5.3-Flash",
label="GLM-5.3 Flash",
vendor="Z.ai",
providers=["novita", "together", "fireworks-ai", "zai-org", "baseten"],
reasoning=True,
context_tokens=200_000,
note="The small sibling. Useful for checking whether a slow answer is "
"the model or the route.",
),
Model(
id="deepseek-ai/DeepSeek-V4-Pro-0813",
label="DeepSeek V4 Pro",
vendor="DeepSeek",
providers=["novita", "together", "fireworks-ai", "baseten", "deepinfra"],
reasoning=True,
context_tokens=163_840,
note="The comparison model: the latest DeepSeek as of 2026-08-13.",
),
Model(
id="deepseek-ai/DeepSeek-V4-Flash-0731",
label="DeepSeek V4 Flash",
vendor="DeepSeek",
providers=["novita", "together", "fireworks-ai", "baseten", "deepinfra"],
reasoning=True,
context_tokens=163_840,
note="Fast DeepSeek, for a like-for-like against GLM-5.3 Flash.",
),
)
DEFAULT_MODEL = "zai-org/GLM-5.3"
_BY_ID = {m.id: m for m in MODELS}
def get(model_id: str) -> Model | None:
return _BY_ID.get(model_id)
def is_allowed(model_id: str) -> bool:
"""Model ids arrive from the browser and are pasted into an upstream URL."""
return model_id in _BY_ID
|