Skip to content
← Tools / Skills
Tool567 Labs (Jason Liu)/10 trustVerified
Instructor logo

Instructor

Structured outputs for LLMs — Pydantic-validated extraction in Python, TS, Go, Ruby

Visit official site →

About

Instructor is the standard Python library for structured LLM outputs: you define a Pydantic model describing exactly the data you want, and Instructor coerces any LLM's response into a validated, typed object. Built around the unified instructor.from_provider() interface, the same code works across OpenAI, Anthropic, Google, Mistral, Cohere, Ollama, DeepSeek, xAI, Cerebras, Fireworks, and more providers, with automatic retries when validation fails, streaming of partial responses, and full IDE type inference. It is a local client-side library (your API keys stay in your environment), so it adds no network or telemetry surface of its own. The project was formerly jxnl/instructor and moved to the 567-labs org (Jason Liu's company); the old repo path still redirects.

What it can do

  • • Typed structured outputs: any Pydantic model becomes the response schema
  • • Unified `from_provider()` API across OpenAI, Anthropic, Google, Mistral, Cohere, Ollama, DeepSeek, xAI, Cerebras, Fireworks and more
  • • Automatic retries with validation feedback when the model returns invalid data
  • • Streaming support for partial responses and lists; sync and async clients
  • • Open-source model support via Ollama, llama-cpp-python, and vLLM
  • • Multi-language ecosystem: Python, TypeScript, Go, and Ruby variants

Setup

  1. Install: pip install instructor (or uv add instructor / poetry add instructor). For a specific provider SDK, use an extra, e.g. pip install "instructor[xai]".
  2. Export your provider API key, e.g. export OPENAI_API_KEY=... (or the key your provider expects).
  3. Define a Pydantic model for the data you want, e.g. class Person(BaseModel): name: str; age: int.
  4. Build a client: client = instructor.from_provider("openai/gpt-5-nano") (swap the provider string for others, e.g. "anthropic/claude-3", "ollama/llama3.2"; pass async_client=True for async).
  5. Extract: person = client.create(response_model=Person, messages=[{"role": "user", "content": "Extract: John is a 30-year-old software engineer"}]) — returns a validated Person instance.

Prerequisites

Python (3.10+ for some provider extras); a Pydantic v2 install (pulled in as a dependency); an API key for the LLM provider you use, or a local model via Ollama/llama-cpp-python/vLLM.

Use cases

datacode

Works with

Generic APIAny agent (.md)

Trust score — 9/10

/10 trustVerified

Scored 9/10 (verified tier, metrics-v1). Evidence: 14,007 GitHub stars (log-scaled vs catalog peers); blended with ~8,516,567 monthly package downloads; last push 2d ago; 14 releases/12mo; 166 open issues. Manual review: repo renamed jxnl/instructor→567-labs/instructor (redirect verified); '15+ providers' not enumerated. License: MIT.

★ 14,007 GitHub stars

How the trust score is built

Full methodology →
Adoption · stars/downloads, log-scaled vs peers
8.4/10
Maintenance · recency, releases, issue load
9.5/10
Openness · license + docs
10.0/10
Manual review · sanity read + red-flag check
9.0/10
  • · 14,007 GitHub stars (log-scaled vs catalog peers)
  • · blended with ~8,516,567 monthly package downloads
  • · last push 2d ago; 14 releases/12mo; 166 open issues
  • · manual review: repo renamed jxnl/instructor→567-labs/instructor (redirect verified); '15+ providers' not enumerated

Sources

Every fact above was checked against these sources. Where a claim comes from the provider and couldn't be independently verified, the text says so.