Back to prompt library
Construct Vercel AI SDK Streaming Handler
Linked challenge: Automate BPO Insurance Claims Intake with AI SDK and Cognition Devin Agent
Prompt source
implementation9 lines3 sectionsNo variables0 checklist items
import { generateObject } from 'ai';
import { z } from 'zod';
const claimSchema = z.object({
caller_name: z.string(),
loss_date: z.string(),
loss_type: z.string(),
estimated_amount: z.number()
});
// Write asynchronous handler using AI SDK to parse raw text input into claimSchema