instructor

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

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

The Instructor skill enables reliable extraction of structured data from LLM outputs by validating results with Pydantic schemas and automatically retrying on validation errors.

Core Features & Use Cases

  • Structured output validation: enforce type-safe results with Pydantic models.
  • Multi-provider support: work with OpenAI, Anthropic, and other providers.
  • Streaming and progressive results: receive partial objects in real-time and iterate results.
  • End-to-end pipelines: integrate into Python prompts and workflows to build data extraction systems.
  • Use Case: Build a data ingestion pipeline that extracts user profiles from chat replies and stores them in a database.

Quick Start

Install the Instructor library, define a Pydantic model, and validate a structured output from an LLM.

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?

You can extract structured data by validating LLM responses against Pydantic schemas and automatically retrying on validation failures, ensuring type-safe outputs for downstream data pipelines.

Can I stream partial structured outputs from an LLM in real-time?

Yes, you can stream partial structured objects in real-time. This progressive result delivery allows you to iterate over incomplete Pydantic models as the LLM generates the response.

Does structured output validation work with Anthropic and OpenAI models?

Structured output validation works across multiple providers including OpenAI and Anthropic. You can enforce type-safe Pydantic schemas and extract consistent data regardless of the underlying LLM.

What do I need to build a Python data extraction pipeline with LLMs?

To build a Python data extraction pipeline, you need the Instructor library and Pydantic. Define your Pydantic models to enforce schemas, and integrate them into Python prompts for end-to-end structured data workflows.

Why does my LLM response fail validation during data extraction?

LLM response validation fails when the output does not match your defined Pydantic schema. The Instructor skill handles this by automatically retrying the LLM prompt on validation errors until structured output passes.

What is the best way to enforce type-safe results from LLM responses?

The best way to enforce type-safe results is by applying Pydantic validation to LLM outputs. This guarantees extracted data conforms to defined schemas and automatically retries generation on validation failures.