Skip to content

Budget Buddy is a finance chatbot built using Chainlit and the LLaMA language model. It analyzes PDF documents, such as bank statements and budget reports, to provide personalized financial advice and insights. The chatbot is integrated with Hugging Face for model management, offering an interactive way to manage personal finances.

Notifications You must be signed in to change notification settings

Bushra-Butt-17/BudgetBuddy-Finance-Chatbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

16 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Example Image


Budget Buddy - Your Personal Finance Chatbot ๐Ÿ’ธ๐Ÿค–

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.


๐Ÿ“Œ What is a Chatbot?

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.


๐Ÿ“Œ How Budget Buddy Works

Budget Buddy processes your uploaded financial documents (e.g., bank statements, budget reports) and provides insights by:

  1. Embedding Generation: Converts the content of your PDFs into meaningful numerical representations (embeddings) using Hugging Face Sentence Transformers.
  2. Financial Data Storage: Stores these embeddings in a vector database for quick retrieval and analysis.
  3. Interactive Conversations: Answers user questions using the generated embeddings and the LLaMA language model for natural and context-aware responses.

๐Ÿ” What are Sentence Transformers?

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.

How It Works in Budget Buddy:

  1. Text is extracted from uploaded PDFs.
  2. The extracted text is passed through the Sentence Transformer model to generate embeddings.
  3. These embeddings are stored in a vectorstore for efficient and quick query matching.

๐Ÿ”— Role of Hugging Face

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:

  1. Pretrained Models: The sentence-transformers/all-MiniLM-L6-v2 model is accessed via Hugging Face for creating embeddings.
  2. Ease of Integration: Hugging Face tools simplify integrating advanced NLP capabilities into the chatbot.
  3. Customizability: Allows fine-tuning and adapting pretrained models for specific financial use cases.

๐Ÿš€ Key Features

1. Upload Financial PDFs ๐Ÿ“„

  • Upload documents like bank statements, expense reports, and budgets.

2. PDF Analysis ๐Ÿ“Š

  • Extract structured information, such as income, expenses, and transaction summaries.

3. Interactive Conversations ๐Ÿ’ฌ

  • 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?"

4. Personalized Financial Advice ๐Ÿ’ก

  • Get tailored insights and suggestions for improving savings, managing budgets, and optimizing expenses.

5. Fast and Accurate Responses โšก

  • Leverages vector embeddings for efficient and context-aware query handling.

๐Ÿ› ๏ธ Project Structure

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.


๐Ÿ“– How to Get Started

1. Clone the Repository ๐Ÿ› ๏ธ

git clone https://github.com/Bushra-Butt-17/BudgetBuddy-Finance-Chatbot.git
cd BudgetBuddy

2. Set Up the Virtual Environment ๐Ÿ

python -m venv venv
source venv/bin/activate   # For Linux/MacOS
venv\Scripts\activate      # For Windows

3. Install Dependencies ๐Ÿ“ฆ

pip install -r requirements.txt

๐Ÿค– How to Use Budget Buddy

Step 1: Upload Financial PDFs

  • Save your PDF files (e.g., bank statements, budget reports) in the data/ directory.

Step 2: Process PDFs ๐Ÿ“œ โžก๏ธ ๐Ÿง 

  • 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.

Step 3: Run the Chatbot ๐Ÿ’ฌ

  • Launch the chatbot using Chainlit:
    chainlit run
  • Open your browser to interact with Budget Buddy, upload financial PDFs, and ask questions.

๐ŸŒŸ Behind the Scenes

Embedding Generation

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
)

Vectorstore

The embeddings are stored in a vector database (vectorstore/), enabling efficient similarity searches and instant retrieval of relevant data.


๐Ÿš€ Future Plans

  • 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.

๐Ÿ™Œ Contributing

We welcome contributions to make Budget Buddy better! Feel free to fork the repository, make changes, and submit a pull request.


๐Ÿ“ง Contact

For questions, suggestions, or feedback, contact: [email protected]


Happy Budgeting! ๐Ÿ’ธ๐ŸŽ‰

Tips for Best Results ๐ŸŽฏ

  1. Upload PDFs to the data/ folder for consistent processing.
  2. Always run the ingest_data.py script after adding new PDFs to update embeddings.
  3. Use a virtual environment to manage dependencies and prevent conflicts.

Future Enhancements ๐Ÿ”ฎ

  • ๐Ÿ“ˆ Add support for dynamic dashboards.
  • ๐Ÿ“ฅ Real-time PDF uploads directly via the chatbot.
  • ๐ŸŒ Integration of external APIs for currency conversion and stock market data.

License ๐Ÿ“„

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! ๐Ÿ’ธ

About

Budget Buddy is a finance chatbot built using Chainlit and the LLaMA language model. It analyzes PDF documents, such as bank statements and budget reports, to provide personalized financial advice and insights. The chatbot is integrated with Hugging Face for model management, offering an interactive way to manage personal finances.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages