Who it is forA developer or finance ops engineer who receives a steady stream of invoice PDFs and needs the amounts, dates, and vendor names as clean data.
The problemWriting a parser, chunker, and LLM prompt for every invoice layout takes time and breaks on new formats.
The outcomeA dict of extracted Invoice fields, checked against a Pydantic schema, with per-field confidence and any validation errors.
What you need first
- 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
Steps
- Run
pip install py-idpto 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.pyto see extracted fields from the mock backend. - Run
export OPENAI_API_KEY=...with your own key. - Run
idp run invoice.pdf --schema Invoice --backend openaito extract the fields with a hosted model.
Prompt for your agent
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.
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.
Use this in your AI agent
Ask your agent
Using the Deduped MCP, get the setup steps for rollroyces/py-idp and "Extract invoice fields into a validated schema"
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