instructor

Extract structured data from LLM outputs with Pydantic validation and auto-retry.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Instructor enables reliable extraction of structured data from unstructured LLM outputs by validating against Pydantic models, automatically retrying failed extractions, and streaming partial results for real-time processing across multiple providers.

Core Features & Use Cases

  • Extract structured data from LLM outputs reliably
  • Validate outputs against Pydantic schemas automatically
  • Retry failed extractions with automatic error handling
  • Stream partial results for real-time processing
  • Multi-provider support with consistent API
  • Seamless integration into data pipelines and tooling

Quick Start

Install the instructor package and run a simple extraction example using your own data.

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

You can extract structured data from LLM outputs reliably by validating responses against Pydantic models. This approach ensures unstructured text conforms to specific data schemas, automatically retrying failed extractions to handle validation errors seamlessly.

How does Pydantic validation work with streaming LLM results?

Pydantic validation with streaming LLM results works by validating partial outputs in real-time. As the LLM generates text, the system streams partial results incrementally, ensuring the incoming data continuously matches the defined Pydantic schema.

Can I use automatic retries for LLM validation errors?

Yes, you can use automatic retries for LLM validation errors. When an extraction fails to match a Pydantic schema, the system implements automatic error handling and retries the generation, ensuring reliable structured outputs without manual intervention.

Does multi-provider LLM support work with structured output extraction?

Multi-provider LLM support works with structured output extraction by providing a consistent API across different models. This allows you to extract Pydantic-validated structured data seamlessly, regardless of the underlying LLM provider you choose.

Why do I need Pydantic schemas for LLM data pipelines?

You need Pydantic schemas for LLM data pipelines to guarantee type-safe extraction from unstructured text. Defining response models with Pydantic ensures downstream processes receive validated, structured data, preventing formatting inconsistencies from breaking pipeline automation.

What is the best way to handle unstructured LLM outputs in Python?

The best way to handle unstructured LLM outputs in Python is to validate them against Pydantic models. This method automates structured data extraction, applies type-safe schemas, and retries failures, seamlessly integrating unstructured text into reliable data pipelines.