instructor

Extract validated structured data from LLM responses using Pydantic schemas.

Updated Apr 10, 2026
One-click install
npx skills add https://github.com/KarlinskyS/hermesSkills --skill instructor-karlinskys
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: instructor
Source: https://github.com/KarlinskyS/hermesSkills/tree/main/mlops/inference/instructor
Command: npx skills add https://github.com/KarlinskyS/hermesSkills --skill instructor-karlinskys

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Many applications need reliable, typed data from LLM responses, but raw outputs are often unstructured, ambiguous, or invalid, leading to downstream errors and extra parsing work.

Core Features & Use Cases

  • Pydantic Validation: Automatically validates LLM output against defined schemas, ensuring type safety.
  • Automatic Retries: On validation failure the library prompts the model to correct the output.
  • Streaming Results: Receive partial objects or iterables as the model generates content.
  • Multi‑Provider Support: Works with Anthropic, OpenAI, and local Ollama models. Use this Skill to extract user profiles, classify documents, or generate structured reports directly from LLMs with minimal code.

Quick Start

Ask Instructor to extract a user's name, age, and email from a sentence using 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 data from LLM responses using Pydantic?

You can extract structured data from LLMs by defining Pydantic schemas to validate outputs automatically. This Skill applies the schema to the response, ensuring type safety for data extraction and classification tasks while prompting the model to correct any validation failures.

Why does LLM output validation fail and how can I fix it?

LLM output validation fails when responses do not match your defined Pydantic schema or type constraints. This Skill fixes it using automatic retries, prompting the model to correct the output upon validation failure to ensure accurate structured data extraction.

Does this structured data extraction tool work with local Ollama models?

Yes, this structured data extraction tool works with local Ollama models, as well as Anthropic and OpenAI. It applies Pydantic validation and automatic retries across all supported providers to ensure type safety.

Can I stream partial structured objects while the LLM is still generating?

Yes, you can stream partial structured objects or iterables as the model generates content. This allows you to receive real-time results during data extraction instead of waiting for the entire LLM response to finish.

What is the best way to classify documents using LLM outputs?

The best way to classify documents using LLMs is to enforce Pydantic schema validation on the output. This approach guarantees the model returns type-safe, structured categories, automatically retrying if the initial classification fails validation.