开源复现
OpenDecision 是一个开源语义决策引擎,类似于 TypeSafe 的 Jev。
OpenDecision is an open-source semantic decision engine like typesafe's jev.
"/v1/systemone",src/opendecision/api/app.py:82
链接指向我们抓取当天的那个 commit,行号是准的。
下面是从这个项目源码里原样取出来的 question 组合。
取自 examples/m3_typesafe_sdk_demo.py:9
department选项Which department should handle this?
billing — Payments and refundstechnical — Software problemssales — Purchasing questionsurgent是/否This request is time-sensitive.
frustration打分How frustrated is the customer?
0 — Calm1 — Frustrated2 — Extremely angryimport { experimental_evaluate as evaluate } from 'ai';
const { answers } = await evaluate({
model: 'typesafe-ai/jev',
state,
questions: {
department: { type: 'choice', instructions: 'Which department should handle this?',
criteria: { billing: 'Payments and refunds', technical: 'Software problems', sales: 'Purchasing questions' } },
urgent: { type: 'boolean', instructions: 'This request is time-sensitive.' },
frustration: { type: 'score', instructions: 'How frustrated is the customer?',
criteria: ['Calm', 'Frustrated', 'Extremely angry'] },
},
});