instructor

Extract structured data from LLM responses and validate with Pydantic schemas.

Updated Mar 22, 2026
One-click install
npx skills add https://github.com/ChimeraFoundationa/Agentx --skill instructor-chimerafoundationa
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: instructor
Source: https://github.com/ChimeraFoundationa/Agentx/tree/main/skills/mlops/inference/instructor
Command: npx skills add https://github.com/ChimeraFoundationa/Agentx --skill instructor-chimerafoundationa

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Instructor solves the problem of reliably extracting structured data from unstructured LLM responses and validating it against Pydantic schemas.

Core Features & Use Cases

  • Automatic extraction and Pydantic validation for robust type-safety
  • Automatic retries on validation errors with actionable feedback
  • Streaming partial results for real-time UI updates
  • Multi-provider support (OpenAI, Anthropic, local models) with consistent prompts
  • Use Case: extract contact details from customer inquiries and store in typed records

Quick Start

Prompt the AI to extract a structured User record from text and validate it against a Pydantic 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 unstructured LLM responses?

To extract structured data from unstructured LLM responses, you can use Pydantic schemas to enforce type-safety and validate the output. This approach automatically retries validation errors with actionable feedback to ensure accurate data extraction.

Can I stream partial LLM results for real-time UI updates?

Yes, you can stream partial LLM results for real-time UI updates. Streaming partial results allows applications to display structured data progressively as it is generated and validated against your Pydantic models.

Does structured LLM output validation work with Anthropic and local models?

Structured LLM output validation works across multiple providers including OpenAI, Anthropic, and local models. This multi-provider support ensures consistent prompts and Pydantic validation regardless of the underlying language model.

What is the best way to handle LLM validation failures during data extraction?

The best way to handle LLM validation failures during data extraction is by implementing automatic retries. When Pydantic schema validation fails, the system provides actionable feedback to the LLM and retries the request to correct the structured output.

How do I extract multiple nested entities from text using Pydantic?

To extract multiple nested entities from text, define complex Pydantic models with nested structures. The extraction process handles multi-entity records and validates the entire hierarchical data structure against the defined schema.

Why does my LLM structured output not match my Pydantic schema?

LLM structured output may not match your Pydantic schema due to unstructured or invalid responses. Using automatic validation with retries feeds validation errors back to the LLM, forcing it to correct the output to match your schema.