instructor

Extract structured data from LLM outputs using Pydantic validation.

Updated Mar 16, 2026
One-click install
npx skills add https://github.com/arsity/scholar-tools --skill instructor-arsity
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: instructor
Source: https://github.com/arsity/scholar-tools/tree/main/vendor/ai-research-skills/16-prompt-engineering/instructor
Command: npx skills add https://github.com/arsity/scholar-tools --skill instructor-arsity

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

## What problem does it solve? Extracting structured data from LLM outputs is error-prone and requires robust validation. Instructor provides type-safe extraction, automatic retry on validation failures, and streaming of partial results to improve reliability. ## Core Features & Use Cases

  • Structured extraction with Pydantic models for precise schemas
  • Automatic validation and retry loops to ensure valid outputs
  • Streaming partial results for real-time processing
  • Multi-provider support (OpenAI, Anthropic, etc.) and easy integration into apps ### Quick Start Use Instructor to define a Pydantic model and extract data from an LLM response by passing the model as response_model in your client call.

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 outputs reliably?

To extract structured data reliably, define a Pydantic model and pass it as the response_model in your LLM client call, enabling automatic validation and retry loops for type-safe results.

What is the best way to validate structured LLM outputs against a schema?

Validating structured LLM outputs against a schema is best handled by defining a Pydantic model to enforce precise schemas, enabling automatic validation and retry loops to ensure outputs match your defined structure.

Can I stream partial structured results for real-time processing from an LLM?

Yes, you can stream partial structured results for real-time processing. This approach allows applications to consume data incrementally as the LLM generates it, rather than waiting for the entire response to complete.

Does this structured extraction approach work with multiple LLM providers like Anthropic and OpenAI?

Yes, this structured extraction approach supports multi-provider compatibility, allowing seamless integration with various large language models like OpenAI and Anthropic to power data-driven applications.

Do I need to define a Pydantic model before extracting structured data from an LLM?

Yes, you must define a Pydantic model beforehand. A defined Pydantic model is required to validate and structure outputs from any large language model, serving as the response_model for your client call.

Why does my LLM data extraction fail validation and how can I fix it?

LLM data extraction fails validation when outputs do not match your defined Pydantic schema. You can fix this by enabling automatic retry loops, which prompt the LLM to regenerate outputs until validation succeeds.