An AI-powered conversational assistant that helps users learn finance concepts interactively.
It is built with:
- FastAPI → Backend for handling chat streaming and tools
- LangGraph / LangChain → Orchestrating conversations and tool calls
- Streamlit → Frontend chat interface with conversation history
- (Optional) MongoDB → Storing conversation history and progress notes
FinCorp's retail clients often find complex financial concepts confusing.
This assistant aims to simplify investment concepts for beginners by providing structured explanations, examples, actionable steps, and related topics, enabling users to learn, track progress, and apply knowledge effectively.
- Real-time streaming chat responses using Server-Sent Events (SSE)
- Support for conversation memory (checkpoint-based threads)
- Integrated tools:
save_progress_tool→ save personal finance learning notesexport_notes_tool→ export saved notes as JSON
- Frontend built in Streamlit with:
- Chat UI (like ChatGPT)
- Sidebar with conversation history
- “Start New Conversation” button
The system is divided into two main parts:
-
Backend (FastAPI)
/chat_stream/{message}endpoint streams AI responses- Tools for saving/exporting notes
- Conversation state handled via LangGraph checkpoints
-
Frontend (Streamlit)
- User chat interface
- Displays conversation history
- Interacts with backend via SSE
git clone https://github.com/your-username/finlearn-bot.git
cd finlearn-botcd backend
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
pip install -r requirements.txtRun the backend:
uvicorn app.main:app --reloadAPI available at:
http://127.0.0.1:8000
Interactive docs:
http://127.0.0.1:8000/docs
cd frontend/streamlit
pip install -r requirements.txt
streamlit run app.pyApp runs at:
http://localhost:8501
GET /chat_stream/{message}
Streams responses from the AI assistant.
Query Parameters:
message→ User input (string)checkpoint_id→ Continue an existing conversation
Response (SSE Events):
data: {"type": "checkpoint", "checkpoint_id": "abc123"}
data: {"type": "content", "content": "Hello"}
data: {"type": "content", "content": " world!"}
data: {"type": "end"}- Saves learning notes under a topic.
- Example Query: User: "Save notes under Investing: Dollar-cost averaging is a strategy to reduce risk." Bot: "✅ Your notes for Investing have been saved."
- Exports all saved notes in JSON format.
- Example Query: User: "Export my notes." Bot: "📤 Here are your saved notes: { ... }"
-
Learn finance concepts User: "What is SIP?" Bot:
Concept: SIP (Systematic Investment Plan) is a method of investing a fixed amount regularly in mutual funds. Example: Investing ₹5000 every month in a fund. Action Steps: Choose a mutual fund, set up auto-debit, monitor monthly. Related Topics: Mutual Funds, Compounding, Investment Strategy -
Save notes User: "Save notes under Budgeting: Always track your expenses." Bot: "✅ Your notes for Budgeting have been saved."
-
Export notes User: "Can you export my notes?" Bot: "📤 Here are your saved notes: { ... }"
-
Contextual learning User: "Explain dollar-cost averaging again." Bot continues the explanation considering previous context.
This project integrates with LangSmith to monitor:
- Tool usage
- LLM calls
- Streaming events
-
Persisting conversations in MongoDB for real chat history
-
Adding authentication per user
-
Personalized learning:
- Recommend next concepts based on saved notes or progress
- Adaptive explanations based on user’s familiarity
- Topic tagging for easier retrieval
-
More advanced financial analysis tools
-
Richer UI with graphs/charts in Streamlit
Daniyal Khan







