instructor

Extract structured data from LLM outputs with Pydantic validation and automatic retries.

97|8|Updated Mar 20, 2026
One-click install
npx skills add https://github.com/peteromallet/megaplan --skill instructor-peteromallet
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: instructor
Source: https://github.com/peteromallet/megaplan/tree/main/megaplan/agent/skills/mlops/inference/instructor
Command: npx skills add https://github.com/peteromallet/megaplan --skill instructor-peteromallet

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This skill enables reliable extraction of structured data from LLM outputs by validating results with Pydantic models and performing automatic retries when validation fails, reducing errors in AI-assisted data pipelines.

Core Features & Use Cases

  • Data extraction from LLM responses with Pydantic validation
  • Automatic retries on validation failures and error feedback
  • Streaming partial results for real-time processing

Quick Start

Provide a sample LLM output and a Pydantic model to obtain a validated, typed result.

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

Stream partial LLM outputs for real-time processing by returning incremental validated data fragments as they arrive. This enables streaming partial results while maintaining Pydantic validation across multi-provider outputs.

Why does my LLM data extraction fail validation and need automatic retries?

LLM data extraction fails validation when responses do not match complex JSON schemas or Pydantic models. Automatic retries handle validation errors by feeding error feedback back to the provider end-to-end.

Can I stream partial LLM outputs in real time with Pydantic validation?

Stream partial LLM outputs for real-time processing by returning incremental validated data fragments as they arrive. This enables streaming partial results while maintaining Pydantic validation across multi-provider outputs.

Do I need provider clients to extract structured data from LLM responses?

Provider clients are required to extract structured data from LLM responses, along with the Instructor library and Pydantic. These dependencies ensure type-safe results and handle validation, errors, and retries end-to-end.

What is the best way to handle complex JSON schemas in AI data pipelines?

Handle complex JSON schemas in AI data pipelines by using Pydantic validation with reusable data models to enforce structure. Automatic retries on validation failures reduce errors and ensure robust data extraction.

Does structured data extraction work with multiple LLM providers?

Structured data extraction supports multi-provider outputs by validating results with Pydantic models regardless of the source. It handles validation, errors, and retries end-to-end across different provider clients.