instructor

Extract and validate structured data from LLM responses using Pydantic schemas.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/Hermesagents/hermes-agents --skill instructor-hermesagents
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: instructor
Source: https://github.com/Hermesagents/hermes-agents/tree/main/skills/mlops/inference/instructor
Command: npx skills add https://github.com/Hermesagents/hermes-agents --skill instructor-hermesagents

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Automates structured data extraction from LLM responses by validating outputs against Pydantic schemas, and enables automatic retries and streaming for real-time feedback.

Core Features & Use Cases

  • Validation of LLM outputs against Pydantic models to ensure type-safety and data integrity.
  • Automatic retry on validation errors with contextual error messages to guide the next attempt.
  • Streaming partial results so you can observe progress as the model generates content.
  • Multi-provider compatibility (OpenAI, Anthropic) with consistent results and schemas.

Quick Start

Install the Instructor library and create a client, then extract and validate structured data from LLM responses into your Pydantic models.

Frequently Asked Questions about instructor

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

FAQPage Schema
How do I validate LLM outputs against a Pydantic schema?▼

You can validate LLM outputs against a Pydantic schema by passing the model to the extraction function, which enforces type-safe data generation and automatically retries with contextual error feedback if validation fails.

What is the best way to get structured data from LLM responses?▼

The best way to get structured data from LLM responses is using a validation library that maps outputs directly to Pydantic models, ensuring type safety while supporting automatic retries and partial streaming for real-time feedback.

Does structured output extraction work with Anthropic and OpenAI?▼

Yes, structured output extraction works with Anthropic and OpenAI, offering multi-provider compatibility to ensure consistent schema validation and type-safe results across different LLM platforms.

How do I stream partial structured results from an LLM?▼

You can stream partial structured results from an LLM by enabling the streaming feature, which allows you to observe data extraction progress in real-time as the model generates content into your Pydantic models.

Why does LLM structured data extraction fail validation?▼

LLM structured data extraction fails validation when the generated output does not match the defined Pydantic schema, triggering an error-driven feedback loop that attempts automatic retries with contextual error messages to guide the next generation.