JIMDRURY.
Jim Drury
A hedging chat answer and the regex needed to parse it are crossed out; instead a state document goes into evaluate() and comes back as typed answers with probabilities: Boolean refunded 0.97 and Choice next_tool 0.81 are automated, Score risk 0.46 is routed to a human
ai

Stop asking an LLM to say yes or no

3 MIN READ

Yes. No. Maybe parse that.

What Jev actually returns

The catch: evaluate, not chat

Install AI SDK 7
pnpm add ai@latest
evaluate with typesafe-ai/jev
import { experimental_evaluate as evaluate } from 'ai';

const result = await evaluate({
  model: 'typesafe-ai/jev',
  state: 'The support agent issued a full refund to the customer.',
  questions: {
    refunded: {
      type: 'boolean',
      instructions: 'Was a refund issued?',
    },
  },
  providerOptions: {
    gateway: { zeroDataRetention: true },
  },
});

console.log(result.answers.refunded);

Price and claims


What I'll try first

Similar Articles