choicedepartmentWhich team should handle this ticket?
billingtechnicalsales
把 Laya 放在客服工作流、人工队列或大模型之前,作为低延迟结构化决策层。
I was charged twice for invoice 441 and nobody has answered for three days. Refund the duplicate today or we are cancelling our plan.
choicedepartmentWhich team should handle this ticket?
scoreurgencyHow urgent is this request?
noulrefund_requestedDoes the customer explicitly request a refund?
from laya import Router
router = Router(preload=True)
state = {
"body": "I was charged twice for invoice 441 and nobody has answered for three days. Refund the duplicate today or we are cancelling our plan."
}
questions = {
"department": {
"type": "choice",
"instructions": "Which team should handle this ticket?",
"criteria": {
"billing": "payments, invoices, refunds",
"technical": "bugs and outages",
"sales": "pricing and contracts"
}
},
"urgency": {
"type": "score",
"instructions": "How urgent is this request?",
"criteria": ["low", "medium", "high", "critical"]
},
"refund_requested": {
"type": "noul",
"instructions": "Does the customer explicitly request a refund?"
}
}
print(router.predict(state, questions))import { Laya } from "@receptron/laya";
const laya = await Laya.load();
const result = await laya.systemOne(
{ body: "I was charged twice. Refund the duplicate today." },
{
department: {
type: "choice",
instructions: "Which team should handle this ticket?",
criteria: { billing: "payments and refunds", technical: "bugs and outages", sales: "pricing and contracts" },
},
urgency: { type: "score", instructions: "How urgent is this request?", criteria: ["low", "medium", "high", "critical"] },
refund_requested: { type: "noul", instructions: "Does the customer explicitly request a refund?" },
},
);
console.log(result.answers);
await laya.close();