instructor

Extracts structured JSON data from LLM outputs using Pydantic schema validation and automatic retries across OpenAI, Anthropic, and Ollama models.

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

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 inconsistent or malformed LLM outputs by enforcing strict schema validation and providing automatic retry mechanisms for failed extractions.

Core Features & Use Cases

  • Structured Data Extraction: Convert unstructured text into validated Pydantic models with type safety.
  • Automatic Validation & Retries: Automatically re-prompts the LLM when outputs fail schema validation, ensuring high-quality data.
  • Multi-Provider Support: Works consistently across OpenAI, Anthropic, and local models via Ollama.

Quick Start

Use the instructor skill to extract user contact information from the provided text into a structured JSON format using the User Pydantic model.

Frequently Asked Questions about instructor

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

FAQPage Schema
How do I get structured JSON output from an LLM using Pydantic validation?

You can get structured JSON output from an LLM by enforcing Pydantic schema validation on the responses, which automatically re-prompts the model to correct malformed data and ensures reliable parsing.

Why does my LLM data extraction fail schema validation and how can I fix it?

LLM data extraction often fails schema validation due to inconsistent or malformed outputs, but you can fix this by using automated retry mechanisms that re-prompt the model when outputs fail validation.

Can I use Pydantic structured output extraction with Anthropic and OpenAI models?

Yes, Pydantic structured output extraction works consistently across multiple AI providers, including Anthropic and OpenAI, as well as local models via Ollama, ensuring type-safe data pipelines.

What is the best way to parse complex JSON from LLM responses into type-safe models?

The best way to parse complex JSON from LLM responses is to integrate Pydantic schema validation with automated error-correction loops, converting unstructured text into validated, type-safe models.

Does structured LLM output support real-time streaming of validated Pydantic models?

Yes, structured LLM output supports real-time streaming of validated Pydantic model responses, facilitating reliable parsing and dynamic data pipeline updates as the model generates output.