import { choice, noul, score, TypeSafeClient } from "@typesafe-ai/sdk";
const client = new TypeSafeClient();
const res = await client.systemOne({
state: { ticket: "I was charged twice this month and nobody replies" },
questions: {
queue: choice("Which team handles this?", {
billing: "payments, refunds, invoices",
technical: "bugs, outages, integrations",
sales: "pricing, upgrades, contracts",
}),
urgent: noul("Does the customer need a reply within the hour?"),
sentiment: score("How frustrated is the customer?", { levels: 5 }),
},
});
res.answers.queue.choice; // "billing"
res.answers.queue.probabilities; // { billing: 0.84, technical: 0.11, sales: 0.05 }
res.answers.urgent.noul; // 0.71
res.answers.sentiment.score; // 3.8