import { choice, noul, score, TypeSafeClient } from '@typesafe-ai/sdk'
const client = new TypeSafeClient()
const { answers } = await client.systemOne({
state: { ticket }, // 材料:文本或 JSON
questions: {
severity: score('How severe?', [ // 打分题:3 档
'Cosmetic', 'Workaround exists', 'Blocking',
]),
},
})
response = TypeSafeClient().system_one(
state=ticket,
questions={
"department": Choice(...), # 单选
"is_urgent": Noul(...), # 是非概率
},
)
response.answers["department"].choice # → "billing"
response.answers["is_urgent"].noul # → 0.93
import laya
from laya import Router
router = Router(preload=True) # 按语言自动选检查点
result = router.predict(state, questions) # 一次前向,所有题一起答
print(result["answers"]["department"]["choice"])
两者的请求 / 返回形状基本一致——这就是「Jev 兼容」的含义。部分开源项目(如 SemIf、openjev-sglang)直接实现了 TypeSafe 的接口格式,换一个服务地址就能切换。