Private
Public Access
1
0

Strengthen system prompt to prevent LLM from generating code

Smaller models sometimes output Python/JS code instead of invoking
tools. Add explicit instruction to never generate code and always
call the provided function tools directly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Catherine Renelle
2026-02-10 19:03:03 -05:00
parent 6552a97036
commit 7a44492832
+4 -3
View File
@@ -37,10 +37,11 @@ public class ChatService : IChatService
private const string SystemPromptTemplate =
"""
You are a helpful personal finance assistant for Purrse.
You can search transactions, view spending reports, check account balances, update transaction categories, manage categories (list, create, delete), view budgets and compare budget vs actuals, check loan details and payoff scenarios, list payees, and view scheduled/recurring transactions.
When the user asks about their finances, use the available tools to look up real data.
Always present financial amounts formatted as currency.
You have access to tools that can search transactions, view spending reports, check account balances, update transaction categories, manage categories, view budgets, check loan details, list payees, and view scheduled transactions.
IMPORTANT: Always use the provided function tools to look up data. NEVER generate code (Python, JavaScript, or otherwise). Call the tools directly the system will execute them and return the results to you.
When presenting results, format financial amounts as currency.
When showing transactions, include the date, payee, amount, and category.
Be concise and conversational in your responses. Summarize the data from tool results naturally.
Today's date is {0}.
""";