instructor

Extract structured data from LLM responses into Pydantic models.

1|Updated Feb 10, 2026
One-click install
npx skills add https://github.com/informatico-madrid/Architect-Expert-Gap-Forge --skill instructor-informatico-madrid
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: instructor
Source: https://github.com/informatico-madrid/Architect-Expert-Gap-Forge/tree/main/.github/skills/instructor
Command: npx skills add https://github.com/informatico-madrid/Architect-Expert-Gap-Forge --skill instructor-informatico-madrid

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill addresses the challenge of reliably extracting structured data from Large Language Model (LLM) responses, ensuring type safety, validation, and automatic retries for failed extractions.

Core Features & Use Cases

  • Structured Data Extraction: Extract data into Pydantic models for type-safe access.
  • Automatic Validation: Pydantic models automatically validate LLM outputs.
  • Automatic Retries: Instructor retries LLM calls when validation fails, providing error feedback.
  • Streaming: Stream partial results for real-time processing.
  • Use Case: Extracting user profiles (name, age, email) from unstructured text, classifying articles into predefined categories with confidence scores, or parsing complex JSON with nested structures.

Quick Start

Use the instructor skill to extract user data into a Pydantic model by providing the LLM with a user prompt and a response model.

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 can extract structured data from LLM responses by passing a Pydantic response model to the instructor function alongside your prompt, which validates the output for type safety and automatically retries on validation failures.

What is the best way to validate LLM outputs for type safety?

Validating LLM outputs for type safety is best achieved by mapping the responses to Pydantic models, which automatically check the data structure and trigger LLM call retries with error feedback when validation fails.

Can I use instructor with Anthropic and OpenAI APIs?

Yes, instructor integrates with various LLM providers like OpenAI and Anthropic, enabling consistent API interactions for structured data extraction while maintaining Pydantic validation across different platforms.

How do I stream partial results from LLM data extraction?

Streaming partial results from LLM data extraction is supported natively, allowing you to process Pydantic model fields incrementally in real-time as the LLM generates the response.

Why does my LLM data extraction fail on complex nested JSON?

LLM data extraction often fails on complex nested JSON due to schema mismatches, but instructor addresses this by using Pydantic validation and automatic retries with error feedback to correct the LLM's output.

Do I need Pydantic to parse structured outputs from LLMs?

Yes, Pydantic is a required dependency for parsing structured outputs, serving as the core validation mechanism that defines the response model and ensures the extracted data maintains strict type safety.