instructor

Extract structured data from LLM responses with Pydantic validation.

Updated Apr 11, 2026
One-click install
npx skills add https://github.com/hhhi21g/HealthCenter --skill instructor-hhhi21g
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: instructor
Source: https://github.com/hhhi21g/HealthCenter/tree/main/.codex/skills/instructor
Command: npx skills add https://github.com/hhhi21g/HealthCenter --skill instructor-hhhi21g

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill ensures accurate and reliable data extraction from LLM responses, automates validation, and offers robust error handling through automatic retries.

Core Features & Use Cases

  • Structured Data Extraction: Extract data from LLM responses reliably with Pydantic validation.
  • Automatic Validation: Validate outputs against Pydantic schemas automatically.
  • Retry Failed Extractions: Retry failed extractions with automatic error handling.
  • Parsing Complex JSON: Parse complex JSON with type safety and validation.
  • Streaming Partial Results: Stream partial results for real-time processing.
  • Multi-Provider Support: Support multiple LLM providers with consistent API.
  • Use Case: Use Instructor to extract structured data from AI-generated text, enabling efficient data processing and analysis.

Quick Start

Use the instructor skill to extract user data from the AI-generated response: "John Doe is 30 years old. His email is [email protected]".

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, define a schema and let the tool automatically validate the output. It retries failed extractions automatically, ensuring reliable type safety and accurate JSON parsing.

What is the best way to parse complex JSON from LLM outputs with type safety?

Parsing complex JSON with type safety is best handled by validating LLM outputs against Pydantic schemas. This approach automatically enforces data types and structures, retrying failed extractions to ensure robust JSON parsing.

Can I use Instructor with multiple LLM providers like OpenAI and Anthropic?

Yes, you can use it with multiple LLM providers like OpenAI and Anthropic. It offers a consistent API for structured data extraction across different platforms, ensuring Pydantic validation and automatic retries work uniformly.

How does streaming partial results from LLM responses work for real-time processing?

Streaming partial results works by emitting structured data segments as the LLM generates them. This enables real-time processing and immediate validation of partial JSON outputs against Pydantic schemas without waiting for the full response.

Why does LLM structured data extraction fail and how do automatic retries work?

LLM structured data extraction fails when responses do not match Pydantic schemas or contain invalid JSON. Automatic retries work by feeding validation errors back to the LLM, prompting it to correct the output and retry the extraction.