import { experimental_decide as decide } from 'ai';
import { levanto } from '@levanto/ai-sdk-provider';
const { answers } = await decide({
model: levanto.decisionModel('sage-latest'),
state: 'I was charged twice. Please refund the duplicate today.',
questions: {
refund: { type: 'boolean', instructions: 'Is the customer asking for money back?' },
team: { type: 'choice', criteria: { billing: 'Charges and refunds', technical: 'Bugs and outages' } },
urgency: { type: 'score', criteria: ['Can wait', 'This week', 'Today'] },
},
});
answers.refund.probability; // 0.997
answers.team.choice; // 'billing'
answers.urgency.score; // 1.98, from 0 to 2