instructor

Extract and validate structured LLM data with Pydantic schemas and streaming.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Automate extraction and validation of structured data from LLM responses and ensure it conforms to predefined schemas via Pydantic, with automatic retries on validation failures and real-time streaming of partial results.

Core Features & Use Cases

  • Structured data extraction from LLM outputs using Pydantic validation.
  • Automatic retries with contextual error feedback to improve extraction quality.
  • Streaming of partial results for real-time processing and UI progress.

Quick Start

Instantiate the client, define a Pydantic model, and extract a sample response from an LLM with automatic validation and streaming.

Frequently Asked Questions about instructor

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

FAQPage Schema
How do I validate structured outputs from an LLM using Pydantic?

To validate structured LLM outputs using Pydantic, define a Pydantic model representing your desired schema and pass it to the client. The system automatically extracts the data, validates it against your model, and retries with contextual error feedback if validation fails.

Can I stream partial LLM outputs for real-time processing?

Yes, you can stream partial LLM outputs for real-time processing. The system provides a streaming interface that delivers progressive outputs, allowing you to handle partial results and update UI elements continuously as the LLM generates the response.

What is the best way to extract structured data from LLM responses across multiple providers?

The best way to extract structured data across multiple LLM providers is to use a unified client that integrates with various APIs. This approach uses Pydantic schemas for validation and supports automatic retries, ensuring consistent structured data extraction regardless of the underlying provider.

Does Pydantic validation work with automatic retries for LLM extraction?

Yes, Pydantic validation works with automatic retries for LLM extraction. When the LLM response fails to conform to your predefined Pydantic schema, the system automatically retries the request, passing contextual error feedback back to the model to improve subsequent extraction quality.

Why do I need Pydantic schemas for structured LLM outputs?

You need Pydantic schemas for structured LLM outputs to ensure the extracted data conforms to a predefined format. This validation mechanism guarantees data integrity, prevents downstream parsing errors, and enables the automatic retry logic when the LLM response does not match the expected structure.