安全与社区 · 基础
Spam 识别
识别联系表单里的群发广告或无关推广,同时保留 unclear 选项。
ChoiceNoul
适合什么时候使用
- 联系表单
- 收件箱分流
- 社区入口
示例 state
{
"message": "We guarantee page-one rankings. Buy 10,000 backlinks today. Reply for our price list.",
"source": "contact_form"
}决策问题
Choicemessage_type
判断这条收到的消息应该进入哪一类。
sales— 正在评估我们产品的潜在客户partnership— 具体的合作提议support— 现有客户寻求帮助spam— 群发广告或无关推广unclear— 目的不明确
Noulunsolicited_promotion
这条消息主要是群发广告或无关推广,而不是正常业务请求吗?
预期输出
一个消息分类结果,以及 Spam 概率。
TypeScript 示例
import { choice, noul, TypeSafeClient } from "@typesafe-ai/sdk";
const client = new TypeSafeClient();
const result = await client.systemOne({
state: {
message:
"We guarantee page-one rankings. Buy 10,000 backlinks today. Reply for our price list.",
source: "contact_form",
},
questions: {
message_type: choice("Choose the best route for this inbound message.", {
sales: "A potential customer evaluating our product",
partnership: "A concrete collaboration proposal",
support: "An existing customer seeking help",
spam: "Unsolicited generic promotion",
unclear: "Purpose is unclear",
}),
unsolicited_promotion: noul(
"Is this message primarily unsolicited generic promotion rather than a relevant request?"
),
},
});为什么这样设计
- 保留 unclear 选项,可以避免把模糊消息强行判成 Spam。
- 单独的概率让应用可以自行选择保守阈值。
注意事项
- 不要自动删除低置信度消息。
- 这里只判断消息意图,不是完整的反滥用系统。
来源与参考
这个模板和来源链接最近核验:2026-09-21。
继续浏览
先在Playground中运行这个模式,浏览全部模板,了解官方 SDK 用法,或使用成本计算器估算实际使用成本。