instructor

Extract and validate structured data from LLM responses using Pydantic.

2|Updated May 22, 2026
One-click install
npx skills add https://github.com/519lab/thoth-agent --skill instructor-519lab
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: instructor
Source: https://github.com/519lab/thoth-agent/tree/main/optional-skills/mlops/instructor
Command: npx skills add https://github.com/519lab/thoth-agent --skill instructor-519lab

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires instructor, pydantic, openai, anthropic, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill tackles the challenge of extracting and structuring data from LLM responses, ensuring accuracy and efficiency in data handling.

Core Features & Use Cases

  • Structured Data Extraction: Extracts structured data from LLM responses with Pydantic validation.
  • Retry Mechanism: Automatically retries failed extractions.
  • JSON Parsing: Parses complex JSON with type safety.
  • Streaming Results: Streams partial results for real-time processing.
  • Multi-Provider Support: Works with various LLM providers like OpenAI and Anthropic.
  • Use Case: Ideal for data scientists and engineers who need to validate and structure data from LLM outputs in applications like data analysis, machine learning, and AI development.

Quick Start

Use the instructor skill to validate and extract structured user data 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?

Extract structured data from LLM responses by using Pydantic validation to automatically parse and type-check the output. This ensures accuracy and efficiency in data handling for analysis and machine learning workflows.

Can I use Pydantic to validate JSON parsed from OpenAI outputs?

Yes, you can validate JSON parsed from OpenAI outputs using Pydantic. The process automatically parses complex JSON with type safety and includes a retry mechanism for failed extractions.

Does structured data extraction work with both OpenAI and Anthropic models?

Structured data extraction works with multiple LLM providers, including OpenAI and Anthropic. This multi-provider support allows you to validate and structure outputs consistently across different models.

What is the best way to handle real-time streaming of partial LLM extraction results?

The best way to handle real-time streaming of partial LLM extraction results is to process partial outputs as they are generated. This enables real-time data processing during the extraction and validation workflow.

Why does my LLM data extraction fail when parsing complex JSON?

LLM data extraction fails when parsing complex JSON due to type mismatches or malformed structures. An automated retry mechanism handles these failed extractions by re-prompting the LLM to generate valid data.