What problem does it solve?
Instructor eliminates unreliable, loosely formatted LLM responses by enforcing structured outputs that are validated and automatically retried when extraction fails.
Core Features & Use Cases
- Validated structured outputs with Pydantic: Define a schema once and have the model return data that matches your types and constraints.
- Automatic retry on validation errors: When fields don’t parse or constraints fail, the extraction is re-attempted with error feedback.
- Robust JSON handling with type safety: Parse complex/nested objects and constrained values (e.g., enums, numeric bounds) without fragile manual parsing.
- Streaming partial results: Emit incremental structured updates so downstream systems can react in real time.
Use Instructor when you need to extract entities, classify items, or convert long-form text into consistent JSON records for pipelines (ETL, reporting, search indexing, or tool-parameter generation).
Quick Start
Ask your AI to extract the required fields from the text and return them as a Pydantic model, retrying automatically if any fields fail validation.