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(mcp): reject a non-string question type as an invalid question
Rishit Sharma5b82a1a7b89e
diff --git a/laya/mcp/tools.py b/laya/mcp/tools.pyindex b81368ef..316b42a8 100644--- a/laya/mcp/tools.py+++ b/laya/mcp/tools.py@@ -145,7 +145,7 @@ def validate_questions(questions: Any) -> dict:if not isinstance(spec, dict):raise ToolError("invalid_questions", f"questions[{name}] must be an object")qtype = spec.get("type")- if qtype not in VALID_TYPES:+ if not isinstance(qtype, str) or qtype not in VALID_TYPES:raise ToolError("invalid_questions",f"questions[{name}].type must be one of {sorted(VALID_TYPES)}, got {qtype!r}",diff --git a/tests/test_mcp.py b/tests/test_mcp.pyindex 65282847..d42af11c 100644--- a/tests/test_mcp.py+++ b/tests/test_mcp.py@@ -2772,6 +2772,10 @@ def test_question_validation_matches_the_agent():{"type": "noul", "instructions": "is true?", "option_order": "10"}),("option_order_null",{"type": "noul", "instructions": "is true?", "option_order": None}),+ # A JSON array or object as the type is unhashable, so testing it against the set of+ # types raised TypeError instead of naming the question.+ ("type_list", {"type": [], "instructions": "is true?"}),+ ("type_object", {"type": {}, "instructions": "is true?"}),]for label, qdef in parity:ok("question_parity/core_rejects_%s" % label, core_rejects("q", qdef))@@ -2846,6 +2850,8 @@ def test_a_bad_question_is_a_caller_error_not_a_server_fault():"criteria": ["fine", None]}),("option_order_repeat", {"type": "noul", "instructions": "is true?","option_order": [0, 0]}),+ ("type_list", {"type": [], "instructions": "is true?"}),+ ("type_object", {"type": {}, "instructions": "is true?"}),):try:server_mod._wrap(server_mod.laya_predict, state=STATE, questions={"q": qdef},