Structured Outputs by Example Star on GitHub
Stay updated when new content is added and get tips from the Instructor team

A hands-on guide to structured data extraction from LLMs using Instructor and Pydantic.

Start with the first example or browse below. Use arrow keys to navigate.

Requires Python >=3.9 and latest versions of Instructor and Pydantic.

Getting Started

Introduction to structured outputs with Instructor and setting up your environment

LLM Providers

Using Instructor with different LLM providers

Basic Extraction Patterns

Common patterns for extracting structured data

Multimodal Inputs

Working with images, audio, and documents

Classification and Analysis

Using structured outputs for classification tasks

Streaming

Working with streaming responses

Advanced Structures

Building complex structured outputs

Validation

Ensuring data quality with validation

Performance and Optimization

Optimizing performance for production use

Miscellaneous Examples

Additional examples that don't fit into other categories