instructor

Extract LLM responses into validated Pydantic objects with automatic retries.

3|Updated Apr 4, 2026
One-click install
npx skills add https://github.com/twjarviszyra-web/hermes-unbound --skill instructor-twjarviszyra-web
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: instructor
Source: https://github.com/twjarviszyra-web/hermes-unbound/tree/main/optional-skills/mlops/instructor
Command: npx skills add https://github.com/twjarviszyra-web/hermes-unbound --skill instructor-twjarviszyra-web

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Instructor removes the friction of turning free-form LLM responses into reliable structured data by validating outputs against explicit schemas and automatically retrying when the model returns malformed or incomplete results.

Core Features & Use Cases

  • Schema-Guided Extraction: Convert text into Pydantic models for users, companies, reviews, events, and other structured records.
  • Automatic Validation and Retry: Catch invalid fields, enforce constraints, and give the model corrective feedback until the output matches the schema.
  • Streaming and Multi-Provider Support: Work with Anthropic, OpenAI, and local model backends while streaming partial objects or iterable results in real time.
  • Use Case: Use it to extract contacts from emails, classify documents, parse nested entities, or generate analysis objects that downstream Python code can trust.

Quick Start

Use the instructor skill to convert an LLM response into a validated Pydantic model for the data you want to extract.

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 into a Pydantic model?

Structured LLM output is extracted into validated Pydantic models by defining a schema and processing the response through instructor, which enforces type safety and reliable JSON parsing automatically.

Why does my LLM extraction fail when the response is missing required fields?

LLM extraction fails when responses lack required fields because the output is not validated. Instructor catches invalid fields, enforces schema constraints, and applies automatic retries with corrective feedback until the output matches.

Can I use Anthropic models for structured data extraction with Pydantic?

Anthropic models are fully supported for structured data extraction. Instructor provides multi-provider workflow support across Anthropic, OpenAI, and local model backends to enforce type safety and reliable JSON parsing.

How do I stream partial Pydantic model results from an LLM in real time?

Partial Pydantic model results are streamed in real time by configuring instructor for streaming. This allows you to process iterable results and nested entities progressively as the LLM generates the response.

What is the best way to extract entities from text using LLMs and Python?

The best way to extract entities from text is schema-guided extraction using Pydantic models. Instructor converts free-form LLM responses into validated Python objects for users, companies, reviews, and other structured records.

Do I need Pydantic schemas to classify documents with LLMs?

Pydantic schemas are required to classify documents and enforce constraints on LLM outputs. Instructor uses these explicit schemas to validate fields and generate analysis objects that downstream Python code can trust.