instructor

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

52|6|Updated Nov 24, 2025
One-click install
npx skills add https://github.com/ovachiever/droid-tings --skill instructor
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: instructor
Source: https://github.com/ovachiever/droid-tings/tree/main/skills/instructor
Command: npx skills add https://github.com/ovachiever/droid-tings --skill instructor

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

Extract structured data from LLM outputs with automatic validation, retry on errors, and streaming of partial results for real-time processing.

Core Features & Use Cases

  • Pydantic-based response models ensure type-safe, validated outputs
  • Automatic retries with error feedback when validation fails
  • Support for multiple providers (OpenAI, Anthropic, Google) with consistent API
  • Streaming partial results to UI or downstream processes

Quick Start

Create a Pydantic model and validate an LLM response using Instructor with a Claude or OpenAI backend.

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 type safety?

Structured data extraction from LLM responses uses Pydantic models to define expected output schemas with automatic validation. Instructor applies these schemas across OpenAI, Anthropic, and other providers, ensuring type-safe JSON parsing and catching validation errors before they reach your application.

Can I automatically retry failed LLM extractions without manual intervention?

Automatic retries on extraction failures are built into Instructor's validation layer. When Pydantic validation fails, Instructor sends error feedback back to the LLM, which regenerates the response until it conforms to your schema or a retry limit is reached.

Does Instructor support streaming partial results from LLM outputs?

Yes, Instructor supports streaming partial results for real-time processing, enabling you to pipe validated data chunks to UIs or downstream systems as they arrive rather than waiting for complete LLM responses.

What's the best way to parse complex nested JSON from multiple LLM providers consistently?

Instructor provides a unified API across OpenAI, Anthropic, and Google that handles nested-JSON parsing with type safety through Pydantic models. This eliminates provider-specific parsing logic and ensures consistent, validated extraction regardless of which LLM backend you use.

Do I need to write custom validation logic for LLM outputs, or is it built in?

Pydantic-based validation is built into Instructor, so you define schemas declaratively using Pydantic models rather than writing custom validators. Instructor automatically applies these constraints and retries the LLM if responses fail validation.

Can Instructor handle validation failures gracefully in production workflows?

Instructor is designed for production reliability through automatic retries and error feedback loops. It surfaces validation errors clearly and exhausts retries before surfacing failures, making it suitable for automated, high-throughput extraction pipelines.