instructor

Extract structured data from LLM outputs with Pydantic validation and retries.

6|2|Updated Mar 19, 2026
One-click install
npx skills add https://github.com/GregsGreyCode/Logos --skill instructor-gregsgreycode
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: instructor
Source: https://github.com/GregsGreyCode/Logos/tree/main/skills/mlops/inference/instructor
Command: npx skills add https://github.com/GregsGreyCode/Logos --skill instructor-gregsgreycode

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Automates reliable extraction and validation of structured data from LLM responses using Pydantic schemas, reducing errors and post-processing toil.

Core Features & Use Cases

  • Pydantic-based validation of LLM outputs
  • Automatic retries on validation failures
  • Streaming partial results for real-time processing
  • Multi-provider support (Anthropic, OpenAI, local models)
  • Complex data modeling with nested schemas for diverse domains

Quick Start

Prompt Instructor to extract a User model (name, age, email) from text and validate it with a Pydantic schema.

Frequently Asked Questions about instructor

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

FAQPage Schema
How do I get structured data from LLM outputs with Pydantic validation?

You can extract structured data from LLM outputs by defining Pydantic schemas and prompting the model to generate responses that match those schemas, enabling reliable validation and automatic retries on validation failures.

Does structured output extraction work with Anthropic and local models?

Yes, structured output extraction supports multi-provider compatibility across OpenAI, Anthropic, and local models through dedicated provider modules, allowing you to maintain consistent validation workflows across different environments.

What is the best way to handle LLM validation errors automatically?

The best way to handle LLM validation errors automatically is to use a structured extraction approach that implements automatic retries, re-prompting the model when Pydantic schema validation fails to ensure correct data output.

Can I stream partial LLM results for real-time structured data processing?

Yes, you can stream partial LLM results for real-time structured data processing. This feature allows you to process incremental updates as they are generated, rather than waiting for the entire response to complete.

When do I need Pydantic validation for LLM responses?

You need Pydantic validation for LLM responses when your application requires reliable data extraction, complex nested data modeling, or strict schema adherence to reduce post-processing errors and manual data correction toil.