instructor

Extract and validate structured data from LLM responses using Pydantic schemas.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Extract, validate, and stream structured data from LLM responses using Pydantic schemas, ensuring reliable, type-safe outputs with automatic retries on validation failures.

Core Features & Use Cases

  • Robust data extraction from LLM outputs with automatic validation
  • Automatic retry on validation errors to improve reliability
  • Streaming partial results for real-time processing
  • Multi-provider support (OpenAI, Anthropic, Ollama) for flexible deployments

Quick Start

Extract a validated User model from an LLM reply and stream the result in real time

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 using Pydantic schemas?

You can validate structured LLM outputs by defining a Pydantic schema and passing it to the extraction function. The system automatically validates the LLM response against your schema to ensure type-safe data extraction.

How do I handle LLM validation errors when extracting structured data?

To handle LLM validation errors, the system applies automatic retries on validation failures. When the LLM response does not match your Pydantic schema, it automatically retries the request to improve reliability.

Can I stream partial structured data results from an LLM in real time?

Yes, you can stream partial structured data results for real-time processing. The system supports streaming partial results as they are generated by the LLM, allowing immediate downstream data consumption.

Does this structured data extraction approach work with Anthropic and Ollama?

Yes, structured data extraction works with Anthropic and Ollama. The system features multi-provider support, including OpenAI, Anthropic, and Ollama, ensuring flexible deployments across different LLM platforms.

What is the best way to extract type-safe data from LLM responses?

The best way to extract type-safe data is using Pydantic schemas to validate LLM responses. This approach combines automatic validation with retry mechanisms to ensure robust, reliable data pipelines without manual parsing.

Why should I use Pydantic for structured LLM outputs instead of manual parsing?

Using Pydantic for structured LLM outputs ensures type safety and automatic validation, overcoming the fragility of manual parsing. It provides automatic retries on failures and native streaming support for robust data extraction.