instructor
NewExtract structured data from LLM responses with Pydantic validation, retry failed extractions automatically, parse complex JSON with type safety, and stream partial results with Instructor - battle-tested structured output library
Summary
Instructor is a structured output library that extracts typed, validated data from LLM responses using Pydantic models.
- It automatically retries failed extractions, handles complex JSON parsing with type safety, and supports streaming partial results, making it essential for building reliable AI-powered applications.
Install & Usage
~/.claude.jsonAdd the configuration to "mcpServers": { "instructor": { "command": "...", "args": [] } }
/mcpUse Cases
Usage Examples
/instructor Extract a Person object with name, age, and email fields from this text: 'John Doe is 30 and can be reached at [email protected]'
Use Instructor to parse a list of products from the LLM response, each with name, price, and category, retrying up to 3 times on failure.
Stream partial extraction results from a long document analysis, showing progress as each section is validated.
Security Audits
Frequently Asked Questions
What is instructor?
Instructor is a structured output library that extracts typed, validated data from LLM responses using Pydantic models. It automatically retries failed extractions, handles complex JSON parsing with type safety, and supports streaming partial results, making it essential for building reliable AI-powered applications.
How to install instructor?
To install instructor: open your mcp config (~/.claude.json), then add the config to "mcpServers": { "instructor": { "command": "...", "args": [] } }. Finally, /mcp in Claude Code.
What is instructor best for?
instructor is a mcp categorized under General. It is designed for: testing, ai-&-ml, coding. Created by davila7.
What can I use instructor for?
instructor is useful for: Parse unstructured LLM responses into strongly-typed Pydantic models for downstream processing.; Automatically retry extraction when the LLM returns malformed or incomplete JSON.; Stream partial structured results from the LLM for real-time UI updates or progressive validation.; Validate complex nested JSON schemas with custom validators and error handling.; Extract multiple entities or relationships from a single LLM response in a type-safe manner.; Integrate structured output extraction into existing Python codebases with minimal boilerplate..