Skip to content

πŸ’° An intelligent financial advisor chatbot powered by LLaMA-3, built with LangGraph for structured reasoning, RAG from The Intelligent Investor PDF, and real-time data from Yahoo Finance and DuckDuckGo. The system dynamically orchestrates tools, handles fallbacks, and maintains conversation memory.

License

Notifications You must be signed in to change notification settings

Md-Emon-Hasan/TrueWealth-AI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ’Ό TrueWealth AI: Your AI-powered financial strategist

demo.mp4

Project Overview

TrueWealth AI is a end-to-end Multi-Agent Financial Advisor AI System that combines LangGraph-powered orchestration, advanced LLM reasoning (LLaMA-3 via Groq), and RAG with ChromaDB + HuggingFace embeddings to deliver professional, context-aware financial insights. The system features Planner, Retriever, Generator, News, Web Search, and Memory agents with intelligent tool routing, retry logic, and multi-source knowledge fusion for high accuracy and reliability. It supports PDF ingestion, financial news retrieval, and fallback web search to ensure comprehensive answers. Built with a modular architecture for scalability, it provides FastAPI APIs for testing, a Flask-based responsive UI (HTML, CSS, JS) for client interaction, and is fully Dockerized for portability. Deployed on Render with an integrated CI/CD pipeline, it reflects enterprise-level engineering practices, making it a industry-grade AI solution ready for real-world deployment.


πŸš€ Live Demo

🎯 Try the real-time TrueWealth AI:
πŸ‘‰ TrueWealth AI – Click Here


Real-World Use Cases

1. Personal Financial Advisory
  • Helps individual investors make informed decisions on stocks, bonds, and long-term investments.
2. Financial Education & Self-Learning
  • Acts as a tutor for users reading financial books (e.g., The Intelligent Investor).
3. Real-Time Market & News Analysis
  • Provides up-to-date financial news from Yahoo Finance.
4. Small Business Financial Consulting
  • Assists small business owners in budgeting, tax planning, and investment decisions.
5. Retirement & Wealth Management
  • Offers retirement planning insights (e.g., 401(k), Roth IRA strategies).

Features & Functionalities

βœ… Step 🧠 Feature βš™οΈ Tech Stack / Tool Used
1️⃣ 🧠 LLM-based Financial Query Understanding Groq + LLaMA-3
2️⃣ ✨ Professional Tone Personalization Prompt Engineering + Advisor Persona Templates
3️⃣ πŸ“š RAG-based Financial Answering LangChain + ChromaDB + Sentence Transformers (all-MiniLM-L6-v2)
4️⃣ πŸ” Financial Document Retriever Agent RetrieverAgent + Vector Store Search
5️⃣ 🧠 Answer Generator Agent GeneratorAgent (LLM-based factual + professional financial style)
6️⃣ πŸ“° Financial News Retrieval Agent YahooFinanceNewsTool
7️⃣ 🌐 Web Search Agent (Fallback) DuckDuckGo Search Tool
8️⃣ 🧠 Planner Agent LangGraph Planner Node
9️⃣ πŸ”„ Intelligent Tool Routing & Fallback Retry Logic + Conditional Branching + Multi-step Tool Selection
πŸ”Ÿ 🧠 Short-Term Conversational Memory LangGraph Memory Integration (Buffer-based)
1️⃣1️⃣ πŸ“‚ PDF Knowledge Ingestion PyPDFLoader + RecursiveCharacterTextSplitter
1️⃣2️⃣ πŸ“Š Vector Embedding & Storage HuggingFaceEmbeddings + ChromaDB
1️⃣3️⃣ βš™οΈ State-based Multi-Agent Orchestration LangGraph StateGraph + Conditional Edges + Dynamic State Updates
1️⃣4️⃣ πŸ—‚ Multi-source Knowledge Fusion LLM + RAG + Yahoo Finance + DuckDuckGo Combined Answer Synthesis
1️⃣5️⃣ πŸ§ͺ API Testing & Integration FastAPI (API endpoints for agent orchestration testing)
1️⃣6️⃣ πŸ—ƒ Modular Code Architecture Separation of Concerns + Service/Agent Modules
1️⃣7️⃣ πŸ’» Responsive Web UI Flask + HTML5, CSS3, JavaScript
1️⃣8️⃣ 🌐 Cloud Deployment Render (Production hosting)
1️⃣9️⃣ πŸ”„ CI/CD Pipeline GitHub Actions / CI/CD Workflows
2️⃣0️⃣ πŸ“¦ Containerization for Portability Docker (App + Dependencies + Environment)

Project Structure

