instructor

Extract validated structured data from language models with retries and streaming.

2|1|Updated May 10, 2026
One-click install
npx skills add https://github.com/zli5460/hermes-agent-X-Phoenix-Architecture --skill instructor-zli5460
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: instructor
Source: https://github.com/zli5460/hermes-agent-X-Phoenix-Architecture/tree/main/optional-skills/mlops/instructor
Command: npx skills add https://github.com/zli5460/hermes-agent-X-Phoenix-Architecture --skill instructor-zli5460

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

Extracts structured data from LLM responses accurately and reliably, ensuring type safety and validation.

Core Features & Use Cases

  • Structured Data Extraction: Obtain validated data in predefined formats from LLM outputs.
  • Automatic Validation & Retry: Reattempt extraction upon failure, providing error feedback for high accuracy.
  • Streaming Results: Stream partial outputs for real-time processing and interactive workflows.
  • Use Case: Automate the extraction of contact details from emails while ensuring data correctness and handling invalid cases gracefully.

Quick Start

Use the instructor skill to extract user information from a sample text, validating and retrying if necessary.

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 reliably?

Structured data extraction from LLM responses is handled using pydantic validation to ensure type safety and output correctness. It automatically validates extracted JSON formats and retries failed attempts using error feedback for high accuracy.

What is the best way to parse complex JSON from LLM outputs with validation?

Parsing complex JSON from LLM outputs is managed by defining pydantic models for validation. The system ensures output correctness by validating the extracted data against your schema and reattempting extraction upon validation failure.

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

Streaming partial structured data outputs is supported for real-time processing and interactive workflows. This allows applications to consume validated data incrementally as the language model generates the response.

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

Structured data extraction works with both OpenAI and Anthropic APIs, requiring these dependencies alongside pydantic to function effectively. It integrates with various LLM APIs to automate validated data extraction.

How do I handle LLM data extraction failures and invalid JSON gracefully?

Handling LLM data extraction failures is achieved through automatic validation and retry mechanisms. Upon encountering invalid JSON or validation errors, it provides error feedback to the LLM and reattempts extraction to ensure data correctness.