instructor

Extract Pydantic-validated structured data from LLM responses with automatic retries.

4|Updated May 18, 2026
One-click install
npx skills add https://github.com/ZardLi1115/zedclaw --skill instructor-zardli1115
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: instructor
Source: https://github.com/ZardLi1115/zedclaw/tree/main/optional-skills/mlops/instructor
Command: npx skills add https://github.com/ZardLi1115/zedclaw --skill instructor-zardli1115

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

Instructor eliminates unreliable, inconsistently formatted LLM responses by enforcing schema-driven extraction with Pydantic validation and automatic retries when parsing fails.

Core Features & Use Cases

  • Pydantic-validated structured outputs: Map LLM responses into strongly typed models so downstream code can trust the shape and types.
  • Automatic retry on validation errors: When fields are missing or invalid, Instructor feeds the validation error back to the model and retries extraction.
  • Streaming and incremental results: Stream partial structured objects for faster feedback loops during extraction or generation.
  • Multi-provider structured output: Use consistent structured-output workflows across OpenAI and Anthropic, including JSON/tool-oriented modes.

Quick Start

Use the instructor skill to extract a Pydantic model from an input text prompt and automatically retry until the output passes schema validation.

Frequently Asked Questions about instructor

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

FAQPage Schema
How do I get structured JSON output from LLM responses and prevent malformed parsing errors?

To get structured JSON output and prevent malformed parsing errors, map LLM responses into strongly typed Pydantic models. This enforces schema validation so downstream code can trust the shape and types of the extracted data.

What happens when LLM data extraction returns missing or invalid fields that fail Pydantic validation?

When LLM data extraction returns missing or invalid fields that fail Pydantic validation, the system automatically feeds the validation error back to the model and retries extraction until the output passes schema constraints.

Can I use structured output workflows across both OpenAI and Anthropic LLM providers?

Yes, you can use structured output workflows across OpenAI and Anthropic LLM providers. The tool supports consistent multi-provider data extraction, including JSON and tool-oriented modes for reliable structured parsing.

How do I stream partial structured data objects incrementally during LLM generation?

To stream partial structured data objects incrementally during LLM generation, use the streaming feature. This provides partial structured results for faster feedback loops during data extraction or generation tasks.

Do I need Pydantic models to extract structured data from text prompts?

Yes, you need Pydantic response models to extract structured data from text prompts. Defining strongly typed response models is required to enforce schema validation and automatically retry until extraction passes.

What is the best way to parse multiple entities from LLM responses with consistent fields and constraints?

The best way to parse multiple entities from LLM responses with consistent fields and constraints is using schema-driven extraction with Pydantic validation. This ensures reliable multi-entity parsing across different LLM providers.