instructor

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

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Extract structured data from LLM responses with automatic validation, retry on errors, and streaming of partial results using Pydantic-based schemas.

Core Features & Use Cases

  • Automatic validation of LLM outputs against Pydantic models.
  • Automatic retry on validation errors with error feedback to the LLM.
  • Streaming partial results for real-time processing, supporting multi-provider workflows.

Quick Start

Run Instructor with a sample LLM response and a defined Pydantic model to demonstrate extraction, validation, and streaming of results.

Frequently Asked Questions about instructor

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

FAQPage Schema
How do I validate structured LLM outputs against a Pydantic schema?

To validate structured LLM outputs, define a Pydantic model and apply it to the LLM response. The system automatically validates the extracted data against your schema, enforcing strict structure and data types.

What happens when an LLM response fails Pydantic validation?

When an LLM response fails Pydantic validation, the system automatically retries the request. It sends the validation error feedback back to the LLM, prompting it to correct the output and match the required schema.

Can I stream partial structured data from LLM responses in real-time?

Yes, you can stream partial structured data from LLM responses in real-time. The system supports streaming partial results, allowing you to process nested models incrementally as the LLM generates the output.

Does this structured data extraction tool work with both OpenAI and Anthropic models?

Yes, this structured data extraction tool works with both OpenAI and Anthropic models. It provides a unified API to apply Pydantic-based validation and automatic retry mechanisms across multiple LLM providers.

How do I extract nested JSON models from LLM responses with error resilience?

You extract nested JSON models from LLM responses by defining nested Pydantic models for validation. This approach handles complex validation flows and ensures error resilience through automatic retries on failure.