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(ts): read noul criteria keys case-insensitively, as Python does
divit aggarwal191fdfbf089f
diff --git a/laya-ts/src/agent.ts b/laya-ts/src/agent.tsindex f5bc8e69..1c16d0a3 100644--- a/laya-ts/src/agent.ts+++ b/laya-ts/src/agent.ts@@ -177,7 +177,7 @@ export function checkQuestion(qid: string, qdef: unknown): void {`question ${qidStr(qid)}: a noul question takes 'criteria' as a dict with optional 'true'/'false' descriptions, or omits it`,);} else if (crit && typeof crit === "object" && !Array.isArray(crit)) {- const invalid = Object.keys(crit as Record<string, unknown>).filter((key) => key !== "true" && key !== "false");+ const invalid = Object.keys(crit as Record<string, unknown>).filter((key) => key.toLowerCase() !== "true" && key.toLowerCase() !== "false");if (invalid.length > 0) {throw new Error(`question ${qidStr(qid)}: noul criteria may contain only 'true' and 'false'; got ${JSON.stringify(invalid)}`,diff --git a/laya-ts/tests/audit-regressions.test.ts b/laya-ts/tests/audit-regressions.test.tsindex 041cf7cb..4d9f3d3c 100644--- a/laya-ts/tests/audit-regressions.test.ts+++ b/laya-ts/tests/audit-regressions.test.ts@@ -3,7 +3,7 @@ import { mkdtemp, mkdir, writeFile, rm } from "node:fs/promises";import { tmpdir } from "node:os";import { join } from "node:path";import { Agent, checkQuestion, toInternal } from "../src/agent.js";-import { buildSequence } from "../src/common.js";+import { buildSequence, renderOptions } from "../src/common.js";import { loadNodeBundle } from "../src/providers.js";const tokenizer = () => ({@@ -53,6 +53,16 @@ describe("audit regressions", () => {expect(() => checkQuestion("q", { type: "choice", instructions: "?", criteria: ["yes"], labels: { false: "No", true: "Yes" } })).toThrow("labels");});+ it("reads noul criteria keys case-insensitively, as Python does", () => {+ const upper = { type: "noul", instructions: "?", criteria: { True: "it holds", FALSE: "it does not" } };+ const lower = { type: "noul", instructions: "?", criteria: { true: "it holds", false: "it does not" } };+ expect(() => checkQuestion("q", upper)).not.toThrow();+ expect(toInternal(upper).crit).toEqual({ true: "it holds", false: "it does not" });+ expect(renderOptions(toInternal(upper))).toEqual(renderOptions(toInternal(lower)));+ expect(() => checkQuestion("q", { type: "noul", instructions: "?", criteria: { True: "x", maybe: "y" } })).toThrow("maybe");+ expect(() => checkQuestion("q", { type: "noul", instructions: "?", criteria: { yes: "x" } })).toThrow("yes");+ });+it("rejects a null score level, as Python does (#302)", () => {expect(() => checkQuestion("q", { type: "score", instructions: "?", criteria: ["low", null, "high"] })).toThrow("level 1");expect(() => checkQuestion("q", { type: "score", instructions: "?", criteria: ["low", "mid", undefined] })).toThrow("level 2");