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
release: 0.4.23, vegaml is a core dependency
Nandakishordf5186d8cce0
diff --git a/README.md b/README.mdindex bc68fc03..baef5dbc 100644--- a/README.md+++ b/README.md@@ -44,7 +44,7 @@ For TypeScript / Node.js / browser, see [`laya-ts/`](https://github.com/NandhaKiOne argument puts vegaml's engine under laya's names: a frozen 0.8B reader with a small physics engine on top, so every answer carries a conformal prediction set, an abstain flag, an out-of-distribution flag and a route decided without a threshold you had to guess at. Text, images, speech and 73k-token documents go through the same call. Python 3.10 or newer; details in [vega inside laya](#vega-inside-laya-agentvegamltrue).```bash-python -m pip install 'laya[vegaml]'+python -m pip install -U laya # 0.4.23 or newer: vegaml comes with it``````python@@ -155,22 +155,23 @@ The shipped checkpoints work zero-shot, but fine-tuning on decisions from your o**[nandhakishorm.github.io/laya](https://nandhakishorm.github.io/laya/)**: guides for [prediction hooks](https://nandhakishorm.github.io/laya/hooks/), [schema-driven decisions](https://nandhakishorm.github.io/laya/structured/), [Docker](https://nandhakishorm.github.io/laya/docker/) and [LangChain and LangGraph](https://nandhakishorm.github.io/laya/langchain/), plus a full [API reference](https://nandhakishorm.github.io/laya/reference/).-## What's new in 0.4.22--* **A guardrail confidence can no longer fall outside [0, 1].** `jev_confidence` accepts- unnormalised weights, and individually finite ones can still sum to infinity; dividing by that- sum turned every weight into zero, so two equally weighted choices reported -1.0 for a `choice`- and full confidence for a `score`. A common scale now cancels before the division, which is what- the docstring already promised the range was (#1442).-* **Large and deeply nested states are flattened lazily.** Language detection reads at most the- first 4000 characters, but the walk materialised every leaf first; it now stops as soon as the- budget is met, which is about 20x faster on a 500 KB multi-turn state (#1448).-* **`laya-ts` counts and cuts code points, like Python.** The diacritic rate divided by UTF-16- units, so two emoji could flip a state onto the English checkpoint that Python keeps off it, and- the 4000-character budgets could split a surrogate pair in half (#1445, #1446).-* **`laya-ts` honours per-request token budgets in `Router.predictBatch`.** The grouping already- separated requests by budget and `decideBatch` already passed them; the Router never read them,- so a batch encoded at the checkpoint default (#1441).+## What's new in 0.4.23++* **`laya.Agent(vegaml=True)`: vega's engine behind laya's surface.** One argument swaps the+ encoder for vegaml's frozen 0.8B universal reader and its decision engine. Every method keeps+ its laya name (`predict`, `system_one`, `predict_batch`, `predict_long`, `fit_temperatures`,+ `save_calibration`, `load_calibration`, the hooks), and every answer gains a conformal+ `prediction_set`, `abstain`, `unbound` and a `route` decided without a threshold you set:+ a fitted band when `fit` or `calibrate` has run, otherwise the engine's own abstain, unbound+ and set size. `fit(rows)` fits a head per question over the frozen features in seconds and+ serves it only where it beats the engine on your rows; `predict(image=...)`,+ `predict(audio=...)` and a 73,728-token `predict_long` go through the same call.+ `laya.vega.Router(fast=laya.Agent(), vega=agent)` switches between the two on media, length,+ language and fitted heads. Details in [vega inside laya](#vega-inside-laya-agentvegamltrue)+ and the [docs page](https://nandhakishorm.github.io/laya/vegaml/).+* **vegaml is a core dependency**, so a plain `pip install laya` carries it. `import laya` is+ as light as before: `laya.vega` is imported only when the argument is given.+* **The quickstart starts there**, with the laya checkpoints under their own heading below it.Earlier releases are in the [GitHub releases](https://github.com/NandhaKishorM/laya/releases).@@ -1088,7 +1089,7 @@ laya name; the answers gain what the engine knows that an encoder does not.```pythonimport laya-agent = laya.Agent(vegaml=True) # pip install 'laya[vegaml]' (Python 3.10+)+agent = laya.Agent(vegaml=True) # vegaml ships with laya 0.4.23 and newerout = agent.predict(state, questions)ans = out["answers"]["department"]diff --git a/docs/vegaml.md b/docs/vegaml.mdindex 0261912a..ce6856cf 100644--- a/docs/vegaml.md+++ b/docs/vegaml.md@@ -6,7 +6,7 @@ name, and the answers gain what that engine knows that an encoder does not. Theis `laya.VegaAgent`, in `laya/vega.py`.```bash-pip install 'laya[vegaml]' # Python 3.10 or newer; core laya stays on 3.9+pip install -U laya # vegaml ships with laya 0.4.23 and newer``````pythondiff --git a/laya/__init__.py b/laya/__init__.pyindex c9abb582..dd953400 100644--- a/laya/__init__.py+++ b/laya/__init__.py@@ -35,7 +35,7 @@ from .presets import (from .router import DEFAULT_MODELS, RouteDecision, Routerfrom .structured import DecisionResult, decide, decide_batch-__version__ = "0.4.22"+__version__ = "0.4.23"# Routing, language detection and email cleaning are pure Python. The torch-backed names are# resolved lazily so that `import laya` -- and therefore `from laya import Router` ordiff --git a/laya/vega.py b/laya/vega.pyindex 2f97eaa5..e80cfdc0 100644--- a/laya/vega.py+++ b/laya/vega.py@@ -32,7 +32,7 @@ already has, so a caller switches by changing one argument.**What it costs.** A 0.8B reader against a ~150M encoder: roughly five times the latency onplain text (measured 72 ms a decision against 16 ms batched on a T4), two to four gigabytes-of memory, and Python 3.10 or newer, which vegaml needs. ``pip install laya[vegaml]``. Core laya+of memory. vegaml ships with laya since 0.4.23 (``pip install -U laya``). Core layais untouched when the argument is not given, which is why this lives in its own module and isimported only on demand.@@ -79,7 +79,7 @@ __all__ = ["VegaAgent", "Router", "is_available", "HEAD_ARRAYS"]HEAD_ARRAYS = ("mu", "sd", "c", "P", "s", "W", "b")_INSTALL = ("vegaml=True needs the vegaml package, which needs Python 3.10 or newer: "- "pip install 'laya[vegaml]' (or: pip install vegaml)")+ "pip install -U laya (vegaml ships with laya 0.4.23 and newer; or: pip install vegaml)")def is_available() -> bool:diff --git a/nix/package.nix b/nix/package.nixindex 22c8bf73..78914d38 100644--- a/nix/package.nix+++ b/nix/package.nix@@ -12,7 +12,7 @@ let# side, where tests/test_packaging.py compares all three declarations (this one,# pyproject.toml and laya.__version__) and fails CI when they diverge. Nothing# did, which is how this sat at 0.3.4 while the package reached 0.3.20.- version = "0.4.22";+ version = "0.4.23";src = ../.;format = "setuptools";propagatedBuildInputs = with python3Packages; [@@ -21,6 +21,8 @@ letsafetensorshuggingface-hubnumpy+ # vegaml (a core dependency since 0.4.23) is not in nixpkgs. Everything but+ # `laya.Agent(vegaml=True)` works without it, and that call names what to install.];# Every test loads a checkpoint from the Hub -> needs network + a GPU.doCheck = false;diff --git a/pyproject.toml b/pyproject.tomlindex 3e3620d2..56bbbb5d 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"[project]name = "laya"-version = "0.4.22"+version = "0.4.23"description = "Fast, non-autoregressive System 1 decision engine with calibrated probabilities"readme = "README.md"requires-python = ">=3.10"@@ -30,6 +30,11 @@ dependencies = ["safetensors>=0.4.0","huggingface_hub>=0.20.0","numpy>=1.20.0",+ # vega's engine behind laya's surface, `laya.Agent(vegaml=True)` (laya/vega.py): conformal sets,+ # abstain and unbound flags, heads fitted on your labels, a refit calibration, 73k tokens of context,+ # images and speech. A core dependency since 0.4.23 so a plain `pip install laya` carries it; the+ # module itself is imported only when the argument is given, so `import laya` stays as light as before.+ "vegaml>=0.15.0",][tool.setuptools]@@ -49,12 +54,6 @@ fast = ["tilelang>=0.1.14"]# `pip install laya[mcp]` adds the MCP stdio server (laya.mcp / the laya-mcp-server CLI).mcp = ["mcp>=2.2.0"]-# `pip install laya[vegaml]` puts vega's engine behind laya's surface: `laya.Agent(vegaml=True)`.-# Conformal sets, abstain and unbound flags, heads fitted on your labels, a refit calibration,-# 73k tokens of context, images and speech, all through laya's own method names (laya/vega.py).-# vegaml needs Python 3.10 or newer; core laya does not, which is why this is an extra.-vegaml = ["vegaml>=0.15.0; python_version >= '3.10'"]-# `pip install laya[structured]` adds pydantic for the typed-model helpers (laya/structured.py).structured = ["pydantic>=2.0.0"]diff --git a/tests/test_audit_scope.py b/tests/test_audit_scope.pyindex fe773e86..dd304472 100644--- a/tests/test_audit_scope.py+++ b/tests/test_audit_scope.py@@ -84,18 +84,17 @@ if len(od) > 1:for m in re.finditer(r"^([A-Za-z0-9_-]+) = \[(.*?)\]", table, re.S | re.M):extras[m.group(1)] = array(m.group(2))-check_true("pyproject/core parses", len(core) == 5, core)+check_true("pyproject/core parses", len(core) == 6, core)check("pyproject/extra tables found", sorted(extras),["agno", "crewai", "fast", "langchain", "langgraph", "llamaindex", "mcp", "onnx", "serve",- "structured", "vegaml"])+ "structured"])declared = list(core) + [s for names in extras.values() for s in names]expected = sorted(set(declared))check("pyproject/extras add names the core does not have",sorted({re.split(r"[<>=!;\[ ]", s)[0] for s in declared}- {re.split(r"[<>=!;\[ ]", s)[0] for s in core}),["agno", "crewai", "fastapi", "langchain-core", "langgraph", "llama-index-core", "mcp", "onnx",- "onnxruntime", "onnxscript", "pydantic", "python-multipart", "tilelang", "uvicorn",- "vegaml"])+ "onnxruntime", "onnxscript", "pydantic", "python-multipart", "tilelang", "uvicorn"])# The two scopes: shipped (blocking) is the core plus [serve]; everything else is advisory.shipped = sorted(set(core) | set(extras.get("serve", [])))diff --git a/tests/test_vega.py b/tests/test_vega.pyindex 69177dec..0b3665ae 100644--- a/tests/test_vega.py+++ b/tests/test_vega.py@@ -220,9 +220,9 @@ def test_agent_new_does_not_divert_without_the_argument():@pytest.mark.skipif(VEGA, reason="vegaml is installed here; the ImportError path needs it absent")def test_without_vegaml_the_argument_fails_with_the_install_hint():- with pytest.raises(ImportError, match=r"laya\[vegaml\]"):+ with pytest.raises(ImportError, match=r"pip install -U laya"):laya.Agent(vegaml=True)- with pytest.raises(ImportError, match=r"laya\[vegaml\]"):+ with pytest.raises(ImportError, match=r"pip install -U laya"):laya.load(vegaml=True)