Skip to content

๐Ÿง  System Architecture โ€‹

This assistant is built on top of n8n, using LangChain, Mistral Cloud, and Google Sheets to enable a natural-language-based finance tracker.

๐Ÿ“ Components โ€‹

ComponentPurpose
Chat TriggerReceives user messages
LangChain AgentParses intent and picks a tool
Mistral CloudPowers the LLM responses
Google SheetsStores all persistent expense data
Calculator ToolComputes totals and averages
Chat MemoryStores short-term chat history

๐Ÿ”„ Workflow Diagram โ€‹

๐Ÿง  AI Prompt Strategy โ€‹

The AI is instructed with a strict system prompt that:

  • Describes the exact schema (Date, Details, Category, Amount)
  • Lists accepted categories
  • Forces confirmation before entry
  • Bans hallucinated or assumed data
  • Uses Calculator only for math

โš™๏ธ Tool Descriptions โ€‹

Each tool node has a toolDescription configured like:

  • Add Expense: Append a row to sheet after confirmation
  • Get Expense By Category: Return rows matching a category
  • Get All Expense: Return all rows
  • Calculator: Only used when asked to compute totals/averages