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

Repository files navigation

TrueWealth AI: Your AI-Powered Financial Strategist

demo.mp4

Project Overview

TrueWealth AI is an end-to-end Multi-Agent Financial Advisor AI System that delivers reliable, real-time investment insights by combining LangGraph-powered orchestration, advanced LLM reasoning (LLaMA-3 via Groq), and RAG with ChromaDB + HuggingFace embeddings. It features Planner, Retriever, Generator, News, Web Search, and Memory agents with intelligent tool routing, retry logic, and multi-source knowledge fusion, ensuring professional-grade accuracy. The system supports financial PDF ingestion, live market data, and fallback web search, guaranteeing comprehensive coverage across diverse queries.

Engineered with a modular, scalable architecture, it includes FastAPI APIs for testing, a Flask-based responsive UI (HTML, CSS, JS) for client interaction, and full Dockerization for portability. Deployed on Render with a CI/CD pipeline, it adheres to enterprise software practices.

Achievements: Benchmarked on 100+ financial queries, the system achieved 99% query coverage with <3s P95 latency reducing manual research effort by ~40% while ensuring enterprise-level reliability, scalability, and real-world deployment readiness.


Live Demo

Try the real-time TrueWealth AI: TrueWealth AI – Click Here


Project Structure

TrueWealth AI/
   │
   ├── .github/
   │   └── workflows/
   │       └── main.yml
   │
   ├── agents/
   │   ├── __init__.py
   │   ├── duckduckgo.py
   │   ├── executor.py
   │   ├── generator.py
   │   ├── llm.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

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
10 Short-Term Conversational Memory LangGraph Memory Integration (Buffer-based)
11 PDF Knowledge Ingestion PyPDFLoader + RecursiveCharacterTextSplitter
12 Vector Embedding & Storage HuggingFaceEmbeddings + ChromaDB
13 State-based Multi-Agent Orchestration LangGraph StateGraph + Conditional Edges + Dynamic State Updates
14 Multi-source Knowledge Fusion LLM + RAG + Yahoo Finance + DuckDuckGo Combined Answer Synthesis
15 API Testing & Integration FastAPI (API endpoints for agent orchestration testing)
16 Modular Code Architecture Separation of Concerns + Service/Agent Modules
17 Responsive Web UI Flask + HTML5, CSS3, JavaScript
18 Cloud Deployment Render (Production hosting)
19 CI/CD Pipeline GitHub Actions / CI/CD Workflows
20 Containerization for Portability Docker (App + Dependencies + Environment)

Performance Metrics

Metric Value
Mean Latency 2.00s
P95 Latency 3.05s
Query Coverage 99%

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