instructor

Extracts and validates structured data from LLM outputs using Pydantic schemas.

Updated Apr 24, 2026
One-click install
npx skills add https://github.com/Harries/hermes-agent --skill instructor-harries
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: instructor
Source: https://github.com/Harries/hermes-agent/tree/main/optional-skills/mlops/instructor
Command: npx skills add https://github.com/Harries/hermes-agent --skill instructor-harries

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill enables reliable extraction of structured data from LLM responses by validating outputs against Pydantic models and retrying failed extractions automatically, reducing manual post-processing and errors.

Core Features & Use Cases

  • Automatic validation of LLM outputs against Pydantic schemas with automatic retries on validation failures.
  • Streaming partial results for real-time processing and support for multiple providers (OpenAI, Anthropic).
  • Flexible output modeling with nested schemas, enums, and model-level validation to handle complex data extraction tasks.
  • Use Cases include building data pipelines, form-data ingestion, and chat assistants that return structured data.

Quick Start

Provide a sample LLM response and a Pydantic model, then run the Instructor client to extract and validate a structured object from the response.

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 outputs?

You can extract structured data from LLM outputs by validating responses against Pydantic schemas. This approach maps raw text into typed objects, automatically retrying failed extractions to ensure valid, structured results without manual post-processing.

How does Pydantic validation work with LLM responses?

Pydantic validation checks LLM responses against predefined schemas, mapping text to structured objects. If validation fails, the system automatically retries the extraction, correcting formatting or typing errors dynamically until the output matches the schema.

Can I use structured output extraction with OpenAI and Anthropic models?

Yes, structured output extraction supports multiple providers including OpenAI and Anthropic. You can configure the extraction client across these platforms to validate LLM responses against Pydantic models for consistent data extraction.

What is the best way to handle complex data extraction from LLMs?

The best way to handle complex data extraction is using nested Pydantic schemas, enums, and model-level validation. This allows you to define multi-layered data structures and enforce strict validation rules directly on the LLM output.

Does structured LLM output extraction support streaming partial results?

Yes, structured LLM output extraction supports streaming partial results for real-time processing. This allows you to process and consume validated data chunks incrementally as the LLM generates the response, rather than waiting for completion.