TrueWealth AI/
   β”‚
   β”œβ”€β”€ .github/
   β”‚   └── workflows/
   β”‚       └── main.yml
   β”‚
   β”œβ”€β”€ agents/
   β”‚   β”œβ”€β”€ __init__.py
   β”‚   β”œβ”€β”€ duckduckgo.py
   β”‚   β”œβ”€β”€ executor.py
   β”‚   β”œβ”€β”€ generator.py
   β”‚   β”œβ”€β”€ llm.py
   β”‚   β”œβ”€β”€ memory_store.py
   β”‚   β”œβ”€β”€ memory.py
   β”‚   β”œβ”€β”€ planner.py
   β”‚   β”œβ”€β”€ rag.py
   β”‚   └── yfinance.py
   β”‚
   β”œβ”€β”€ core/
   β”‚   β”œβ”€β”€ __init__.py
   β”‚   β”œβ”€β”€ config.py
   β”‚   β”œβ”€β”€ state.py
   β”‚   └── workflow.py
   β”‚
   β”œβ”€β”€ data/
   β”‚   └── The Intelligent Investor - BENJAMIN GRAHAM.pdf
   β”‚
   β”œβ”€β”€finance_db/
   β”‚   └── chroma.sqlite3
   β”‚
   β”œβ”€β”€ notebook/
   β”‚   └── experiment.ipynb
   β”‚
   β”œβ”€β”€ static/
   β”‚   β”œβ”€β”€ css/
   β”‚   β”‚   └── style.css
   β”‚   β”œβ”€β”€ images/
   β”‚   β”‚   └── logo.png
   β”‚   └── js/
   β”‚       └── script.js
   β”‚
   β”œβ”€β”€ templates/
   β”‚   └── index.html
   β”‚
   β”œβ”€β”€ tests/
   β”‚   └── test_app.py
   β”‚
   β”œβ”€β”€ tools/
   β”‚   β”œβ”€β”€ __init__.py
   β”‚   β”œβ”€β”€ document_loader.py
   β”‚   β”œβ”€β”€ llm_client.py
   β”‚   β”œβ”€β”€ search_tools.py
   β”‚   └── vector_store.py
   β”‚
   β”œβ”€β”€ .gitignore
   β”œβ”€β”€ api.py
   β”œβ”€β”€ app.py
   β”œβ”€β”€ app.png
   β”œβ”€β”€ demo.mp4
   β”œβ”€β”€ Dockerfile
   β”œβ”€β”€ LICENSE
   β”œβ”€β”€ main.py
   β”œβ”€β”€ README.md
   β”œβ”€β”€ render.yaml
   β”œβ”€β”€ requirements.txt
   └── setup.py

System Architecture

flowchart TD
    A[User Query] --> B[Planner]
    B --> C[Recall Memory]
    C --> D[LLM Direct Answer Attempt]
    D -->|Success| E[Generate Response]
    D -->|Failure| F[Executor: Retry Logic]
    F --> G{Retry Count < 3?}
    G -->|Yes| H[RAG: Search PDF Knowledge]
    G -->|No| I[Yahoo Finance Search]
    H -->|Found Docs| E
    H -->|No Docs| I
    I -->|Found News| E
    I -->|No News| J[DuckDuckGo Web Search]
    J --> E
    E --> K[Store in Memory]
    K --> L[Return Final Answer]

    %% External Tools
    H --> M[(ChromaDB)]
    I --> N[[Yahoo Finance]]
    J --> O[[DuckDuckGo]]
    
    %% LLM Core
    D --> P[[Groq-LLaMA3]]
    E --> P
Loading

FastAPI Endpoints

POST /chat

Process a financial question and return an AI-generated response with source information.

Request:

POST /chat HTTP/1.1  
Content-Type: application/json  
Host: localhost:8000  

{
  "message": "What are the top performing stocks this week?",
  "session_id": "optional_existing_id"
}

Parameters:

  • message (required) β†’ The financial question to process
  • session_id (optional) β†’ Existing session ID for context continuity (default: "default")

Response:

{
  "response": "Based on Yahoo Finance data, the top performing stocks this week are...",
  "session_id": "20250813123045",
  "source": "YahooFinance"
}

Status Codes:

  • 200 β†’ Successful response
  • 400 β†’ Invalid request (missing message)
  • 500 β†’ Internal server error

Deployment Process with Docker

Dockerization:

  1. Service Containerization: The entire TrueWealth AI system is broken down into microservices, each housed within its own Docker container.
  2. Docker Compose: Used to coordinate and manage multi-container services for local development and testing.

Deployment Steps:

  1. Build Docker Image:

    docker build -t truewealth-ai .
  2. Run Application in Docker:

    docker-compose up --build

CI/CD Pipeline

Continuous Integration and Continuous Deployment (CI/CD) is implemented using GitHub Actions to automate testing, building, and deploying the project.

CI/CD Features:

  • Automated Testing: Every code push triggers automated unit and integration tests.
  • Automated Deployment: Successful builds are automatically deployed to production or staging environments.

Future Enhancements

  • Multilingual Support: Future iterations will include multilingual capabilities to cater to a global client base.
  • Advanced Financial Analytics: Integration with more sophisticated financial forecasting models and real-time market analysis.
  • Long-Term Memory: Extended memory for better long-term personalized financial advice.

Personal Information


About

πŸ’° An intelligent financial advisor chatbot powered by LLaMA-3, built with LangGraph for structured reasoning, RAG from The Intelligent Investor PDF, and real-time data from Yahoo Finance and DuckDuckGo. The system dynamically orchestrates tools, handles fallbacks, and maintains conversation memory.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages