instructor

Extract structured data from LLM responses using Pydantic schemas.

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

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 out of LLMs, preventing parsing errors and ensuring type safety in your AI-driven applications.

Core Features & Use Cases

  • Pydantic Validation: Automatically validates LLM outputs against your defined schemas.
  • Automatic Retries: Handles failed extractions by feeding validation errors back to the model for correction.
  • Streaming Support: Enables real-time processing of partial results for improved user experience.
  • Use Case: Use this to extract complex user profiles, sentiment analysis, or multi-entity data from unstructured text while ensuring every field meets your specific business logic requirements.

Quick Start

Use the instructor skill to extract user data from the provided text into a Pydantic model by calling the client with the response_model parameter.

Frequently Asked Questions about instructor

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

FAQPage Schema
How do I extract structured data from LLM responses and validate it?

You extract structured data from LLMs by using Pydantic schemas to define expected outputs and applying automatic validation loops to parse and enforce type safety on the generated text.

What is the best way to get consistent JSON output from OpenAI and Anthropic models?

The best way to get consistent JSON output from OpenAI and Anthropic models is to use structured data extraction with Pydantic validation, which automatically feeds parsing errors back to the LLM for correction via retries.

How do I handle Pydantic validation errors when parsing LLM outputs?

Handle Pydantic validation errors by enabling automatic retries, which feed the specific validation failures back to the LLM so the model can correct its output and satisfy the schema requirements.

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

Yes, you can stream structured data extraction results in real-time to process partial outputs incrementally, improving user experience while maintaining Pydantic schema validation for type safety.

Does instructor work with both OpenAI and Anthropic for structured data parsing?

Yes, structured data parsing works with both OpenAI and Anthropic, allowing you to extract complex multi-entity data and user profiles across diverse LLM providers using Pydantic schemas.