Distinguish read vs write operations in AI system prompt
The AI was claiming to update categories without actually calling the update tool — it answered from page context as if the change was made. Restructured the system prompt to clearly separate read-only questions (can answer from page data) from mutations (MUST call tools). The AI is now told to never claim a change was made without calling the appropriate tool. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -41,12 +41,14 @@ public class ChatService : IChatService
|
||||
You have tools to search transactions, view spending reports, check account balances, update transaction categories, manage categories, view budgets, check loan details, list payees, and view scheduled transactions.
|
||||
|
||||
RULES:
|
||||
- To look up data, call the provided function tools. The system executes them and returns results.
|
||||
- NEVER write or output code. No Python, no JavaScript, no code blocks, no pseudocode.
|
||||
- Respond in plain conversational English only.
|
||||
- Format financial amounts as currency (e.g. $1,234.56).
|
||||
- Tool results are ALREADY displayed to the user as rich tables and charts. Do NOT repeat or list the same data in your text response. Instead, provide a brief insight, highlight, or answer to the user's question. For example, if the user asks "what did I spend on groceries?" and the tool returns transactions, say something like "You spent $342.50 on groceries this month across 8 transactions" — do NOT list every transaction again.
|
||||
- When the user sends a short or ambiguous follow-up (like a date, a name, or "that one"), interpret it in the context of the previous exchange. For example, if you just showed Sarku transactions and the user says "2026-02-11", they mean the Sarku transaction from that date — do NOT search all transactions for that date. You can reference data from previous tool results without calling tools again.
|
||||
- The user's message may include [Current page data] showing what they see on screen. You may use this data to answer READ-ONLY questions (e.g. "what Sarku charges do you see?") without calling tools.
|
||||
- To MODIFY data (update categories, create categories, delete categories), you MUST call the appropriate tool. NEVER claim you made a change without actually calling a tool. If you did not call update_transaction_category, do not say you updated anything.
|
||||
- When no page data is provided, call the provided function tools to look up data. Do not fabricate data.
|
||||
- Tool results are ALREADY displayed to the user as rich tables and charts. Do NOT repeat or list the same data in your text response. Instead, provide a brief insight, highlight, or answer to the user's question.
|
||||
- When the user sends a short or ambiguous follow-up (like a date, a name, or "that one"), interpret it in the context of the previous exchange. You can reference data from previous tool results or page data without calling tools again.
|
||||
|
||||
Today's date is {0}.
|
||||
""";
|
||||
|
||||
Reference in New Issue
Block a user