Instructor is a library that makes LLMs return structured, validated data by using Pydantic models as output schemas. It eliminates the unreliability of parsing free-text LLM outputs by leveraging function calling, tool use, or JSON mode to get typed Python objects directly.
Key use cases include:
Instructor is used by developers who need reliable structured outputs from LLMs in production. Created by Jason Liu, it has become the standard for structured extraction, supporting OpenAI, Anthropic, Google, Mistral, and more.
Available in Python, TypeScript (with Zod schemas), Ruby, Go, and Elixir.
pip install instructorimport instructor
from openai import OpenAI
from pydantic import BaseModel
client = instructor.from_openai(OpenAI())
class User(BaseModel):
name: str
age: int
email: str
user = client.chat.completions.create(
model='gpt-4o',
messages=[{'role': 'user', 'content': 'John is 30, email john@example.com'}],
response_model=User
)
print(user) # User(name='John', age=30, email='john@example.com')Pricing: Instructor is free and open source (MIT). You pay only for the LLM API calls. The library adds minimal overhead to API costs.
Be the first to share a Instructor case study and get discovered by clients.
Submit a case studyThought leaders
Follow for insights, tutorials, and thought leadership
Submit a brief and we'll match you with vetted specialists who have proven Instructor experience.