基础设施
在 TypeSafe 的 Jev 上构建版本化判断函数,后端通过 HTTP 调用,coding agent 通过 MCP 调用,密钥保存在本地。
Build versioned judgment functions on TypeSafe's Jev once, then call the same published version from your backend over HTTP and from coding agents over MCP. The vendor key stays on your machine.
app.post("/v1/systemone", async (req, reply) => {链接指向我们抓取当天的那个 commit,行号是准的。
下面是从这个项目源码里原样取出来的 question 组合。
取自 apps/web/src/snippets.ts:20
is_billing是/否Is this a billing or refund issue?
import { experimental_evaluate as evaluate } from 'ai';
const { answers } = await evaluate({
model: 'typesafe-ai/jev',
state,
questions: {
is_billing: { type: 'boolean', instructions: 'Is this a billing or refund issue?' },
},
});取自 tests/integration.test.ts:428
is_billing是/否这是账单问题吗?
import { experimental_evaluate as evaluate } from 'ai';
const { answers } = await evaluate({
model: 'typesafe-ai/jev',
state,
questions: {
is_billing: { type: 'boolean', instructions: '这是账单问题吗?' },
},
});取自 tests/official-contract.test.ts:38
department选项Which team should handle this
billing — Payment or subscription issuestechnical — Bugs or integration problemssales — Pricing or account questionsfrustration打分How frustrated the customer appears
0 — Calm, just stating facts1 — Frustrated but civil2 — Very angry, strong languageis_urgent是/否The message conveys urgency or time-sensitivity
import { experimental_evaluate as evaluate } from 'ai';
const { answers } = await evaluate({
model: 'typesafe-ai/jev',
state,
questions: {
department: { type: 'choice', instructions: 'Which team should handle this',
criteria: { billing: 'Payment or subscription issues', technical: 'Bugs or integration problems', sales: 'Pricing or account questions' } },
frustration: { type: 'score', instructions: 'How frustrated the customer appears',
criteria: ['Calm, just stating facts', 'Frustrated but civil', 'Very angry, strong language'] },
is_urgent: { type: 'boolean', instructions: 'The message conveys urgency or time-sensitivity' },
},
});