SDK 与客户端
通过 TypeSafe 的 Jev API 运行 JSON Schema,返回 JSON 数据。
Run a JSON Schema through TypeSafe's Jev API, and get JSON back.
JEV_BASE_URL = "https://api.typesafe.ai"src/jev_jsonschema/client.py:30
链接指向我们抓取当天的那个 commit,行号是准的。
下面是从这个项目源码里原样取出来的 question 组合。
is_spam是/否Is this spam?
import { experimental_evaluate as evaluate } from 'ai';
const { answers } = await evaluate({
model: 'typesafe-ai/jev',
state,
questions: {
is_spam: { type: 'boolean', instructions: 'Is this spam?' },
},
});is_correct是/否Is the answer correct?
verdict是/否Overall verdict
stars打分Rate 1 to 5
0 — 11 — 22 — 33 — 44 — 5import { experimental_evaluate as evaluate } from 'ai';
const { answers } = await evaluate({
model: 'typesafe-ai/jev',
state,
questions: {
is_correct: { type: 'boolean', instructions: 'Is the answer correct?' },
verdict: { type: 'boolean', instructions: 'Overall verdict' },
stars: { type: 'score', instructions: 'Rate 1 to 5',
criteria: ['1', '2', '3', '4', '5'] },
},
});