Budget Buddy is a finance-focused chatbot designed to help you manage your personal finances with ease. It uses advanced natural language processing (NLP) technologies, including Chainlit, LLaMA, and Hugging Face Sentence Transformers, to analyze your financial documents, answer budget-related questions, and provide actionable insights.
A chatbot is a software application designed to simulate human-like conversations using text or voice. Chatbots use NLP to understand and respond to user queries intelligently. Budget Buddy acts as a financial assistant, leveraging machine learning and NLP to interpret your uploaded financial data and provide meaningful advice.
Budget Buddy processes your uploaded financial documents (e.g., bank statements, budget reports) and provides insights by:
- Embedding Generation: Converts the content of your PDFs into meaningful numerical representations (embeddings) using Hugging Face Sentence Transformers.
- Financial Data Storage: Stores these embeddings in a vector database for quick retrieval and analysis.
- Interactive Conversations: Answers user questions using the generated embeddings and the LLaMA language model for natural and context-aware responses.
Sentence Transformers are deep learning models designed to convert text into dense numerical vectors (embeddings). These vectors capture the semantic meaning of sentences, enabling advanced tasks like:
- Information retrieval.
- Question answering.
- Semantic similarity comparison.
Budget Buddy uses the sentence-transformers/all-MiniLM-L6-v2
model, a lightweight and efficient transformer-based model, ideal for creating embeddings for financial data.
- Text is extracted from uploaded PDFs.
- The extracted text is passed through the Sentence Transformer model to generate embeddings.
- These embeddings are stored in a vectorstore for efficient and quick query matching.
Hugging Face is a leading platform for state-of-the-art NLP models and tools. In Budget Buddy, it plays a critical role by providing:
- Pretrained Models: The
sentence-transformers/all-MiniLM-L6-v2
model is accessed via Hugging Face for creating embeddings. - Ease of Integration: Hugging Face tools simplify integrating advanced NLP capabilities into the chatbot.
- Customizability: Allows fine-tuning and adapting pretrained models for specific financial use cases.
- Upload documents like bank statements, expense reports, and budgets.
- Extract structured information, such as income, expenses, and transaction summaries.
- Ask questions like:
- "Whatโs my total spending for October?"
- "How much did I save last month?"
- "Whatโs the largest expense in my uploaded PDF?"
- Get tailored insights and suggestions for improving savings, managing budgets, and optimizing expenses.
- Leverages vector embeddings for efficient and context-aware query handling.
Hereโs how the project is organized:
- .chainlit/ # Chainlit-specific configuration and settings
- .files/ # Temporary or supporting file storage
- data/ # ๐ Upload your financial PDFs here!
- vectorstore/ # ๐ง Vector database storing financial embeddings
- venv/ # ๐ก๏ธ Virtual environment for dependencies
- chainlit/ # Chainlit app configuration and scripts
- ingest/ # ๐ Scripts for processing PDFs into embeddings
- model/ # ๐ค Machine learning models (LLaMA & Hugging Face)
- README.md # ๐ Project documentation
- requirements.txt # ๐ Project dependencies
Note: There are currently no test files in the project. Testing will involve manual verification of the chatbotโs responses using different financial PDFs.
git clone https://github.com/Bushra-Butt-17/BudgetBuddy-Finance-Chatbot.git
cd BudgetBuddy
python -m venv venv
source venv/bin/activate # For Linux/MacOS
venv\Scripts\activate # For Windows
pip install -r requirements.txt
- Save your PDF files (e.g., bank statements, budget reports) in the
data/
directory.
- Run the
ingest_data.py
script to generate embeddings from the PDFs:python ingest.py
- Embeddings are stored in the
vectorstore/
directory for quick access.
- Launch the chatbot using Chainlit:
chainlit run
- Open your browser to interact with Budget Buddy, upload financial PDFs, and ask questions.
The chatbot uses Hugging Face Embeddings to generate dense numerical representations (embeddings) of financial PDFs. These embeddings allow the chatbot to:
- Extract and summarize critical information.
- Retrieve relevant details when answering user questions.
- Offer precise and personalized financial insights.
Hereโs how embeddings are created in Budget Buddy:
from langchain.embeddings import HuggingFaceEmbeddings
# Create embeddings for financial PDFs
embeddings = HuggingFaceEmbeddings(
model_name='sentence-transformers/all-MiniLM-L6-v2',
model_kwargs={'device': 'cpu'} # Optimized for devices without GPU
)
The embeddings are stored in a vector database (vectorstore/
), enabling efficient similarity searches and instant retrieval of relevant data.
- Automated Testing Framework: Add unit and integration tests for validating chatbot responses.
- Data Visualization: Visualize financial trends and summaries (e.g., income vs. expenses).
- Support for More File Formats: Expand support to Excel and CSV files.
- Advanced NLP Models: Fine-tune LLaMA for financial-specific tasks.
We welcome contributions to make Budget Buddy better! Feel free to fork the repository, make changes, and submit a pull request.
For questions, suggestions, or feedback, contact: [email protected]
- Upload PDFs to the
data/
folder for consistent processing. - Always run the
ingest_data.py
script after adding new PDFs to update embeddings. - Use a virtual environment to manage dependencies and prevent conflicts.
- ๐ Add support for dynamic dashboards.
- ๐ฅ Real-time PDF uploads directly via the chatbot.
- ๐ Integration of external APIs for currency conversion and stock market data.
This project is licensed under the MIT License. See the LICENSE file for more details.
Get started today and take control of your finances with Budget Buddy! ๐ธ