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
docs(mcp): every tool argument row must name every handler param
Aashisheedaec7a9e72
diff --git a/docs/cli-mcp.md b/docs/cli-mcp.mdindex 97edf633..dede31f1 100644--- a/docs/cli-mcp.md+++ b/docs/cli-mcp.md@@ -155,7 +155,7 @@ Laya does not open a network port.| `laya_preset` | Runs a built-in workflow using its built-in question set. | `preset`, `state`, optional `task`, `lang`, `lang_guess`, `max_len`, `head_max_len`, `min_confidence` || `laya_predict_batch` | Answers many requests in one call. Requests are routed first and grouped by checkpoint, so matching question schemas share forward passes; answers come back in input order. | `requests`, each `{state, questions, model?, task?, lang?, lang_guess?, max_len?, head_max_len?}`, optional `batch_size` || `laya_route_batch` | Decides which checkpoint would answer each request, with no forward pass and no checkpoint load. | `requests`, same shape as `laya_predict_batch` |-| `laya_decide` | Answers a JSON-schema-shaped decision in one forward pass and returns the decided values with per-field confidence, instead of an answer map to parse. Schema properties may be enum choices, booleans, or integers with a minimum and maximum; free strings, arrays, and nested objects are rejected by path. | `state`, `schema`, optional `model` |+| `laya_decide` | Answers a JSON-schema-shaped decision in one forward pass and returns the decided values with per-field confidence, instead of an answer map to parse. Schema properties may be enum choices, booleans, or integers with a minimum and maximum; free strings, arrays, and nested objects are rejected by path. | `state`, `schema`, optional `model`, `min_confidence` |The three batch and schema tools exist because the same operations are available on the SDK and`laya-serve`: handling many requests, or serving a caller that already knows the answer shape,diff --git a/tests/test_mcp.py b/tests/test_mcp.pyindex c8882ecf..2a287d00 100644--- a/tests/test_mcp.py+++ b/tests/test_mcp.py@@ -2569,6 +2569,60 @@ def test_server_shortlist_k_default():"schema=%r library=%r" % (advertised, DEFAULT_SHORTLIST_K))+def test_cli_mcp_page_tool_argument_rows():+ """Every single-shot tool row on the MCP docs page names every parameter the handler takes.++ The "Main inputs" cell is a fourth copy of the shape, after the validator error message, each+ tool's registered description, and the README. The existing gate at+ `test_batch_item_shape_as_documented` covers the batch rows' per-request keys but does not+ read the six single-shot rows, so a whole control can fall off the table while the tool+ accepts it. The `laya_decide` row was in that state: the server registers+ `laya_decide_tool(state, schema, model='auto', min_confidence=None)` and the tool's own+ description spells out `min_confidence`, but the docs row read+ "`state`, `schema`, optional `model`" -- so a caller who trusts the table hand-rolls the+ abstention check on `values`, never learning the tool already nulls an unsure field.++ Each row's third cell is read straight from `docs/cli-mcp.md`, and every public parameter+ `inspect.signature()` sees on the registered handler must appear backticked in the cell.+ Batch tools are skipped because their cell uses a `{...}` item shape that the sibling gate+ above already holds against `batch_item_key_doc`. The pre-fix wording is banned by direct+ substring so the check fails if the `laya_decide` row reverts.+ """+ import inspect++ from laya.mcp import server as server_mod++ page = (Path(__file__).resolve().parents[1] / "docs" / "cli-mcp.md").read_text(encoding="utf-8")++ def row_cell(tool):+ for line in page.splitlines():+ if line.startswith("| `%s` |" % tool):+ cells = [c.strip() for c in line.strip().strip("|").split("|")]+ if len(cells) >= 3:+ return cells[2]+ return None++ for tool in ("laya_status", "laya_route", "laya_predict",+ "laya_shortlist", "laya_preset", "laya_decide"):+ cell = row_cell(tool)+ ok("docs-mcp/args_row_%s_present" % tool, cell is not None, "row not found")+ if cell is None:+ continue+ handler = getattr(server_mod, "%s_tool" % tool)+ params = [+ p.name for p in inspect.signature(handler).parameters.values()+ if p.kind in (p.POSITIONAL_OR_KEYWORD, p.KEYWORD_ONLY)+ and not p.name.startswith("_")+ and p.name not in ("router", "preset_builder") # server-injected deps+ ]+ missing = [p for p in params if "`%s`" % p not in cell]+ ok("docs-mcp/args_row_%s_names_every_param" % tool, not missing,+ "missing=%r cell=%r" % (missing, cell))++ ok("docs-mcp/args_row_decide_drops_the_three_param_version",+ "| `state`, `schema`, optional `model` |" not in page)++test_device()test_real_device()test_private_contract()@@ -2603,6 +2657,7 @@ test_auto_task_env()test_default_model_env()test_server_registration()test_server_shortlist_k_default()+test_cli_mcp_page_tool_argument_rows()print("\n%d passed, %d failed" % (len(PASS), len(FAIL)))for f in FAIL: