instructor

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

Updated Mar 30, 2026
One-click install
npx skills add https://github.com/KappTech88/AI-RESEARCH-SKILLS-MCP --skill instructor-kapptech88
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: instructor
Source: https://github.com/KappTech88/AI-RESEARCH-SKILLS-MCP/tree/main/skills/instructor
Command: npx skills add https://github.com/KappTech88/AI-RESEARCH-SKILLS-MCP --skill instructor-kapptech88

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Extract structured data from LLM responses with automatic validation and robust error handling.

Core Features & Use Cases

  • Validate LLM outputs against Pydantic models to ensure type-safe structured data.
  • Automatically retry failed extractions with error feedback to the LLM.
  • Stream partial results for real-time processing and multi-provider support (OpenAI, Anthropic, etc.).
  • Use across prompts requiring consistent structured data extraction, data cleaning, and downstream validation.

Quick Start

Provide a sample text and a Pydantic model to extract a structured User object with automatic validation and streaming.

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 an LLM response?

To extract structured data from an LLM response, validate the text against Pydantic models to ensure type-safe outputs. This approach automatically retries failed extractions by feeding validation errors back to the LLM for correction.

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

The best way to validate LLM outputs for type safety is using Pydantic models to structure the extraction. This ensures the generated data conforms to specific types and automatically handles validation failures with retry logic.

Can I stream partial structured data from LLMs in real time?

Yes, you can stream partial structured data from LLMs in real time. Streaming support allows you to process partial Pydantic model results incrementally as the LLM generates the response, enabling immediate downstream data consumption.

Does structured data extraction work across multiple LLM providers?

Structured data extraction works across multiple LLM providers through provider adapters. It supports multi-LLM backends like OpenAI and Anthropic, ensuring consistent, type-safe Pydantic validation and automated retries regardless of the provider.

How do I handle validation failures when extracting nested models from LLMs?

To handle validation failures when extracting nested models from LLMs, the system automatically retries the extraction. It feeds the specific Pydantic validation errors back to the LLM, prompting it to correct and regenerate the structured output.