Refactor: externalize OpenAI receipt parser prompt to text file
Move hardcoded prompt from OpenAIReceiptParser.cs to Prompts/ReceiptParserPrompt.txt for easier maintenance and editing without recompilation. Add caching to LoadPromptTemplateAsync for performance. Configure .csproj to copy Prompts folder to output directory. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
28
MoneyMap/Prompts/ReceiptParserPrompt.txt
Normal file
28
MoneyMap/Prompts/ReceiptParserPrompt.txt
Normal file
@@ -0,0 +1,28 @@
|
||||
Analyze this receipt image and extract the following information as JSON:
|
||||
{
|
||||
"merchant": "store name",
|
||||
"receiptDate": "YYYY-MM-DD" (or null if not found),
|
||||
"dueDate": "YYYY-MM-DD" (or null if not found - for bills only),
|
||||
"subtotal": 0.00 (or null if not found),
|
||||
"tax": 0.00 (or null if not found),
|
||||
"total": 0.00,
|
||||
"confidence": 0.95,
|
||||
"lineItems": [
|
||||
{
|
||||
"description": "item name",
|
||||
"quantity": 1.0 (or null),
|
||||
"unitPrice": 0.00 (or null),
|
||||
"lineTotal": 0.00
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Extract all line items you can see on the receipt. For each item:
|
||||
- description: The item or service name
|
||||
- quantity: Only include if this is an actual countable product (like groceries). For services, fees, charges, or taxes, set to null.
|
||||
- unitPrice: Price per unit if quantity applies, otherwise null
|
||||
- lineTotal: The total amount for this line (required)
|
||||
|
||||
For utility bills, service charges, fees, and taxes - these are NOT products with quantities, so set quantity and unitPrice to null.
|
||||
|
||||
If this is a bill (utility, credit card, etc.), look for a due date, payment due date, or deadline and extract it as dueDate. For regular receipts, dueDate should be null.
|
||||
Reference in New Issue
Block a user