What do you want to do?
3 use cases
-
Turn free text into a validated Pydantic object
Define a model like User with name and age and let Instructor fill it from natural language.
View prompt
Using 567-labs/instructor, install `pip install instructor`, define a Pydantic model for <the fields I need>, and write a function that extracts it from a list of support emails with client.chat.completions.create and response_model.
-
Run the same extraction on OpenAI, Anthropic or local Ollama
Swap providers by changing one string in from_provider while the rest of the code stays the same.
View prompt
With 567-labs/instructor, write a script that runs one extraction on instructor.from_provider("openai/gpt-4o") and instructor.from_provider("ollama/llama3.2") over <my 20 samples>, and reports where they disagree. -
Retry automatically when the LLM output fails validation
Add Pydantic field validators and let Instructor resend the error to the model until the data is valid.
View prompt
Using 567-labs/instructor, add Pydantic field_validator rules for <my business rules> to my model and show how Instructor's automatic retries handle an input that fails them the first time.
Quick start with Instructor
- Check you have what it needs: Python with pip, uv or poetry; An API key for your provider, or a local Ollama install; Basic Pydantic knowledge.
- Open 567-labs/instructor on GitHub and read the README and license.
- Install with
pip install instructor - Define a Pydantic BaseModel with the fields you want
- Create a client with Instructor.from_provider("openai/gpt-4o-mini")
- Call client.chat.completions.create with response_model set to your model and print the result
These steps come from our top use case, Turn free text into a validated Pydantic object, which also has a copy-paste agent prompt.
Use this in your AI agent
Ask your agent
Using the Deduped MCP, get the setup steps for 567-labs/instructor
Add Deduped to Claude Code once
claude mcp add --transport http deduped https://dedupedai.com/mcp
Every Monday: the 5 hottest repos and exactly how to use them. Free, one email a week, unsubscribe anytime.
Get them freeAbout this repo
- Who it is forPython developers who need typed data, not free text, from an LLM call.
- Why it is hot14k stars, talked about in 2 AI sources we track
- LanguagePython
- Sourcegithub.com/567-labs/instructor ยท Back to Hot repos
Requirements
- Python with pip, uv or poetry
- An API key for your provider, or a local Ollama install
- Basic Pydantic knowledge
Add this badge to your README
Maintain Instructor? Show readers where to find these use cases.
Markdown
[](https://dedupedai.com/use-cases/567-labs-instructor/?utm_source=github&utm_medium=badge&utm_campaign=567-labs-instructor)
HTML
<a href="https://dedupedai.com/use-cases/567-labs-instructor/?utm_source=github&utm_medium=badge&utm_campaign=567-labs-instructor"><img src="https://dedupedai.com/badge/567-labs/instructor.svg" alt="Use cases on Deduped" height="20"></a>
A static image, no tracking script. About the badge
Questions about Instructor
What is Instructor?
Instructor gets reliable structured JSON out of LLMs. You define a Pydantic model, call `instructor.from_provider` with any major provider such as OpenAI, Anthropic, Google, Groq or local Ollama, and get back a validated, typed object, with automatic retries when validation fails. It is an open-source project on GitHub: https://github.com/567-labs/instructor.
How do I use Instructor?
Install with pip install instructor; then Define a Pydantic BaseModel with the fields you want; create a client with Instructor.from_provider("openai/gpt-4o-mini"). The use cases on this page give the full steps and a copy-paste agent prompt for each job.
Who is Instructor for?
Python developers who need typed data, not free text, from an LLM call.
What can I do with Instructor?
3 use cases so far, for example: Turn free text into a validated Pydantic object; Run the same extraction on OpenAI, Anthropic or local Ollama; Retry automatically when the LLM output fails validation. Each has steps and a copy-paste agent prompt.
What do I need to run Instructor?
Python with pip, uv or poetry; An API key for your provider, or a local Ollama install; Basic Pydantic knowledge.
What are alternatives to Instructor?
Other hot AI repos in Software and DevOps: Deep Infer, Thinkrail, ECC, Aider, LM Evaluation Harness.
Is Instructor safe to run?
Deduped does not own, audit or vouch for it. Read the README and license, run it on your own systems first and review every command before you run it.