护栏与审查
Mastra agent 在 TypeSafe Jev 上的输入内容审核工具,单文件实现。
Input moderation for Mastra agents on TypeSafe Jev — one file
export const JEV_ENDPOINT = "https://api.typesafe.ai/v1/systemone";链接指向我们抓取当天的那个 commit,行号是准的。
下面是从这个项目源码里原样取出来的 question 组合。
blocking是/否${context}`message` is what a user typed to the assistant. Must `message` be blocked before it reaches the assistant?
import { experimental_evaluate as evaluate } from 'ai';
const { answers } = await evaluate({
model: 'typesafe-ai/jev',
state,
questions: {
blocking: { type: 'boolean', instructions: '${context}`message` is what a user typed to the assistant. Must `message` be blocked before it reaches the assistant?' },
},
});