客服 · 基础
退款请求识别
识别客户是不是在请求退款,同时不把分类结果当成退款授权。
ChoiceNoul
适合什么时候使用
- 客服分流
- 账单队列
- 退款审核入口
示例 state
{
"latest_message": "I was charged twice for order A-1042. Please reverse one charge.",
"order_id": "A-1042",
"settled_charges_count": 2,
"previous_refund": false
}决策问题
Choiceprimary_request
客户的主要请求是什么?
refund— 要求退款或撤销扣款access— 账户或登录帮助troubleshooting— 产品行为异常或故障排查cancel— 取消订阅other— 以上都不是
Noulrefund_request_supported
提供的消息和订单状态是否支持“客户正在请求退款或撤销扣款”这一判断?
预期输出
一个 primary_request 分类结果,以及“客户确实在请求退款”的概率。
TypeScript 示例
import { choice, noul, TypeSafeClient } from "@typesafe-ai/sdk";
const client = new TypeSafeClient();
const result = await client.systemOne({
state: {
latest_message:
"I was charged twice for order A-1042. Please reverse one charge.",
order_id: "A-1042",
settled_charges_count: 2,
previous_refund: false,
},
questions: {
primary_request: choice("What is the customer's primary request?", {
refund: "Money back or reversing a charge",
access: "Account or login help",
troubleshooting: "Help with broken product behavior",
cancel: "Ending a subscription",
other: "None of the above",
}),
refund_request_supported: noul(
"Does the supplied evidence support that the customer is asking for a refund or charge reversal?"
),
},
});
console.log(result.answers);为什么这样设计
- 可选类别提前定义好,每个结果都能直接用于后续分流。
- state 里把客户原话和订单事实分开,减少混淆。
- 额外的 Noul 问题给出概率,不会把分类结果直接变成退款动作。
注意事项
- 识别退款请求不等于授权退款。
- 是否真的能退款,仍要由明确的退款规则和支付记录决定。
来源与参考
这个模板和来源链接最近核验:2026-09-21。
继续浏览
先在Playground中运行这个模式,浏览全部模板,了解官方 SDK 用法,或使用成本计算器估算实际使用成本。