instructor

Enforce structured LLM outputs with Pydantic schema validation and automatic retries.

1|Updated Jul 31, 2026
One-click install
npx skills add https://github.com/icyzh/hermes-web --skill instructor-icyzh
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: instructor
Source: https://github.com/icyzh/hermes-web/tree/main/optional-skills/mlops/instructor
Command: npx skills add https://github.com/icyzh/hermes-web --skill instructor-icyzh

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This skill solves the challenge of unreliable, unstructured LLM responses by enforcing strict schema validation and automatic retries, ensuring your AI outputs are always ready for programmatic use.

Core Features & Use Cases

  • Structured Data Extraction: Convert raw text into validated Pydantic models with type safety.
  • Automatic Validation & Retries: Automatically catch validation errors and prompt the LLM to correct its output.
  • Streaming Support: Process partial results in real-time for responsive user interfaces.
  • Use Case: Use this to extract user profiles, sentiment analysis, or complex entity relationships from unstructured text into clean, typed Python objects.

Quick Start

Use the instructor skill to extract user data from the provided text into a Pydantic model by defining your schema and calling the client.

Frequently Asked Questions about instructor

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

FAQPage Schema
How do I get structured LLM outputs with Pydantic validation?

Structured LLM outputs with Pydantic validation are enforced by integrating schemas into the LLM call, automatically catching validation errors and prompting the model to correct its output. This ensures responses are ready for programmatic use.

Why does my LLM data extraction return unstructured or invalid data?

LLM data extraction returns invalid data when responses lack strict schema enforcement. By applying Pydantic validation with automatic retry logic, the system catches validation errors and prompts the LLM to correct its output automatically.

Can I use OpenAI and Anthropic models for structured data extraction?

OpenAI and Anthropic models are supported for structured data extraction. The system integrates Pydantic schemas across multiple LLM providers to enforce type-safe data extraction, classification, and complex entity parsing.

What is the best way to convert raw text into typed Python objects using an LLM?

Converting raw text into typed Python objects is best handled by enforcing Pydantic schemas during LLM generation. This approach provides type safety for extracting user profiles, sentiment analysis, or complex entity relationships from unstructured text.

Do I need Pydantic to enforce type-safe responses in production AI pipelines?

Pydantic is required to enforce type-safe responses in production AI pipelines. It provides the schema validation needed to automatically catch errors and prompt the LLM for corrections, satisfying production-ready requirements.

Does structured output generation support streaming partial results?

Structured output generation supports streaming partial results in real time. This allows you to process incomplete validated data dynamically, enabling responsive user interfaces while maintaining Pydantic schema enforcement.