Releases: NandhaKishorM/laya
Release list
v0.3.3
Full Changelog: v0.3.2...v0.3.3
v0.3.2
v0.3.1
v0.3.0
v0.2.1 — structured criteria fix
Patch release. Fixes a crash on criteria values that are not plain strings.
Fixed
noul questions with structured criteria crashed.
agent.predict(state, {"is_phishing": {
"type": "noul",
"instructions": "Is this phishing?",
"criteria": {"true": {"desc": "phishing, scam or fraud"},
"false": {"desc": "legitimate"}}}})
# 0.2.0: TypeError: can only concatenate str (not "dict") to str
# 0.2.1: works, criteria render as JSONchoice and score did not crash but stringified dicts as Python reprs — billing: {'desc': 'payments'} went into the prompt instead of billing: {"desc": "payments"}.
A criterion whose value was 0 or False was treated as missing. The choice branch tested if not v, so those fell back to a bare key. Only None and "" mean "no description" now.
Reported and originally fixed by @trocker in #2 — this release takes the render_criterion approach from that PR on its own, since #2 also carries a large amount of unrelated work.
Added
tests/test_criteria.py — 29 regression tests: the reported crash, JSON rather than repr for dict/list/number criteria, 0/False as real values, non-ASCII, unserialisable objects, and that plain-string criteria are untouched. Both suites now gate CI and releases.
No API changes. Safe upgrade from 0.2.0.
v0.2.0 — model routing
Routes each request to the checkpoint best suited to it.
New
Router picks between laya (English), laya-multilingual (100+ languages) and laya-typed-decisions, loading lazily with LRU eviction.
from laya import Router
router = Router()
router.predict({"body": "I was charged twice"}, questions) # -> laya
router.predict({"body": "मुझसे दो बार शुल्क लिया गया"}, questions) # -> laya-multilingual
router.predict(state, questions, model="typed-decisions") # explicitroute() returns the decision and its reasoning without loading anything.
laya.lang — exact Unicode script detection over 22 scripts plus a best-effort Latin language guess. No new dependencies.
Fixed
laya-multilingualcould not be loaded at all. Itsextra_special_tokensships as a list where transformers expects a mapping, raisingAttributeError: 'list' object has no attribute 'keys'.- ModernBERT's
reference_compilenow disabled — it torch.compiles the encoder at batch sizes where that is a loss, and can hang. - Dropped a duplicate
email_questionsimport that shadowed the presets one.
Why route
Measured on a T4, identical questions per model:
laya |
laya-multilingual |
|
|---|---|---|
| MASSIVE intent, English | 0.783 | 0.657 |
| MASSIVE intent, 13 others | 0.306 | 0.451 |
| XNLI, 14 non-English | 0.521 | 0.731 |
Across all 51 MASSIVE languages the English checkpoint macro-averages 0.227 and clears 3× random on only 23 of 51; the multilingual checkpoint reaches 0.366 and clears it on 45. Khmer scores 0.000 accuracy at 0.952 confidence — the model's own confidence gives no warning, so the decision has to happen before the forward pass.
Note
If laya.load() hangs and TensorFlow is installed, run with USE_TF=0. transformers probes for TF at import and its abseil runtime can deadlock model construction.
Full benchmark data: the research branch.