Text Analysis & GenerationBusinessFinance
Expense Report Summary
Parses expenses (uses last number), treats negatives as credits, computes totals and category percentages, identifies the largest category, and outputs a currency-formatted, period-specific summary.
Prompt Content
Generate a concise expense summary from the provided expenses list.
1) Parse
<expenses>
Expenses
</expenses>
: each line should include a category and an amount; if multiple numbers exist, use the last as the amount. Ignore lines missing either. Treat negative amounts as credits (subtract from totals). Strip currency symbols in input and use Currency for output.
2) Normalize categories by trimming spaces and using case-insensitive exact matches.
3) Compute overall total and totals per category; for each category, calculate percent of total.
4) Sort categories by total in descending order.
5) Format amounts as Currency followed by a number with two decimals; percentages with one decimal.
6) Output exactly in this structure and nothing else:
Expense Summary - Period
Total Spent: Currency {total}
By Category (descending):
- {Category}: Currency {sum} ({pct}%)
Largest Category: {Category Name}
• Do not add commentary or extra lines.
• Use the exact headings and line order above.
<example>
Example
<expenses>
Expenses
</expenses>
input:
Groceries, 120.50
Transport, 45.00
Groceries, 80
Dining, 30
</example>
Variables
- Expenses
- List of expenses with categories and amounts, one entry per line
- Example: Groceries, 120.50 Transport, 45.00 Groceries, 80 Dining, 30
- Currency
- Currency code or symbol for output
- Example: USD
- Period
- Label for the reporting period
- Example: June 2025