567-labs

instructor: Get Structured LLM Outputs with Pydantic

Instructor is a Python library built on Pydantic that turns LLM responses into validated, typed data. It provides a consistent schema-first interface across model providers, with retries and streaming for extraction workflows.

Stars
14.1k
Forks
1.4k
Stars, last 30 days
+75
Last commit
1 day ago
Contributors
100+

Our take

Activeregular commits and releases

Health score

70/100

How it is scored
Activity
76
Community
74
Issues
58
Pull requests
70

+75 stars in the last 30 days

  • More contributors than 78% of the projects we track

Instructor is a focused, actively maintained choice for Python teams that want Pydantic-validated LLM outputs without building provider-specific parsing and retry logic themselves.

Good fit if

  • Your Python application already uses Pydantic models and needs structured LLM responses.
  • You want one extraction interface across supported providers, plus validation retries or streaming.
  • You value an active project with regular commits and releases and a broad contributor base.

Look elsewhere if

  • You need an agent runtime with built-in observability and shareable traces, which the README directs users to seek in PydanticAI.
  • Your application does not run on Python 3.10 or newer.
  • Your needs are limited to a provider's own structured-output API and you do not need Instructor's validation and cross-provider interface.
All health signals
Last commit2026-11-18 (1 day ago)
Commits, last 90 days100+
Releases, last 12 months12 (latest v1.17.0, 2026-09-09)
Contributors100+ (top contributor: 60% of commits)
Issues closed, last 90 days8+ (typically closed in 4 days)
Pull requests merged, last 90 days32 (typically merged in 0 days)
Project age3 years

Checked on 2026-11-20 with the GitHub API.

Project history

Daily GitHub snapshots since Oct 7, 2026. History covers stars and forks; health signals are not tracked historically.

Selected snapshot

Stars

14,136

Forks

1,408

Change since Nov 23, 2026: +1 stars·+5 forks

Overview

Instructor is a Python library built on Pydantic for getting reliable, structured outputs from large language models. Instead of writing provider-specific schemas and handling parsing and validation yourself, you define a Pydantic model and use it as the response type. Instructor supports multiple LLM providers through a shared interface.

It is aimed at schema-first extraction and similar workflows, not at providing a full agent runtime. The project also points users to PydanticAI when they need richer agent runs, observability, or trace-sharing features.

Key Features

  • Define output schemas as Pydantic models for validation, type safety, and IDE support.
  • Use a shared client interface with supported model providers, including OpenAI, Anthropic, Google, and Ollama.
  • Retry requests when output fails validation, passing validation errors back to the model.
  • Stream partial typed objects as a response is generated.
  • Extract nested data structures using nested Pydantic models.
  • Use the same general API for simple extraction and more complex structured responses.

Use Cases

  • Extract names, dates, or other typed fields from unstructured text, for application developers building data-entry pipelines.
  • Turn product descriptions or documents into validated records when downstream code expects a stable schema.
  • Stream partially extracted results to an interface that can show progress before the full response is ready.
  • Apply custom validation and retries when an LLM response must meet application-specific field constraints.

What you need

Detected in the repository

  • Python <4.0,>=3.10 (from pyproject.toml)
  • A test suite and automated checks on GitHub Actions

License in plain words

MITpermissive

  • Commercial use: yes
  • Modify and redistribute: yes
  • You must keep: the copyright and license notice
  • Share your changes: no

A summary, not legal advice: the LICENSE file is what applies.

Getting Started

Install the Python package:

pip install instructor

See the README and documentation for provider setup and usage details.

Alternatives

  • jsonformer: Jsonformer constrains Hugging Face models to supported JSON schemas, while Instructor validates typed outputs across providers and supports retries and streaming.
  • simpleaichat: simpleaichat is a lightweight chat API that also supports structured data, while Instructor focuses on schema-first extraction and validation across providers.
ProjectLanguageLicenseStarsStatus
instructorPythonMIT14.1kActive
jsonformerJupyter NotebookMIT4.9kInactive
simpleaichatPythonMIT3.5kInactive

Considerations

Instructor standardizes the interface, but requests still depend on the selected model provider and its API. Pydantic validation checks whether output matches the declared schema; teams should still assess whether the extracted values are semantically correct for their use case. The project targets Python 3.10 and newer and does not present itself as a complete agent runtime.

Found this useful?

Share it with someone who would like instructor.

Comparisons