|
| 1 | +# **💼 TrueWealth AI: Your Smart Path to Financial Freedom** |
| 2 | + |
| 3 | +## **Project Overview** |
| 4 | + |
| 5 | +**TrueWealth AI** is an advanced, AI-powered financial advisor that uses cutting-edge technologies in machine learning, natural language processing (NLP), and document retrieval. By leveraging advanced LLMs, real-time data access from financial tools like Yahoo Finance, DuckDuckGo, and dynamic document retrieval systems like LangChain and ChromaDB, it provides personalized financial advice. The system is designed to simulate a real-world financial advisor, offering clear, insightful, and actionable recommendations. |
| 6 | + |
| 7 | +### 🧱 Project Structure |
| 8 | +``` |
| 9 | +TrueWealth AI/ |
| 10 | +├── streamlit_app.py # Streamlit-based user interface for financial advisor chatbot |
| 11 | +├── notebook/ |
| 12 | +│ └── experiment.ipynb # Jupyter notebook for prototyping, experimentation, and testing |
| 13 | +├── agents/ |
| 14 | +│ ├── __init__.py # Package initializer for agents module |
| 15 | +│ ├── nodes.py # LangGraph nodes: agent planner, tool-caller, executor logic |
| 16 | +│ ├── state.py # Agent state and memory management during graph execution |
| 17 | +│ └── workflow.py # LangGraph planner + executor orchestration for agent workflow |
| 18 | +├── data/ |
| 19 | +│ └── The Intelligent Investor - BENJAMIN GRAHAM.pdf # Sample financial PDF for RAG ingestion |
| 20 | +├── finance_db/ |
| 21 | +│ └── (SQLite/Postgres DB files) # Local or remote finance database to store processed data |
| 22 | +├── ingestion/ |
| 23 | +│ └── pdf_loader.py # Document ingestion module: PDF parsing, metadata extraction, RAG prep |
| 24 | +├── utils/ |
| 25 | +│ ├── __init__.py # Package initializer for utility functions |
| 26 | +│ └── memory.py # Short-term memory store (e.g., Chroma, JSON memory, etc.) |
| 27 | +├── logs/ |
| 28 | +│ └── advisor.log # Logging outputs for all conversations, errors, or tool executions |
| 29 | +├── tests/ |
| 30 | +│ ├── __init__.py # Package initializer for test suite |
| 31 | +│ └── test_app.py # Unit tests for core application components (agents, tools, API, etc.) |
| 32 | +├── retrieval/ |
| 33 | +│ ├── __init__.py # Package initializer for retrieval modules |
| 34 | +│ ├── retrievers.py # Top-K retrievers using vector similarity (e.g., Chroma, FAISS) |
| 35 | +│ ├── splitter.py # PDF/document chunking logic (e.g., RecursiveTextSplitter) |
| 36 | +│ └── vectorstore.py # Vectorstore logic using HuggingFace embeddings + ChromaDB |
| 37 | +├── logger.py # Logger configuration for debug/info/error handling across modules |
| 38 | +├── config.py # Centralized config: API keys, constants, paths, env vars (via dotenv) |
| 39 | +├── main.py # run file for muduler package |
| 40 | +├── setup.py # Package metadata and install dependencies (for pip install) |
| 41 | +├── fastapi_app.py # FastAPI app serving REST endpoints for backend API integration |
| 42 | +├── app.png |
| 43 | +├── .gitignore # Files/folders ignoredetc.) |
| 44 | +├── Dockerfile # Docker image definition for containerizing the full app |
| 45 | +├── .github/ |
| 46 | +│ └── workflows/ |
| 47 | +│ └── ci.yml # GitHub Actions workflow for CI/CD: linting, tests, deploy |
| 48 | +├── requirements.txt # Dependency list for pip install (FastAPI, LangChain, etc.) |
| 49 | +├── LICENSE |
| 50 | +├── README.md # Project overview, setup instructions, features, architecture diagram |
| 51 | +``` |
| 52 | + |
| 53 | + |
| 54 | +### **Tech Stack:** |
| 55 | + |
| 56 | +* **LLMs (Large Language Models)**: **Groq** |
| 57 | +* **Data Retrieval**: **LangChain**, **ChromaDB**, **Sentence Transformers** |
| 58 | +* **Document Parsing**: **PyPDFLoader**, **DocumentReaderAgent** |
| 59 | +* **Search Tools**: **Yahoo Finance API**, **DuckDuckGo API** |
| 60 | +* **Memory Management**: **LangGraph Memory Integration** |
| 61 | +* **Agent Technique**: **ToolRouter Agent**, **Planner Agent** |
| 62 | +* **Backend**: **FastAPI** (for RESTful APIs) |
| 63 | +* **Frontend**: **Streamlit** (interactive UI) |
| 64 | +* **Deployment**: **Docker**, **CI/CD** (GitHub Actions/Jenkins) |
| 65 | + |
| 66 | +--- |
| 67 | + |
| 68 | +## **Features & Functionalities** |
| 69 | + |
| 70 | +| ✅ Step | 🧠 Feature | ⚙️ Tech Stack / Tool Used | |
| 71 | +| ------ | ------------------------------------ | --------------------------------------------------------------- | |
| 72 | +| 1️⃣ | 🧠 **LLM-based Query Understanding** | **Groq** | |
| 73 | +| 2️⃣ | ✨ **Tone Personalization** | **Prompt Engineering** + **Persona Templates** | |
| 74 | +| 3️⃣ | 📚 **RAG-based Answering** | **LangChain** + **ChromaDB** + **Sentence Transformers** | |
| 75 | +| 4️⃣ | 🔍 **Retrieval Agent** | **RetrieverAgent** + **Vector Store Tools** | |
| 76 | +| 5️⃣ | 🧠 **Answer Generator Agent** | **GeneratorAgent** (LLM-based factual + human-style) | |
| 77 | +| 6️⃣ | 🧾 **Document QA Agent** | **DocumentReaderAgent** + **QA Chain** | |
| 78 | +| 7️⃣ | 🔁 **ToolRouter Agent** | **Conditional Logic** + **Tool Selection** | |
| 79 | +| 8️⃣ | 🧠 **Planner Agent** | **LangGraph Planner Node** | |
| 80 | +| 9️⃣ | 🔄 **Intelligent Tool Routing** | **Retry Logic** + **Fallback Tool** + **Score-based Selection** | |
| 81 | +| 🔟 | 🧠 **Short Conversational Memory** | **LangGraph Memory Integration (short-term)** | |
| 82 | + |
| 83 | +--- |
| 84 | + |
| 85 | +## **Backend with FastAPI** |
| 86 | + |
| 87 | +FastAPI serves as the backend for managing API requests, handling the communication between the UI and the core financial advisory logic. |
| 88 | + |
| 89 | +### **Other Features**: |
| 90 | + |
| 91 | +* **Fast API Endpoints**: API routes are built to handle financial queries, document retrieval requests, and personalized recommendations. |
| 92 | +* **Asynchronous Processing**: Supports asynchronous task handling for document retrieval and large LLM query processing. |
| 93 | +* **Integration with LangChain and RAG Pipeline**: FastAPI integrates directly with LangChain and RAG to provide on-demand data fetching and query answering. |
| 94 | + |
| 95 | +--- |
| 96 | + |
| 97 | +## **User Interface with Streamlit** |
| 98 | + |
| 99 | +Streamlit is used for the front-end, where users can interact with the financial advisor chatbot in a conversational format. |
| 100 | + |
| 101 | +### **UI Features**: |
| 102 | + |
| 103 | +* **Real-Time Interaction**: The Streamlit interface allows users to input queries and receive answers instantly. |
| 104 | +* **Tone Personalization**: Users can choose how formal or informal they want the assistant to sound. |
| 105 | +* **Live Data Display**: Financial data (such as stock prices, trends, and company news) is displayed dynamically. |
| 106 | + |
| 107 | +--- |
| 108 | + |
| 109 | +## **Deployment Process with Docker** |
| 110 | + |
| 111 | +### **Dockerization**: |
| 112 | + |
| 113 | +1. **Service Containerization**: The entire TrueWealth AI system is broken down into microservices, each housed within its own Docker container. |
| 114 | +2. **Docker Compose**: Used to coordinate and manage multi-container services for local development and testing. |
| 115 | + |
| 116 | +### **Deployment Steps**: |
| 117 | + |
| 118 | +1. **Build Docker Image**: |
| 119 | + |
| 120 | + ```bash |
| 121 | + docker build -t truewealth-ai . |
| 122 | + ``` |
| 123 | +2. **Run Application in Docker**: |
| 124 | + |
| 125 | + ```bash |
| 126 | + docker-compose up --build |
| 127 | + ``` |
| 128 | + |
| 129 | +--- |
| 130 | + |
| 131 | +## **CI/CD Pipeline** |
| 132 | + |
| 133 | +Continuous Integration and Continuous Deployment (CI/CD) is implemented using **GitHub Actions** to automate testing, building, and deploying the project. |
| 134 | + |
| 135 | +### **CI/CD Features**: |
| 136 | + |
| 137 | +* **Automated Testing**: Every code push triggers automated unit and integration tests. |
| 138 | +* **Automated Deployment**: Successful builds are automatically deployed to production or staging environments. |
| 139 | + |
| 140 | +--- |
| 141 | + |
| 142 | +## **Future Enhancements** |
| 143 | + |
| 144 | +* **Multilingual Support**: Future iterations will include multilingual capabilities to cater to a global client base. |
| 145 | +* **Advanced Financial Analytics**: Integration with more sophisticated financial forecasting models and real-time market analysis. |
| 146 | +* **Long-Term Memory**: Extended memory for better long-term personalized financial advice. |
| 147 | + |
| 148 | +--- |
| 149 | + |
| 150 | +### **Personal Information** |
| 151 | + |
| 152 | +* **Developer:** Md Emon Hasan |
| 153 | +* **GitHub:** [Md-Emon-Hasan](https://github.com/Md-Emon-Hasan) |
| 154 | +* **LinkedIn:** [Md Emon Hasan](https://www.linkedin.com/in/md-emon-hasan) |
| 155 | + |
| 156 | +* **WhatsApp:** [+8801834363533](https://wa.me/8801834363533) |
| 157 | + |
| 158 | +--- |
0 commit comments