instructor

Extract structured data from LLM responses using Pydantic models with automatic retries.

11.5k|842|Updated Nov 3, 2025
One-click install
npx skills add https://github.com/Orchestra-Research/AI-Research-SKILLs --skill instructor-orchestra-research
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: instructor
Source: https://github.com/Orchestra-Research/AI-Research-SKILLs/tree/main/16-prompt-engineering/instructor
Command: npx skills add https://github.com/Orchestra-Research/AI-Research-SKILLs --skill instructor-orchestra-research

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 solves the challenge of reliably extracting structured data from Large Language Model (LLM) responses, ensuring type safety and automatic validation.

Core Features & Use Cases

  • Structured Data Extraction: Extract data into Pydantic models with type safety.
  • Automatic Validation: Pydantic schemas automatically validate LLM outputs.
  • Automatic Retries: Handles validation errors by retrying LLM calls with feedback.
  • Streaming: Supports streaming partial results for real-time processing.
  • Use Case: Extracting user profiles (name, age, email) from unstructured text, ensuring the age is a valid integer and the email is correctly formatted, with automatic retries if the LLM initially fails to provide valid data.

Quick Start

Use the instructor skill to extract user data with name, age, and email from the provided text.

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 Pydantic validation?

To extract structured data from LLM responses with Pydantic validation, you define a Pydantic model representing your desired schema, and the Skill automatically parses and validates the LLM output against it, ensuring type safety for fields like integers and formatted emails.

What happens when an LLM outputs invalid data that fails Pydantic validation?

When LLM output fails Pydantic validation, the Skill handles validation errors by automatically retrying the LLM call with feedback, prompting the model to correct its output and match the required structured schema.

Can I use this Skill to get structured output from both OpenAI and Anthropic models?

Yes, you can get structured output from both OpenAI and Anthropic models, as the Skill integrates with various LLM providers to reliably extract structured data using Pydantic schemas across different platforms.

Does this Skill support streaming partial structured results during LLM generation?

Yes, the Skill supports streaming partial structured results, enabling real-time processing and validation of Pydantic models as the LLM generates the response, rather than waiting for the entire output to complete.

What is the best way to extract user profiles like name, age, and email from unstructured text?

The best way to extract user profiles like name, age, and email from unstructured text is using Pydantic models for structured data extraction, which automatically validates that age is an integer and email is correctly formatted.