Instructor
FreeMost widely used library for structured LLM outputs — typed extraction from any model, 3M+ monthly downloads
About Instructor
Instructor is a Python library that simplifies obtaining structured JSON outputs from large language models (LLMs) by leveraging Pydantic for schema definition, validation, and type safety. Instead of manually crafting JSON schemas, handling parsing errors, and retrying failed extractions, developers define a Pydantic model and call client.chat.completions.create(response_model=...) to get validated, typed data directly. It supports multiple LLM providers (e.g., OpenAI, Anthropic) through a unified interface, handling all the boilerplate and error handling automatically. With over 3 million monthly downloads, Instructor is the most widely used library for structured LLM outputs.
Key Features
Pros & Cons
- Eliminates complex boilerplate: no JSON schemas, no manual parsing
- Leverages Pydantic for robust validation and IDE autocompletion
- Works with any LLM provider through a consistent interface
- Open source and free to use (MIT license)
- Large community with 13.6k+ GitHub stars and 1.2k forks
- Reduces development time for extraction tasks
- Primarily focused on extraction; not designed for multi-step agent workflows
- Requires Python and Pydantic as a dependency
- May introduce overhead for simple one-off prompts
- Limited to cases where output can be modeled with Pydantic schemas