客服运营

使用 Laya 进行客服工单分流

一次判断处理部门、紧急程度和退款意图。

使用场景

把 Laya 放在客服工作流、人工队列或大模型之前,作为低延迟结构化决策层。

State

I was charged twice for invoice 441 and nobody has answered for three days. Refund the duplicate today or we are cancelling our plan.

Typed questions

choicedepartment

Which team should handle this ticket?

billingtechnicalsales
scoreurgency

How urgent is this request?

lowmediumhighcritical
noulrefund_requested

Does the customer explicitly request a refund?

预期方向

  • 查看主要结构化结果是否符合预期
  • 检查概率 / score 是否支持你的业务阈值
  • 检查概率 / score 是否支持你的业务阈值
生产前用真实工单验证分类与阈值。

直接复制代码

Python
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))
TypeScript / Node.js
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();