Instructor
by Jason Liu (community)
Structured output for LLMs via Pydantic. The cleanest answer to 'just give me a typed object back'.
OSS
Instructor
Added 17 May 2026
Overview
Instructor patches the major LLM clients to return Pydantic models (or Zod schemas, in TS) instead of raw strings. It handles validation, retries, and streaming of structured output across providers. The first thing most engineering teams reach for when they need an LLM call that has to round-trip data reliably.
Best for
Best for
Engineers tired of regexing JSON out of model output
Use cases
- Force a model to return a well-typed JSON object on every call
- Add validation and retries to structured extraction tasks
- Stream typed structured output to the UI
- Use across many providers with one consistent API
Notes
Why it matters
Structured output is the unsung hero of production LLM apps. Instructor made the typed-object pattern the default, not the exception.
How teams use it in production
Patch the client, write a Pydantic model, ask for the model back. The rest of the code looks like a normal service. Reliability follows from the schema, not from clever prompt engineering.
What to watch
Native structured output is shipping across most major providers. Instructor’s value is the cross-provider consistency layer that stays useful when each provider does it slightly differently.
Pros
- Drop-in patch on existing OpenAI, Anthropic, Google clients
- Validation + retries handled cleanly
- Streaming structured output is rare and well-implemented
- Strong docs and large community
Cons
- Python implementation is more mature than TypeScript
- Adds a layer of abstraction on top of provider SDKs
- Newer streaming features still evolving