instructor

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

1.0k|117|Updated Feb 26, 2026
One-click install
npx skills add https://github.com/OpenLAIR/dr-claw --skill instructor-openlair
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: instructor
Source: https://github.com/OpenLAIR/dr-claw/tree/main/skills/prompt-engineering/instructor
Command: npx skills add https://github.com/OpenLAIR/dr-claw --skill instructor-openlair

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Validating and structuring outputs from large language models is error-prone and manual, leading to inconsistent data formats and fragile workflows.

Core Features & Use Cases

  • Define strict output schemas with Pydantic to enforce data structure and types.
  • Automatically retry misextractions with actionable feedback, ensuring higher accuracy.
  • Stream partial results and operate across providers (OpenAI, Anthropic) for real-time processing.
  • Use in data extraction, classification, and structured analysis pipelines to normalize LLm outputs.

Quick Start

Provide a minimal, typed example that extracts a user profile and validates it with a Pydantic model, showing automatic retries on validation errors.

Frequently Asked Questions about instructor

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I validate structured outputs from an LLM using Pydantic?

Validate structured LLM outputs by defining strict Pydantic schemas to enforce data structure and types. The system automatically retries misextractions with actionable feedback, ensuring higher accuracy and consistent data formats for downstream Python workflows.

Can I stream partial structured data from LLM responses as they are generated?

Yes, you can stream partial structured LLM outputs. This feature operates across providers like OpenAI and Anthropic, enabling real-time processing and type-safe data extraction while the model is still generating its response.

Does this structured LLM output extraction work with both OpenAI and Anthropic providers?

Yes, structured LLM output extraction supports multiple providers including OpenAI and Anthropic. It provides a consistent API for type-safe data extraction, allowing you to normalize LLM outputs across different models within your extraction pipelines.

What is the best way to extract structured data from LLM responses for a classification pipeline?

The best way to extract structured data for a classification pipeline is using Pydantic schemas to enforce types and structure. This method normalizes LLM outputs and automatically retries validation failures, ensuring accurate and consistent data extraction.

Why does my LLM structured data extraction fail validation and how is it handled?

Structured data extraction fails validation when LLM responses do not match the defined Pydantic schema types. It is handled by automatically retrying misextractions with actionable feedback, ensuring the LLM corrects its output to achieve higher accuracy.