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): let emailState set the body budget, as Python does (#589 parity)
divit aggarwalf6ccc0d04382
diff --git a/laya-ts/src/email.ts b/laya-ts/src/email.tsindex 18422b4d..713269ab 100644--- a/laya-ts/src/email.ts+++ b/laya-ts/src/email.ts@@ -165,10 +165,13 @@ export function emailState(sender?: string | null,clean = true,extra: Record<string, unknown> = {},+ // The budget cleanEmailBody cuts the body to, as Python's email_state(max_chars=) (#589).+ // Last, so existing positional calls keep their meaning. Ignored when clean is false.+ maxChars = 3000,): Record<string, unknown> {const state: Record<string, unknown> = {subject: (subject ?? "").trim(),- body: clean ? cleanEmailBody(body ?? "") : (body ?? ""),+ body: clean ? cleanEmailBody(body ?? "", maxChars) : (body ?? ""),};if (sender) state["from"] = sender;for (const [k, v] of Object.entries(extra ?? {})) {diff --git a/laya-ts/tests/email-presets.test.ts b/laya-ts/tests/email-presets.test.tsindex 02e8740b..d12f5f4e 100644--- a/laya-ts/tests/email-presets.test.ts+++ b/laya-ts/tests/email-presets.test.ts@@ -1,11 +1,19 @@import { describe, expect, it } from "vitest";-import { cleanEmailBody } from "../src/email.js";+import { cleanEmailBody, emailState } from "../src/email.js";import { triageQuestions, guardQuestions } from "../src/presets.js";describe("email+presets", () => {it("cuts quoted history", () => {const out = cleanEmailBody("Refund please\n\nOn Mon, Bob wrote:\nold text");expect(out).toContain("Refund please"); expect(out).not.toContain("old text");});+ it("emailState passes maxChars to the body budget, as Python does (#589)", () => {+ const body = "word ".repeat(1000) + "please wire the money today";+ expect(emailState("s", body).body).toHaveLength(3000);+ const long = emailState("s", body, null, true, {}, 8000);+ expect(long.body).toContain("wire the money");+ expect(long).not.toHaveProperty("max_chars");+ expect(emailState("s", body, null, false, {}, 10).body).toBe(body);+ });it("triage preset has 5 questions", () => {expect(Object.keys(triageQuestions()).sort()).toEqual(["churn_risk", "frustration", "intent", "is_urgent", "refund_requested"]);