cost. Each extraction is a paid LLM call unless you use a local model.
Who it is forA backend developer parsing names, dates or amounts out of messages.
The problemHand-written JSON schemas and parsing code break often.
The outcomeA typed, validated object instead of a raw string.
What you need first
- Python with pip, uv or poetry
- An API key for your provider, or a local Ollama install
- Basic Pydantic knowledge
Steps
- 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
Prompt for your agent
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.
Caveat. This card is written from the 567-labs/instructor README, not from a test run by Deduped. Before you start, make sure you have Python with pip, uv or poetry. Check the repo for newer instructions before you rely on these steps.
Use this in your AI agent
Ask your agent
Using the Deduped MCP, get the setup steps for 567-labs/instructor and "Turn free text into a validated Pydantic object"
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 freeShare: X LinkedIn Hacker News Email Copy link
Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer