Skip to content
ai-supply.store
DiscoverCategoriesLeaderboardsCommunityAgent APIFAQ
PublishSign in
catalog / Agentic capability / Instructor
⛨GuardrailAgentic capabilityFree

Instructor

Structured outputs for LLMs using Pydantic — patches any OpenAI-compatible client to return validated Python objects.

@ai-supply
Installs61k
Rating★ 4.7
Reviews20
Install (free) to download the source.↗ Source repository

Instructor

Instructor is the simplest way to get structured, validated outputs from LLMs. It patches openai, anthropic, google-generativeai, and other clients with a single .from_* call, then uses Pydantic models to define the output schema and automatically validates (and retries on failure).

Key Features

  • Pydantic-native — define your output as any Pydantic model; Instructor handles schema generation and parsing
  • Multi-provider — OpenAI, Anthropic, Google Gemini, Ollama, Cohere, Mistral, and more
  • Auto-retry — on validation failure, Instructor feeds the error back to the LLM and retries automatically
  • Streaming — stream partial Pydantic objects as they are generated
  • Hooks — before/after hooks for logging, caching, and metrics
  • Zero prompt engineering — no need to write JSON-formatting instructions in your prompts

Quick Start

pip install instructor
import instructor
from openai import OpenAI
from pydantic import BaseModel

client = instructor.from_openai(OpenAI())

class User(BaseModel):
    name: str
    age: int

user = client.chat.completions.create(
    model="gpt-4o-mini",
    response_model=User,
    messages=[{"role": "user", "content": "Extract: John is 30 years old."}],
)
print(user)  # User(name='John', age=30)

Install via ai-supply

npx ai-supply add instructor-structured-outputs

Curated mirror of the open-source Instructor project (MIT). Install upstream from the repository.

More from @ai-supply

View profile →
◆Skill
OpenCV Python
The world's most popular computer vision library with Python bindings — image processing, video, and ML pipelines.
↓ 500k★ 4.9
◐Model
timm (PyTorch Image Models)
The largest collection of pretrained image models for PyTorch — ViT, ConvNeXt, EfficientNet, Swin, and 900+ more.
↓ 490k★ 4.9
⌬Workflow
Apache Airflow
Apache-2.0 workflow orchestration platform — define, schedule, and monitor data and AI pipelines as Python DAGs.
↓ 395k★ 4.7
◐Model
Segment Anything Model (SAM)
Meta AI's promptable image segmentation model that can segment any object from a single click or bounding box.
↓ 320k★ 4.9
ai-supply.store

The marketplace for AI capabilities. Skills, MCPs, plugins, agents, datasets — discoverable by humans, consumable by machines.

api · v3.1status · all green
Marketplace
  • Discover
  • Categories
  • Leaderboards
  • Benchmarks
Community
  • Community
  • FAQ
For agents
  • Quickstart (60s)
  • Authorize an agent
  • Agent API
  • OpenAPI spec
For builders
  • Publish
  • Dashboard
  • Revenue share
Account
  • Sign in
  • Settings
Legal
  • Terms
  • Publisher Agreement
  • Acceptable Use
  • Privacy