Non-autoregressive System 1 decision engine. Typed choice, score and yes/no decisions over any text in a single forward pass, in 100+ languages, with a router that picks the right checkpoint per request.
Python calibrationclassificationdecision-modelhuggingfacejevmodernbertmultilingualnlppythonpytorchroutingtyped-decisionszero-shot
fix(common): refuse a bool where a temperature is expected
Aashish5915a059498e
diff --git a/laya/common.py b/laya/common.pyindex daf57a95..1c43e95f 100644--- a/laya/common.py+++ b/laya/common.py@@ -554,7 +554,14 @@ TEMP_MAX = 5.0def clamp_temperature(t, lo: float = TEMP_MIN, hi: float = TEMP_MAX) -> float:- """A usable temperature: `t` confined to [lo, hi], falling back to 1.0 if it is not a number."""+ """A usable temperature: `t` confined to [lo, hi], falling back to 1.0 if it is not a number.++ A bool is not a number either: `True`/`False` used to float to 1.0/0.0 here and read as+ fitted/sharpening temperatures, the same class of quiet acceptance `check_min_confidence`+ already refuses. A custom `lo`/`hi` still bounds either way.+ """+ if isinstance(t, bool):+ return 1.0try:t = float(t)except (TypeError, ValueError):diff --git a/tests/test_router.py b/tests/test_router.pyindex d243aafa..11cb2a30 100644--- a/tests/test_router.py+++ b/tests/test_router.py@@ -744,6 +744,8 @@ check("clamp/none falls back to neutral", clamp_temperature(None), 1.0)check("clamp/garbage falls back to neutral", clamp_temperature("x"), 1.0)check("clamp/nan falls back to neutral", clamp_temperature(float("nan")), 1.0)check("clamp/inf falls back to neutral", clamp_temperature(float("inf")), 1.0)+check("clamp/bools are not temperatures", clamp_temperature(True), 1.0)+check("clamp/False is not a sharpening zero", clamp_temperature(False), 1.0)check("clamp/bounds are sane", TEMP_MIN <= 1.0 <= TEMP_MAX, True)# 13 options is the bucket the reported skill-router landed incheck("clamp/13 options is the 11+ bucket", temp_bucket(QTYPES["choice"], 13), "choice:11+")