Is it possible to use a JSON validator with a class? So instead of manually typing out the properties and required values, and adding "return using this json structure", we'd use a class. That way it's all in one spot? Thanks again!
const validator = new JSONResponseValidator({
type: 'object',
properties: {
answer: { type: 'string' },
sentiment: {
type: 'string',
enum: ['positive', 'neutral', 'negative']
}
},
required: ['answer', 'sentiment']
});
new SystemMessage(
[
`Return your answer using this JSON structure:`,
`{"answer":"<answer>","sentiment":"positive|neutral|negative"}`
].join('\n')
Is it possible to use a JSON validator with a class? So instead of manually typing out the properties and required values, and adding "return using this json structure", we'd use a class. That way it's all in one spot? Thanks again!