instructor

Extract structured data from LLM responses with Pydantic validation and retries.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires instructor, pydantic, openai, anthropic, and includes references (resource) components.

What problem does it solve?

Extract structured data from LLM responses with Pydantic validation, automatically retrying failed extractions, and providing type-safe parsing with streaming support.

Core Features & Use Cases

  • Pydantic-based validation of LLM outputs to enforce schema correctness.
  • Automatic retries with helpful error feedback when validations fail.
  • Type-safe JSON parsing for complex outputs and nested structures.
  • Streaming partial results for real-time processing across providers (OpenAI, Anthropic).

Quick Start

Ask your LLM for a structured extraction using a Pydantic model and enable streaming of results.

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?

To extract structured data from LLM responses with Pydantic validation, this Skill automates schema enforcement and type-safe parsing. It leverages the Instructor library to intercept outputs, validate them against your Pydantic models, and automatically retry failed extractions.

Does this approach work with both OpenAI and Anthropic providers?

Yes, structured data extraction works with both OpenAI and Anthropic providers. The Skill requires their respective provider clients and supports multi-provider compatibility, allowing you to enforce Pydantic validation and stream partial results across different LLM environments.

What's the best way to handle LLM validation failures during data extraction?

The best way to handle LLM validation failures during data extraction is using automatic retries with helpful error feedback. When Pydantic validation fails, the Skill feeds the error back to the LLM, prompting it to correct the output and successfully conform to the schema.

Can I stream partial LLM outputs for real-time processing?

Yes, you can stream partial LLM outputs for real-time processing. The Skill supports streaming partial results across providers, enabling type-safe JSON parsing of complex and nested structures as they generate, rather than waiting for the full response.

Why do I need the Instructor library for structured LLM outputs?

You need the Instructor library because it orchestrates the core extraction logic, connecting Pydantic validation with LLM provider clients. It manages the automatic retry loops and streaming capabilities required to reliably enforce schema correctness on unstructured text.

What are the limitations of streaming partial structured data from LLMs?

A limitation of streaming partial structured data from LLMs is that nested structures may be incomplete until the full response is received. While the Skill provides real-time parsing, complex validation rules might still require waiting for the final output to fully pass Pydantic checks.