Decision model · cheat sheet
d1 不写文字,它一次前向回答你列出的问题。所有问题放在 questions 里,每个问题只需要 type、instructions、criteria 三样东西。
适合:是不是垃圾广告、有没有辱骂、是否需要人工、是否包含个人信息。返回的是 0–1 的概率,自己定阈值(常用 0.5)。
{
"state": "恭喜您中奖!点击链接领取 888 元红包。",
"questions": {
"spam": {
"type": "noul",
"instructions": "这是垃圾广告吗?"
}
}
}{
"answers": {
"spam": {
"type": "noul",
"noul": 0.982
}
},
"usage": { "input_tokens": 38, "output_tokens": 0 }
}noul >= 0.5 为“是”;高风险场景用 0.8 以上再自动处理。criteria 可选,用来补充“是/否”的定义:{"true": "明确要求退款", "false": "只是咨询"}。适合:工单分流、内容分类、意图识别、页面类型判断。返回选中项、每个选项的概率和置信度。
{
"state": "包裹显示签收,但我根本没收到。",
"questions": {
"topic": {
"type": "choice",
"instructions": "这条消息属于哪一类?",
"criteria": {
"delivery": "物流、签收、丢件",
"billing": "扣费、退款、发票",
"technical": "应用或网站故障",
"other": "其他"
}
}
}
}{
"answers": {
"topic": {
"type": "choice",
"choice": "delivery",
"probabilities": {
"delivery": 0.949,
"billing": 0.004,
"technical": 0.009,
"other": 0.038
},
"confidence": 0.939
}
}
}适合:紧急程度、违规严重度、意向强度、质量评分。等级从低到高写 2–10 个。
{
"state": "再这样我就取消会员,并向银行申诉。",
"questions": {
"urgency": {
"type": "score",
"instructions": "这件事有多紧急?",
"criteria": ["可以等", "本周内", "今天内", "正在阻塞客户"]
}
}
}{
"answers": {
"urgency": {
"type": "score",
"score": 1.96,
"legend": {
"0": "可以等",
"1": "本周内",
"2": "今天内",
"3": "正在阻塞客户"
},
"probabilities": {
"0": 0.05,
"1": 0.24,
"2": 0.43,
"3": 0.29
},
"confidence": 0.378
}
}
}Math.round(1.96) = 2 → “今天内”。下面这条请求同时做了单选、是/否和打分。实测耗时约 0.4 秒。
curl https://ps5.daheiai.cn/v1/systemone \
-H 'Content-Type: application/json' \
-d '{
"state": "客户留言:这个月被你们扣了两次款,订单号 A10293。我上周就发过邮件,到现在没人回复。再这样我就取消会员。",
"questions": {
"route": {
"type": "choice",
"instructions": "这条留言应该转给哪个团队?",
"criteria": {
"billing": "扣费、退款、发票",
"technical": "应用或网站故障",
"shipping": "物流与配送",
"fraud": "疑似盗刷或未授权使用"
}
},
"angry": {
"type": "noul",
"instructions": "客户是否明显生气?"
},
"urgency": {
"type": "score",
"instructions": "这件事有多紧急?",
"criteria": ["可以等", "本周内", "今天内", "正在阻塞客户"]
}
}
}'route.choice 决定派单队列;angry.noul 超过 0.8 时提醒主管;urgency.score 四舍五入到 2 以上就插队。三个判断互不影响,也不会多花时间。
| type | criteria | 返回 | 怎么判定 |
|---|---|---|---|
noul |
可选:{"true": "...", "false": "..."} |
noul(0–1) |
>= 0.5 为是;高风险用 0.8 |
choice |
必填:对象,每个选项一句描述 | choice、probabilities、confidence |
取 choice;confidence 低转人工 |
score |
必填:数组,2–10 个等级,从低到高 | score、legend、probabilities |
四舍五入取整 |
null,图片放 images 的 data URL。