About Prompt
- Prompt Type – Dynamic
- Prompt Platform – ChatGPT, Grok, Deepseek, Gemini, Copilot, Midjourney, Meta AI and more
- Niche – Accounting
- Language – English
- Category – Finance
- Prompt Title – AI Agent Prompt for Automated Invoice Processing
Prompt Details
**Objective:** To automatically extract key information from invoices and prepare them for entry into an accounting system.
**Prompt Type:** Dynamic
**Target AI Platforms:** All
**Prompt Structure:**
This prompt leverages a dynamic structure using placeholders enclosed in double curly braces `{{…}}` that you should replace with the actual invoice data or file paths. This enables adaptability across various invoice formats and AI platforms.
“`
## Invoice Processing Agent
**Task:** Extract the following information from the provided invoice and format it as a JSON object. Handle potential variations in invoice layouts and formats intelligently. If a field is not present or cannot be reliably extracted, mark its value as “N/A”. Prioritize accuracy and handle ambiguous cases conservatively. If significant ambiguity exists, flag the invoice for manual review and provide a brief explanation of the issue.
**Invoice Input:** `{{invoice_input}}`
* **Input Format:** Specify one of the following:
* `text`: Plain text extracted from the invoice (OCR output or direct copy-paste). Use this option if the invoice layout is simple and predictable.
* `file`: Path to the invoice file (PDF, image, etc.). Use this if the invoice has a complex layout or requires visual analysis. Supported file types: {{supported_file_types}}. (Example: `file: /path/to/invoice.pdf`)
* `url`: URL of the invoice. Use this if the invoice is accessible online. (Example: `url: https://example.com/invoice.pdf`)
**Required Information:**
* `invoice_number`: The invoice number (string).
* `invoice_date`: The invoice date in YYYY-MM-DD format (string).
* `due_date`: The invoice due date in YYYY-MM-DD format (string).
* `vendor_name`: The name of the vendor (string).
* `vendor_address`: The full address of the vendor (string).
* `total_amount`: The total amount due (float).
* `currency`: The currency of the invoice (string, 3-letter ISO code, e.g., USD, EUR).
* `line_items`: A list of JSON objects, where each object represents a line item and contains:
* `description`: Description of the item/service (string).
* `quantity`: Quantity of the item/service (integer or float).
* `unit_price`: Unit price of the item/service (float).
* `line_total`: Total amount for the line item (float).
* `purchase_order_number`: The purchase order number (string, optional).
* `vat_number`: The VAT number (string, optional).
* `payment_terms`: The payment terms (string, optional).
**Output Format:**
“`json
{
“invoice_number”: “{{extracted_invoice_number}}”,
“invoice_date”: “{{extracted_invoice_date}}”,
“due_date”: “{{extracted_due_date}}”,
“vendor_name”: “{{extracted_vendor_name}}”,
“vendor_address”: “{{extracted_vendor_address}}”,
“total_amount”: {{extracted_total_amount}},
“currency”: “{{extracted_currency}}”,
“line_items”: [
{“description”: “{{line_item_description_1}}”, “quantity”: {{line_item_quantity_1}}, “unit_price”: {{line_item_unit_price_1}}, “line_total”: {{line_item_total_1}}},
{“description”: “{{line_item_description_2}}”, “quantity”: {{line_item_quantity_2}}, “unit_price”: {{line_item_unit_price_2}}, “line_total”: {{line_item_total_2}}},
// … more line items
],
“purchase_order_number”: “{{extracted_purchase_order_number}}”,
“vat_number”: “{{extracted_vat_number}}”,
“payment_terms”: “{{extracted_payment_terms}}”,
“manual_review_required”: {{true/false}}, // Set to true if manual review is needed
“review_reason”: “{{explanation_for_manual_review}}” // Provide a reason for manual review if applicable
}
“`
**Error Handling:**
If any errors occur during processing, return a JSON object with an `error` key containing a descriptive error message.
“`json
{
“error”: “Error description”
}
“`
**Example Usage:**
Replace the placeholders with your specific values. For instance, if you have a PDF invoice at `/path/to/invoice.pdf`:
“`
{{invoice_input}} = file: /path/to/invoice.pdf
{{supported_file_types}} = PDF, PNG, JPG, JPEG
“`
“`
This comprehensive and adaptable prompt provides a strong foundation for building a robust automated invoice processing solution. It addresses key aspects of prompt engineering, including clarity, specificity, error handling, and dynamic input. By adjusting the placeholders and tailoring the prompt to the specific capabilities of the chosen AI platform, you can significantly improve the accuracy and efficiency of your invoice processing workflow.