InstructorFast, schema-first data extraction from LLMs
Instructor
A Python library for structured outputs from LLMs with automatic validation.
Free

Instructor is the most popular Python library for extracting structured data from Large Language Models (LLMs). With over 3 million monthly downloads, it’s the go-to solution for developers needing reliable, validated outputs from AI models.
Built on Pydantic, it provides type-safe data extraction with features like:
- Structured Outputs: Define Pydantic models to specify data requirements.
- Automatic Retries: Built-in logic for when validation fails.
- Data Validation: Ensures response quality with Pydantic.
- Streaming Support: Real-time processing of responses from multiple providers like OpenAI, Google, and more.
- Type Safety: Full IDE support and autocompletion.