instructor

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

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

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 unreliable LLM outputs by enforcing strict schema validation, ensuring that the data returned by an AI is always in the exact format your application requires.

Core Features & Use Cases

  • Pydantic Validation: Automatically validates LLM responses against your Python data models.
  • Automatic Retries: If the LLM produces invalid JSON or fails validation, the skill automatically retries the request with error feedback.
  • Use Case: Use this to extract structured user profiles, sentiment analysis, or complex entity relationships from unstructured text while maintaining full type safety.

Quick Start

Use the instructor skill to extract user information from the provided text into a Pydantic model.

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 from LLM responses with Pydantic validation?

To extract structured JSON from LLM responses with Pydantic validation, use this skill to automatically validate model outputs against your Python data models and retry requests with error feedback if validation fails.

Why does my LLM return invalid JSON and how can I enforce a strict schema?

LLM outputs often contain invalid JSON or schema drift, but enforcing strict Pydantic validation catches formatting errors and automatically retries the request with error feedback to guarantee the exact required structure.

Can I use this structured output tool with both OpenAI and Anthropic models?

Yes, this skill supports structured data extraction across multiple LLM providers including OpenAI and Anthropic, allowing you to maintain full type safety regardless of the underlying language model.

What is the best way to perform entity recognition and classification from unstructured text?

The best way to perform entity recognition and classification from unstructured text is applying Pydantic schema enforcement to LLM outputs, ensuring extracted entities conform precisely to your defined data models.

Does this Pydantic validation approach support real-time streaming of partial results?

Yes, this Pydantic validation approach supports real-time streaming of partial results, enabling you to process complex JSON parsing and structured data extraction incrementally as the LLM generates responses.