Jev 判断模型
Jev 由 TypeSafe 提供,是判断模型,不是聊天模型。给它一段文字和一个问题,它直接回答归哪一类、打几分、是还是否,结果可以被程序直接使用。典型场景:把"订单重复扣款"的客户反馈自动分到账单团队、给一条评论打满意度分、判断一封邮件是否在要求退款。
Jev 使用 TypeSafe 接口格式:提交 state 与 questions,读取 answers。它不接受 messages、stream、temperature、max_tokens,也不能作为 Codex、Claude Code 等客户端的对话模型。鉴权与其它接口相同,使用 Authorization: Bearer sk-xxxxxxxx,密钥需选择 TypeSafe 企业版 分组。
请求示例
下面把一条"重复扣款"的反馈分到 billing、technical 或 other。模型名固定为 Jev。
curl "https://apicdn.xyc.ai/v1/systemone" \
-H "Authorization: Bearer sk-xxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "Jev",
"state": "I was charged twice for the same order.",
"questions": {
"department": {
"type": "choice",
"instructions": "Which team should handle this customer message?",
"criteria": {
"billing": "Charges, payments and refunds",
"technical": "Bugs and integration issues",
"other": "Other requests"
}
}
}
}'
响应结构
这条反馈被分到 billing,并返回各分类的概率。answers.department.choice 是选中的分类,probabilities 是各分类概率,confidence 是模型对这次判断的置信度。
{
"model": "Jev",
"answers": {
"department": {
"type": "choice",
"choice": "billing",
"probabilities": {"billing": 0.96, "technical": 0.01, "other": 0.03},
"confidence": 0.92
}
},
"usage": {"input_tokens": 339, "output_tokens": 38}
}
三种判断类型
| 类型 | 提交什么 | 读取什么 |
|---|---|---|
choice 分类 | criteria 为「选项名 → 说明」的对象,最多 255 个选项 | choice、probabilities、confidence |
score 评分 | criteria 为按分值从低到高排列的说明数组(2–10 档) | score(可能有小数)、legend、probabilities、confidence |
noul 是非 | 只需 instructions,可选 criteria.true / criteria.false | noul 为 0–1 的数值,越接近 1 越倾向"是" |
state 可以是文本、对象或数组。questions 里每个自定义问题名都会在 answers 中对应返回;多个问题分别独立判断,前一个问题的答案不会传给后一个。
评分示例
{
"model": "Jev",
"state": "这个产品用了三天就坏了,客服态度也很差。",
"questions": {
"sentiment": {
"type": "score",
"instructions": "评价这条评论的满意度",
"criteria": ["非常不满", "不满", "一般", "满意", "非常满意"]
}
}
}
// answers.sentiment → {"type":"score","score":0.01,"legend":{"0":"非常不满",...},"probabilities":{"0":0.99,...},"confidence":0.99}
是非示例
{
"model": "Jev",
"state": "Hi, I want to cancel my subscription and get a refund.",
"questions": {
"is_refund": {"type": "noul", "instructions": "Is the customer asking for a refund?"}
}
}
// answers.is_refund → {"type":"noul","noul":0.99}
用官方 SDK 接入
TypeSafe 官方 SDK 可直接使用,只需把 base_url 指向网关、api_key 换成 XycAi 密钥,模型指定为 Jev。
Python(pip install typesafe-sdk):
import os
from typesafe_sdk import Choice, TypeSafeClient
client = TypeSafeClient(
api_key=os.environ["XYCAI_API_KEY"],
base_url="https://apicdn.xyc.ai",
model="Jev",
)
response = client.system_one(
state="I was charged twice for the same order.",
questions={
"department": Choice(
instructions="Which team should handle this customer message?",
criteria={
"billing": "Charges, payments and refunds",
"technical": "Bugs and integration issues",
"other": "Other requests",
},
),
},
)
print(response.answers["department"])
TypeScript(npm install @typesafe-ai/sdk):
import { choice, TypeSafeClient } from "@typesafe-ai/sdk";
const client = new TypeSafeClient({
apiKey: process.env.XYCAI_API_KEY,
baseURL: "https://apicdn.xyc.ai",
});
const response = await client.systemOne({
model: "Jev",
state: "I was charged twice for the same order.",
questions: {
department: choice("Which team should handle this customer message?", {
billing: "Charges, payments and refunds",
technical: "Bugs and integration issues",
other: "Other requests",
}),
},
});
console.log(response.answers.department);
价格与限制
按 输入 token 计费,输出免费;以模型广场 TypeSafe 企业版实时价格为准。state 加最长的单个问题不超过 32K tokens,state 加全部问题合计不超过 64K tokens。
排查调用问题
| 状态码 | 原因 |
|---|---|
401 | 密钥无效或未带 Authorization: Bearer 请求头 |
403 | 密钥分组不含 Jev,请把密钥分组改为 TypeSafe 企业版 |
400 | state、questions、问题类型或 criteria 格式错误,错误信息会指出具体字段 |
404 | 请求路径应为 /v1/systemone |
429 | 超过限流,稍等后按指数退避重试;官方 SDK 默认会自动重试 |
接口定义参考 TypeSafe API 文档,三种类型的完整写法见 TypeSafe primitives。