{
 "schema_version": 1,
 "generated": "2026-10-31",
 "id": "567-labs-instructor--extract-structured-data-from-text-with-instructor",
 "repo": "567-labs/instructor",
 "repo_url": "https://github.com/567-labs/instructor",
 "repo_slug": "567-labs-instructor",
 "title": "Turn free text into a validated Pydantic object",
 "page_title": "How to turn free text into a validated Pydantic object with Instructor",
 "summary": "Define a model like User with name and age and let Instructor fill it from natural language.",
 "who": "A backend developer parsing names, dates or amounts out of messages.",
 "problem": "Hand-written JSON schemas and parsing code break often.",
 "outcome": "A typed, validated object instead of a raw string.",
 "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"
 ],
 "agent_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.",
 "agents": [
  "claude-code",
  "codex",
  "cursor",
  "gemini-cli"
 ],
 "difficulty": "Beginner",
 "time": "15 minutes",
 "basis": "readme",
 "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.",
 "category": "Software and DevOps",
 "tags": [
  "Software and DevOps"
 ],
 "lang": "python",
 "requirements": [
  "Python with pip, uv or poetry",
  "An API key for your provider, or a local Ollama install",
  "Basic Pydantic knowledge"
 ],
 "risk": "none",
 "seen_in_the_wild": false,
 "mentioned_publicly": false,
 "risks": [
  {
   "tag": "cost",
   "notice": "Each extraction is a paid LLM call unless you use a local model."
  }
 ],
 "best": true,
 "score": 1.0,
 "evidence": [],
 "url": "https://dedupedai.com/use-cases/567-labs-instructor/extract-structured-data-from-text-with-instructor/",
 "md": "https://dedupedai.com/use-cases/567-labs-instructor/extract-structured-data-from-text-with-instructor/index.md",
 "disclaimer": "Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked \"Seen in the wild\", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email hello@dedupedai.com and we will look at it promptly.",
 "api": "https://dedupedai.com/api/v1/usecases/567-labs-instructor--extract-structured-data-from-text-with-instructor.json",
 "api_version": "v1"
}
