instructor

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

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

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 getting consistent, validated, and structured data from LLM responses, eliminating the need for fragile manual JSON parsing and error-prone regex.

Core Features & Use Cases

  • Pydantic Validation: Automatically enforces data schemas and type safety on LLM outputs.
  • Automatic Retries: Handles extraction failures by feeding validation errors back to the model for self-correction.
  • Streaming Support: Enables real-time processing of partial results for responsive user interfaces.
  • Use Case: Extracting structured user profiles, sentiment analysis, or multi-entity data from unstructured text while ensuring every field meets specific business constraints.

Quick Start

Use the instructor skill to extract user information from the provided text into a Pydantic model with automatic validation and retries.

Frequently Asked Questions about instructor

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

FAQPage Schema
How do I extract structured JSON data from LLM responses using Pydantic?

You can extract structured JSON data from LLM responses by defining a Pydantic schema, which automatically enforces type safety and validates the extracted output against your specified business constraints.

What is the best way to handle LLM output validation errors automatically?

The best way to handle LLM output validation errors is using automatic retry loops, which feed validation failures directly back to the model for self-correction without requiring manual intervention or fragile regex parsing.

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

Yes, this structured data extraction approach works with both OpenAI and Anthropic models, supporting complex data extraction, classification, and multi-entity parsing across multiple LLM providers.

How do I extract multiple entities from unstructured text while enforcing data schemas?

To extract multiple entities from unstructured text, you define a Pydantic schema that maps the desired fields, letting the validation engine ensure every extracted entity meets your specific business constraints.

Can I process partial LLM extraction results in real time for responsive interfaces?

Yes, you can process partial LLM extraction results in real time using built-in streaming support, enabling responsive user interfaces to render structured data incrementally as the model generates output.

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

You should use Pydantic schemas instead of manual JSON parsing to eliminate fragile regex patterns, ensure consistent type-safe data extraction, and automatically enforce strict validation rules on LLM responses.