pdf_classify
Detect PDF document types like invoices, reports, or contracts and extract candidate fields including invoice number, total, date, and vendor. Optionally refine results with a local LLM.
Instructions
Guess the document type (invoice, report, contract, ...) and extract candidate fields.
Return Format
A dict with keys:
success: bool
doc_type: str
confidence: float (0-1)
fields: dict of detected fields (invoice_number, total, date, vendor)
reasons: list of matched signals
llm_refined: bool - whether the local LLM confirmed the guess
Examples
await pdf_classify(path="invoice_42.pdf") {"success": true, "doc_type": "invoice", "confidence": 0.75, "fields": {"invoice_number": "INV-42", "total": "1,240.00"}, "reasons": ["invoice(x2)"]}
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Path to the PDF file. | |
| refine | No | Use the local LLM to refine the guess. Default true. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| message | No | Human-readable summary | |
| success | No | Whether the operation succeeded |