An intelligent chatbot assistant for "Bank of Gotham" that helps customers manage their accounts, check balances, view transactions, and get answers to banking policy questions.
Gordon is an AI-powered banking assistant built with cutting-edge technologies to provide a seamless customer experience. The chatbot leverages large language models (LLMs) and retrieval-augmented generation (RAG) to intelligently respond to customer inquiries about their accounts and banking policies.
- Account Management: Check balances, view transaction history, and manage multiple accounts
- Intelligent Q&A: Ask questions about banking policies, fees, interest rates, and more
- RAG-Enhanced Responses: Uses document retrieval to provide accurate policy information
- Mock Data: Includes realistic customer, account, and transaction data for testing and demonstration
- User Authentication: Simple customer ID-based authentication for account access
- Python 3.13: Primary programming language
- Streamlit: Web framework for creating the interactive user interface
- Ollama: Local LLM inference engine (uses Llama 3.2 model)
- LlamaIndex: Framework for building RAG (Retrieval-Augmented Generation) pipelines
- ChromaDB: Vector database for storing and retrieving document embeddings
- HuggingFace Transformers: Sentence embeddings via
sentence-transformers/all-MiniLM-L6-v2
- Faker: Generates mock customer, account, and transaction data
- JSON: Data persistence for mock data files
βββββββββββββββ
β Streamlit β (Web UI)
β (app) β
ββββββββ¬βββββββ
β
βΌ
βββββββββββββββββββββββ
β Chatbot Module β (chatbot.py)
β βββββββββββββββββ β
β β RAG Engine β β
β β (LlamaIndex) β β
β βββββββββββββββββ β
ββββββββ¬βββββββββββββββ
β
βββββββββββββββββββββββ
β β
βΌ βΌ
ββββββββββ ββββββββββββ
β Ollama β β ChromaDB β
β(Llama) β β(Embedds) β
ββββββββββ ββββββββββββ
β
βΌ
ββββββββββββββββ
β Mock Data β
β (JSON) β
ββββββββββββββββ
bankBot/
βββ app.py # Streamlit web application
βββ chatbot.py # Core chatbot logic and RAG implementation
βββ generate_data.py # Script to generate mock data
βββ README.md # Project documentation
βββ mockData/ # Mock database files
β βββ customers.json # Customer profiles
β βββ accounts.json # Bank accounts
β βββ transactions.json # Transaction history
βββ chroma_db/ # ChromaDB vector store
β βββ [vector embeddings]
βββ docs/ # Documentation and policy files
βββ faq.md # Banking FAQs
βββ feeInfo.md # Fee information
βββ savingsAccountPolicy.md # Savings policy
βββ embed.py # Script to embed documents
- Python 3.13+
- Ollama installed and running locally with Llama 3.2 model
- pip (Python package manager)
-
Clone or navigate to the project directory:
cd bankBot -
Create a virtual environment (optional but recommended):
python3 -m venv venv source venv/bin/activate -
Install dependencies:
pip install streamlit ollama llama-index llama-index-vector-stores-chroma llama-index-embeddings-huggingface llama-index-llms-ollama chromadb faker
-
Ensure Ollama is running:
# In a separate terminal, start Ollama with Llama 3.2 ollama run llama3.2
-
Generate mock data (first time only):
python generate_data.py
This creates:
mockData/customers.json- 10 sample customersmockData/accounts.json- 20 sample accountsmockData/transactions.json- 150 sample transactions Adjust n1, n2, and n3 variables to tune customer, account, and transaction amounts.
-
Embed policy documents (first time only):
python docs/embed.py
This processes the policy documents and stores embeddings in ChromaDB for RAG queries.
Start the Streamlit application:
streamlit run app.pyThe app will open in your default web browser at http://localhost:8501
- Authenticate: Enter a customer ID (0-9) in the sidebar.
- Select an Account: A list of accounts connected to that customer will appear under Your Accounts in the sidebar.
- Click an account to select it.
- The selected account is highlighted (primary button) and marked with a check (β).
- Ask Questions in the chat input. All account-specific questions (e.g., balance/transactions) are answered for the currently selected account.
- Examples: "What is the balance of this account?" or "Show my recent transactions."
You: What's my account balance?
Gordon: Your Savings account with Account ID 17 has a current balance of $59,279.26. How can I assist you further today?
You: What are the overdraft fees?
Gordon: According to our policy, overdraft fees are $35 per occurrence.
We also offer overdraft protection...
You: Show me my 3 most recent transactions
Gordon: Here are your 3 most recent transactions:
- 05/16/2026: Amazon - $45.99
- 05/15/2026: Starbucks - $6.50
- 05/14/2026: Costco - $120.30
Edit chatbot.py to modify:
- LLM Model: Change
MODEL = "llama3.2"to use a different Ollama model - RAG Keywords: Update
RAG_KEYWORDSto control which queries trigger document retrieval - Embedding Model: Modify the HuggingFace embedding model in
Settings.embed_model - Similarity K: Adjust
similarity_top_k=3for more/fewer retrieved documents
- Add new markdown files to the
docs/folder - Run
python docs/embed.pyto re-embed documents - Update
RAG_KEYWORDSif new topics need to trigger RAG
Contains customer profiles with:
- Name, address, email, phone
- Date of birth, customer ID
Contains bank accounts with:
- Account type (Checking/Savings)
- Opened date, current balance
- Associated customer ID
Contains transaction history with:
- Transaction type (deposit, withdrawal, transfer, payment, refund)
- Amount, date, account ID
- Merchant information
- The sidebar drives the banking context: users authenticate with a customer ID, then choose one of their connected accounts.
- The chatbot keeps a system prompt that is rewritten on each user message to include the latest
cust_idand selectedaccount_id. - When the model calls tools, the backend injects
cust_idautomatically and defaults missingaccount_idto the currently selected account.
- New Account Operations: Add functions to
chatbot.pyfollowing the pattern ofget_balance()andget_recent_transactions() - New Chat Features: Extend the prompt engineering in
app.pyto guide the LLM's responses - Policy Documents: Add
.mdfiles todocs/folder and re-run embedding script
- The query engine uses lazy initialization to avoid contacting Ollama at import time
- RAG is only triggered for relevant queries using keyword matching
- Vector store queries are limited to top 3 most similar documents