instructor

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

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Instructor turns unreliable model text into structured, validated data so you can trust LLM outputs instead of manually cleaning and retrying them.

Core Features & Use Cases

  • Schema-driven extraction: Map responses into typed Pydantic models for consistent downstream processing.
  • Automatic validation and retries: Catch malformed fields, feed errors back to the model, and recover from bad outputs without manual intervention.
  • Streaming and multi-provider support: Handle partial results and work across Anthropic, OpenAI, and local model setups for production workflows.

Quick Start

Use Instructor to extract a validated structured object from a model response with automatic retry handling.

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 using Pydantic?

You extract structured data from LLM responses by mapping model outputs directly into typed Pydantic models. This enforces type safety and ensures consistent downstream processing without manual cleaning.

What is the best way to validate LLM output and handle malformed fields automatically?

The best way to validate LLM output is using automatic validation and retries. This catches malformed fields, feeds errors back to the model, and recovers from bad outputs without manual intervention.

Can I use structured output validation with both Anthropic and OpenAI providers?

Yes, structured output validation supports both Anthropic and OpenAI providers. It handles streaming and partial results across these providers, as well as local model setups, for production workflows.

Do I need Pydantic models to parse type-checked data from LLMs?

Yes, you need Pydantic models to parse type-checked data from LLMs. They are required to define the typed schemas used for schema-driven extraction and validation against model responses.

Why does LLM data extraction fail without automatic retry handling?

LLM data extraction fails without automatic retry handling because model text is inherently unreliable. Without validation and error feedback loops, malformed outputs break downstream parsing and require manual intervention.