Structured Output: Getting Reliable JSON from an LLM
Asking a model to "reply in JSON" works most of the time. Production code needs it to work every time. Structured outputs constrain the response to a JSON Schema, so the result always parses. TypeScript with Zod import Anthropic from '@anthropic-ai/sdk'; impor...