Skip to content

Repository files navigation

FinRAG

Financial RAG System with Pinecone and Gemma

Overview

This project implements a Retrieval-Augmented Generation (RAG) system for financial documents, combining vector search with a large language model to provide accurate answers to financial queries.

Technologies & Tools

Category Technologies
Language
Vector DB
NLP
ML
LLM
Framework
Data

Features

  • Document processing and chunking
  • Vector embedding generation.
  • Efficient vector storage/retrieval
  • Context-aware question answering
  • Automatic model selection based on GPUs

Setup Instructions

  • Prerequisites
  • Python 3.9+
  • GPU with sufficient VRAM (minimum 5GB recommended)
  • Pinecone API key
  • Hugging Face account (for Gemma model access)

Setup

git clone https://github.com/Shegun93/FinRAG.git
cd FinRAG

Installing Dependencies

pip install -r requirements.txt

Configuration

Create a .env configuration files

PINECONE_API_KEY = "your-api-key"
PINECONE_ENVIRONMENT="region"

Authenticate Hugging Face:

huggingface-cli login

Usage

# Example query
query = "What was the operating profit increase from 2011-2012?"
answer = ask(query)
print(answer)

The system will:

  • Retrieve the most relevant document chunks
  • Generate accurate answers using the Gemma LLM
  • Display both the answer and the context used

Customization

  • Chunk size: Adjust the chunk_size parameter in the split_into_chunks function
  • Model selection: The system automatically selects the appropriate Gemma model based on available GPU memory
  • Temperature: Control answer creativity via the temperature parameter in the ask function

Troubleshooting

  • GPU Memory Errors: If you encounter memory issues, try:
  • Using the 2B model instead of 7B
  • Enabling
  • Reducing the max_new_tokens parameter

Pinecone Issues: Ensure your:

  • API key is correct
  • Index name is unique
  • Region matches your Pinecone configuration

License

This project is licensed under the MIT License

Acknowledgments

  • Pinecone
  • Huggingface
  • Google for the Gemma models

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages