567-labs

567-labs/instructor

Python MIT AI & ML

structured outputs for llms

13.5k stars
1.1k forks
active
GitHub +105 / week

13.5k

Stars

1.1k

Forks

52

Open issues

30

Contributors

v1.15.4 28 Jun 2026

AI Analysis

Instructor is a Python library that simplifies extracting structured data from LLMs by using Pydantic models for validation and schema definition. It works across multiple LLM providers (OpenAI, Anthropic, etc.) and handles JSON parsing, validation, and retry logic automatically. Best suited for developers building LLM applications that need reliable structured outputs—not a general-purpose tool but a specialized solution for LLM integration workflows.

AI & ML Library Discovery value: 4/10
Documentation 8/10
Activity 9/10
Community 9/10
Code quality 7/10

Inferred from signals mentioned in the README (tests, CI, type safety) — not a review of the actual code.

Overall score 8/10

AI's overall editorial judgment — not an average of the bars above, can weigh other factors too.

llm-structured-output pydantic-validation provider-agnostic json-extraction type-safety
Actively maintained Well documented MIT licensed Popular Beginner friendly Production ready
Deep Analysis · Based on README and public signals
2w ago

Instructor brings Pydantic-validated structured outputs to any LLM provider with a single unified API

Instructor wraps LLM provider clients to return validated, typed Python objects instead of raw JSON strings. It handles schema generation, validation errors, automatic retries with error feedback to the model, and streaming partial objects — all via a Pydantic-first interface. Built for Python developers integrating LLMs into production applications, it abstracts provider differences (OpenAI, Anthropic, Google, Ollama, Groq, and more) behind one consistent call pattern. With 3M+ claimed monthly downloads and 13K+ stars, it has genuine adoption among the AI engineering community building extraction pipelines, structured RAG, and data transformation workflows.

Origin

Created in June 2023 by Jason Liu (jxnlco) at the onset of widespread LLM adoption. Originally tightly coupled to OpenAI's function-calling API, it evolved to support multi-provider structured outputs as the ecosystem matured and as native JSON modes proliferated.

Growth

Growth was driven by a clear, painful problem: LLM outputs are unreliable strings, but applications need structured data. Instructor arrived early, built a strong community through its author's active Twitter/X presence and documentation, and benefited from the broader explosion of LLM-powered application development in 2023-2025. Stars have plateaued relative to early growth as the structured-output space became more crowded with native provider features.

In production

README claims 3M+ monthly downloads on PyPI, 100,000+ developers, and usage at teams from OpenAI, Google, Microsoft, AWS, and YC startups. These figures are self-reported and not independently verified here, but PyPI download badge is linked and the scale of the Discord community and fork count provide partial corroboration. The 1,000+ claimed contributors and 13K stars across 3 years of sustained activity are consistent with genuine production adoption at meaningful scale.

Code analysis
Architecture

Appears to use a thin wrapper/proxy pattern around existing provider SDK clients, intercepting the completions call to inject Pydantic schema as the response format and post-process the response into validated model instances. Likely uses Pydantic's JSON schema generation and model_validate internally. The from_provider() unified entry point suggests an adapter layer per provider. Streaming support via Partial[T] likely uses incremental JSON parsing.

Tests

Not documented in README

Maintenance

Last push was June 23, 2026 — four days before evaluation date — indicating active, ongoing maintenance. With 1,091 forks and a Discord community, the project shows healthy contributor engagement. The README references current providers and models (gpt-4o-mini, claude-3-5-sonnet, gemini-pro), suggesting documentation is kept current. No signs of stagnation.

Honest verdict

ADOPT IF: you are building Python applications that extract structured data from LLMs across multiple providers and want Pydantic validation, retries, and streaming without writing boilerplate. AVOID IF: you need guaranteed schema compliance without retry overhead (prefer constrained decoding tools like Outlines), or you are working in non-Python environments. MONITOR IF: your primary provider (e.g., OpenAI) expands native structured output support enough to eliminate the need for a wrapper layer, which could erode Instructor's value proposition over time.

Independent dimensions

Mainstream potential

7/10

Technical importance

7/10

Adoption evidence

7/10

Risks
  • Provider-side native structured output improvements (OpenAI's response_format, Anthropic's tool_use schemas) may reduce the need for a wrapper library, shrinking Instructor's addressable problem.
  • Retry-based validation is probabilistic — complex schemas or weak models may exhaust retries without convergence, which is a fundamental limitation of the approach versus constrained decoding.
  • The project's public identity has been closely tied to its original author (jxnlco); a change in maintainership could affect momentum, though the 567-labs org transfer suggests some institutionalization.
  • Self-reported adoption metrics (3M downloads, 100K developers) cannot be independently verified from available metadata; actual production penetration may differ from claimed figures.
  • As the LLM ecosystem consolidates around a few dominant SDK patterns, a thin wrapper library must continuously track API changes across all supported providers, creating ongoing maintenance burden.
Prediction

Instructor is likely to remain a widely-used utility library in the Python LLM ecosystem for the next 2-3 years, gradually ceding ground on simple single-provider use cases to native features while retaining value for multi-provider and complex validation workflows.

0 found this helpful

Newsletter

Get analyses like this every Monday

Free weekly digest of the most interesting open-source discoveries.

Languages

Python
99.9%
Shell
0.1%

Information

Language
Python
License
MIT
Last updated
4d ago
Created
37mo ago
Analyzed with
anthropic/claude-haiku-4-5

Stars over time

Loading…

Contributors over time

Top 100 contributors only — repos with more will plateau at 100.

Loading…

Similar repos

dottxt-ai

dottxt-ai/outlines

Outlines is a Python library that constrains LLM outputs to structured formats...

14.4k Python AI & ML
vllm-project

vllm-project/guidellm

GuideLLM is an SLO-aware benchmarking and evaluation platform designed to...

1.4k Python AI & ML
mlabonne

mlabonne/llm-course

A structured, free course for learning Large Language Models, divided into...

80.8k AI & ML
allenai

allenai/open-instruct

Open Instruct is AllenAI's post-training codebase for instruction-tuning and...

3.8k Python AI & ML
explosion

explosion/spacy-llm

spacy-llm integrates large language models into spaCy's NLP pipeline framework,...

1.4k Python AI & ML
vs. alternatives
dottxt-ai/outlines

Outlines operates at the inference level, constraining token generation via finite-state machines to guarantee schema compliance without retries. Instructor works at the API call level, relying on model capability and retries. Outlines requires access to model weights (local/self-hosted); Instructor works with any API-based provider. Different deployment contexts, partially overlapping problem space.

PydanticAI

The README itself recommends PydanticAI for agent workflows with observability and tooling. Instructor positions itself as the simpler, cheaper choice for schema-first extraction tasks. PydanticAI extends the same Pydantic foundation but adds agent runtime, typed tools, evals, and dashboards. The two are complementary rather than directly competitive.

simonw/llm

llm is a CLI-first tool and Python library focused on prompt execution and model access. It doesn't offer Pydantic-validated structured output extraction as a core feature. Different primary audience: llm targets exploratory/scripting use cases; Instructor targets production extraction pipelines.

OpenAI/Anthropic native structured outputs

Major providers now offer native JSON mode and structured output features that overlap with Instructor's core value. Instructor's advantage is the unified multi-provider API, Pydantic integration, retry logic, and streaming partials — features not consistently available across providers natively.

rllm-org/rllm

rllm appears focused on RL-based LLM training and fine-tuning workflows rather than inference-time structured output extraction. Overlap is minimal; they address different points in the LLM development lifecycle.