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
Merge branch 'main' into fix189
Nandakishor5217e1171b92
diff --cc .github/workflows/ci.ymlindex 00d2d499,59bacdbc..ab7b9ace--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@@ -71,7 -71,7 +72,8 @@@ jobspython tests/test_router_memory.pypython tests/test_shortlist_cosine.pypython tests/test_temperature_loading.py+ python tests/test_cli.py+ python tests/test_mcp.py- name: Email cleaning testsrun: python tests/test_email.pydiff --cc README.mdindex 9396b1e7,234cf61f..fbf9a5fa--- a/README.md+++ b/README.md@@@ -439,51 -479,33 +479,76 @@@ triage = agent.predict({"message": "My| **`score`** | Expected level on ordinal rubric, distribution, confidence | Frustration level, ticket urgency, harm severity || **`noul`** | Calibrated probability P(true) from 0.0 to 1.0 | Phishing detection, spam filtering, jailbreak detection, churn risk |+ `noul` always scores two semantic slots in `[false, true]` order and returns the probability of+ the second slot. For compatibility, those slots are shown to the model as `false` and `true` by+ default. The optional `labels` mapping overrides only that model-facing text without changing the+ returned meaning:++ ```python+ question = {+ "type": "noul",+ "instructions": "Is this review positive?",+ "criteria": {+ "false": "the review is negative",+ "true": "the review is positive",+ },+ "labels": {+ "false": "B",+ "true": "A",+ },+ }+ ```++ The `labels` mapping is optional. It must contain exactly the string keys `false` and `true`,+ whose values must be distinct non-empty strings. Mapping order does not matter, and the returned+ `noul` value is still P(true). Label sensitivity varies by checkpoint and state, so validate any+ override on your own data rather than treating `A`/`B` as a universal fix.+---+## MCP Server (Optional)++Laya can be exposed as an [MCP](https://modelcontextprotocol.io) stdio server, so any MCP+client (OpenClaw, Claude Desktop, Cursor, ...) can call typed decisions as tools+(`laya_predict`, `laya_route`, `laya_preset`, `laya_status`) without writing glue code.+This is an **optional extra**: the core package has no `mcp` dependency.++```bash+pip install "laya[mcp]"+laya-mcp-server # or: python -m laya.mcp.server+```++Example MCP client configuration (stdio transport):++```json+{+ "mcpServers": {+ "laya": {+ "command": "laya-mcp-server",+ "env": { "LAYA_DEVICE": "cpu" }+ }+ }+}+```++The environment variables follow the contract documented at the top of+[`laya/serve.py`](laya/serve.py), so the same variable has one meaning across the+package:++| Variable | Default | Meaning |+|---|---|---|+| `LAYA_DEVICE` | (auto) | Same as `laya.serve`: the value is passed straight to torch |+| `LAYA_PRELOAD` | `1` | Same as `laya.serve`: build the checkpoints at startup, not lazily |+| `LAYA_MODELS` | `english,multilingual` | Comma list to preload (serve contract). MCP difference: an empty value preloads `english,multilingual` so `typed-decisions` stays lazy; in `laya.serve` empty means every checkpoint |+| `LAYA_THREADS` | (torch default) | Same as `laya.serve`: cap torch intra-op threads for CPU inference; keep it at or below the physical core count |++The tools return structured JSON (answers with probabilities, routing metadata, device,+`latency_ms`). As with the SDK, use it for structured decisions only; not for open Q&A or+text generation. Tests: `tests/test_mcp.py` (CI, no weights) and+`tests/test_mcp_local_e2e.py` (local, real weights and a real stdio handshake).++---+## BenchmarksCommunity diagnostic: [Chinese workplace decisions (Feishu-style)](research/benchmarks/feishu_zh/README.md) · [中文说明](research/benchmarks/feishu_zh/README.zh-CN.md). Includes frozen synthetic cases, archived paired Laya/Jev responses, and an offline audit; separate from the benchmark suites below.diff --cc pyproject.tomlindex a971bf99,5e1a2b54..092e8931--- a/pyproject.toml+++ b/pyproject.toml@@@ -42,12 -42,12 +42,16 @@@ serve ="fastapi>=0.110.0","uvicorn>=0.27.0",]+ # `pip install laya[fast]` adds the TileLang GPU fast path (laya/fast.py); everything else works without it.+ 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"]+[project.scripts]+ laya = "laya.cli:main"laya-serve = "laya.serve:main"+laya-mcp-server = "laya.mcp.server:main"[project.urls]Homepage = "https://huggingface.co/convaiinnovations/laya"