instructor

Extract structured LLM outputs with Pydantic validation and automatic retries.

Updated Mar 26, 2026
One-click install
npx skills add https://github.com/cloudliness/Hermes-Autonomous-AI-Agent-Dialed-In-For-Windows-11 --skill instructor-cloudliness
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: instructor
Source: https://github.com/cloudliness/Hermes-Autonomous-AI-Agent-Dialed-In-For-Windows-11/tree/main/skills/mlops/inference/instructor
Command: npx skills add https://github.com/cloudliness/Hermes-Autonomous-AI-Agent-Dialed-In-For-Windows-11 --skill instructor-cloudliness

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Extract structured data from LLM responses with Pydantic validation, automatically retry failed extractions, parse complex JSON with type safety, and stream partial results with Instructor, a battle-tested structured output library.

Core Features & Use Cases

  • Extract structured data from LLM responses reliably
  • Validate outputs against Pydantic schemas automatically
  • Retry failed extractions with automatic error handling
  • Parse complex JSON with type safety and validation
  • Stream partial results for real-time processing
  • Support multiple LLM providers with a consistent API
  • Use cases include data pipelines, QA, and automated data extraction in AI apps

Quick Start

Install the instructor package and call the client with a prompt and a Pydantic response_model to obtain validated, structured outputs.

Frequently Asked Questions about instructor

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I extract structured data from LLM responses with Pydantic validation?

You extract structured data from LLM responses by passing a Pydantic response_model to the Instructor client, which validates the output against your schema and automatically retries failed extractions to ensure type safety.

Can I stream partial structured outputs from LLMs in real time?

Yes, you can stream partial structured outputs in real time. Instructor parses incomplete JSON responses progressively, allowing your AI workflows to process partial results as they generate rather than waiting for the full completion.

Does Instructor work with both OpenAI and Anthropic models?

Instructor works with multiple LLM providers including OpenAI and Anthropic through a consistent API. You can integrate supported provider clients to extract structured data uniformly across different underlying models.

What is the best way to parse complex JSON from LLM outputs reliably?

The best way to parse complex JSON from LLM outputs is using Pydantic schemas for type safety. Instructor handles validation, automatically retrying failed extractions to resolve JSON parsing errors and ensure the output matches your defined structure.

Why do my LLM data extraction pipelines fail when parsing JSON?

LLM data extraction pipelines fail when JSON parsing errors or schema mismatches occur. Instructor addresses this by validating responses against Pydantic models and automatically retrying failed extractions with error handling to guarantee valid output.

Do I need Pydantic models to use Instructor for structured outputs?

Yes, you need Pydantic models to use Instructor for structured outputs. Defining a Pydantic response_model is required to validate extracted data, enforce type safety, and enable automatic retries for invalid LLM responses.