Skip to content

Commit 002f137

Browse files
committed
update all
1 parent 2dbf289 commit 002f137

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+2621
-775
lines changed

.github/workflows/main.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Docker Image CI-CD
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v3
17+
18+
- name: Set up Python
19+
uses: actions/setup-python@v4
20+
with:
21+
python-version: '3.x'
22+
23+
- name: Set up Docker Buildx
24+
uses: docker/setup-buildx-action@v2
25+
26+
- name: Cache Docker layers
27+
uses: actions/cache@v3
28+
with:
29+
path: /tmp/.buildx-cache
30+
key: ${{ runner.os }}-buildx-${{ github.sha }}
31+
restore-keys: |
32+
${{ runner.os }}-buildx-
33+
34+
- name: Build Docker image
35+
run: docker build -t true-wealth-ai .
36+
37+
- name: Test the application (Run tests inside container)
38+
run: docker run --rm true-wealth-ai pytest tests/

.gitignore

Whitespace-only changes.

Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Use an official Python runtime as a parent image
2+
FROM python:3.11-slim
3+
4+
# Set the working directory
5+
WORKDIR /main
6+
7+
# Copy the current directory contents into the container
8+
COPY . /main
9+
10+
# Install the dependencies
11+
RUN pip install --no-cache-dir -r requirements.txt
12+
13+
# Expose Streamlit default port
14+
EXPOSE 8501
15+
16+
# Correct command to run Streamlit app
17+
CMD ["streamlit", "run", "streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Md Emon Hasan
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
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+
* **Email:** [[email protected]](mailto:[email protected])
156+
* **WhatsApp:** [+8801834363533](https://wa.me/8801834363533)
157+
158+
---

__pycache__/config.cpython-311.pyc

338 Bytes
Binary file not shown.

__pycache__/logger.cpython-311.pyc

677 Bytes
Binary file not shown.

agents/__init__.py

Whitespace-only changes.
165 Bytes
Binary file not shown.
6.01 KB
Binary file not shown.

0 commit comments

Comments
 (0)