{
 "schema_version": 1,
 "generated": "2026-10-20",
 "id": "rollroyces-py-idp--extract-invoice-fields-to-pydantic",
 "repo": "rollroyces/py-idp",
 "repo_url": "https://github.com/rollroyces/py-idp",
 "repo_slug": "rollroyces-py-idp",
 "title": "Extract invoice fields into a validated schema",
 "page_title": "How to extract invoice fields into a validated schema with Py Idp",
 "summary": "Turn invoice PDFs into Pydantic-validated fields using one pipeline call or one CLI command.",
 "who": "A developer or finance ops engineer who receives a steady stream of invoice PDFs and needs the amounts, dates, and vendor names as clean data.",
 "problem": "Writing a parser, chunker, and LLM prompt for every invoice layout takes time and breaks on new formats.",
 "outcome": "A dict of extracted Invoice fields, checked against a Pydantic schema, with per-field confidence and any validation errors.",
 "steps": [
  "Run `pip install py-idp` to install the core package. No API key is needed for this step.",
  "Place invoice.pdf in the current directory and run `python examples/00_zero_to_extraction.py` to see extracted fields from the mock backend.",
  "Run `export OPENAI_API_KEY=...` with your own key.",
  "Run `idp run invoice.pdf --schema Invoice --backend openai` to extract the fields with a hosted model."
 ],
 "agent_prompt": "Using the py-idp repo, run the idp CLI on <path to invoice PDF> with --schema Invoice and --backend openai, then print the extracted fields. Verify that the output is a dict whose keys match the Invoice schema fields and that no validation errors are reported.",
 "agents": [
  "any"
 ],
 "difficulty": "Intermediate",
 "time": "30 minutes",
 "basis": "readme",
 "caveat": "The zero-config path uses the mock backend, so real extraction quality only shows after you switch to a hosted or local LLM backend.",
 "category": "Work and operations",
 "tags": [
  "Work and operations"
 ],
 "lang": "python",
 "requirements": [
  "Python with pip available",
  "An API key for a hosted LLM backend such as OpenAI, or a local backend such as Ollama (the zero-config path runs on the in-tree mock backend without a key)",
  "A sample PDF or text file to test with, such as invoice.pdf"
 ],
 "risk": "none",
 "seen_in_the_wild": false,
 "mentioned_publicly": false,
 "risks": [],
 "best": true,
 "score": 1.0,
 "evidence": [],
 "url": "https://dedupedai.com/use-cases/rollroyces-py-idp/extract-invoice-fields-to-pydantic/",
 "md": "https://dedupedai.com/use-cases/rollroyces-py-idp/extract-invoice-fields-to-pydantic/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/rollroyces-py-idp--extract-invoice-fields-to-pydantic.json",
 "api_version": "v1"
}
