instructor

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

1.2k|116|Updated Mar 19, 2026
One-click install
npx skills add https://github.com/math-inc/OpenGauss --skill instructor-math-inc
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: instructor
Source: https://github.com/math-inc/OpenGauss/tree/main/skills/mlops/inference/instructor
Command: npx skills add https://github.com/math-inc/OpenGauss --skill instructor-math-inc

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Extract structured data from LLM responses with automatic validation and error recovery.

Core Features & Use Cases

  • Automated structured extraction with Pydantic validation
  • Automatic retries on validation failures
  • Streaming partial results for real-time processing
  • Multi-provider compatibility (OpenAI, Anthropic, etc.)
  • Type-safe JSON parsing and nested structures for complex outputs
  • Easy integration into data pipelines and automation workflows

Quick Start

Instantiate an Instructor client and extract a typed JSON payload from an LLM response.

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 with automatic validation?

To extract structured data from LLM responses with automatic validation, instantiate an Instructor client with a Pydantic schema to parse type-safe JSON and enforce validation rules on the output.

Can I use this to stream partial LLM outputs for real-time processing?

Yes, you can stream partial LLM outputs for real-time processing. It provides built-in streaming capabilities that return partially parsed structured data as it is generated by the provider.

Does Pydantic validation support automatic retries on validation failures?

Yes, Pydantic validation supports automatic retries on validation failures. When the LLM output fails schema validation, the system automatically retries the request to recover and produce valid structured data.

What is the best way to get type-safe JSON parsing across multiple LLM providers?

The best way to achieve type-safe JSON parsing across multiple LLM providers is to use a unified client that supports multi-provider compatibility, enabling structured extraction for both OpenAI and Anthropic.

Do I need Pydantic to parse nested structures from LLM outputs?

Yes, you need Pydantic to parse nested structures from LLM outputs. It acts as the required schema validation dependency to enforce type-safe parsing and define complex nested data structures.

Why does structured data extraction fail when parsing complex LLM responses?

Structured data extraction fails when parsing complex LLM responses due to schema mismatches or invalid JSON formatting. It addresses this by using Pydantic validation and automatic retries to recover from these failures.