What it solves
Getting reliably structured data out of an LLM without writing validation and retry logic yourself.
Overview
Instructor wraps LLM API clients to enforce structured outputs using Pydantic models. The model generates JSON; Instructor validates it against your schema and retries on failure. Eliminates manual JSON parsing and brittle regex extraction from LLM responses.
Key facts
- Language
- Python
- License
- MIT
- Maturity
- Stable
- Maintainer
- instructor-ai
- Reviewed
- 2026-06-11
Where to start
Three lines to see how Pydantic schema enforcement works end-to-end.
examples/simple.pyTechnologies
More in this domain
LiteLLM
Unified API for 100+ LLM providers with OpenAI-compatible interface
Provider lock-in: writing code that works across OpenAI, Anthropic, and self-hosted models without conditional branches or SDK switching.
Outlines
Constrained text generation using regex and context-free grammars
Guaranteed-valid structured outputs from local/open-weight models: without post-processing or retry loops.