This project implements a Retrieval-Augmented Generation (RAG) system for answering financial questions based on data from 10-K filings. It combines ElasticSearch for efficient information retrieval with a local Language Model (LLM) to generate accurate and context-aware responses to financial queries.
- Uses a dataset of 10,000 financial question-answer pairs derived from 10-K filings
- Implements a RAG architecture using ElasticSearch and Ollama
- Provides a user-friendly interface using Streamlit
- Fully dockerized for easy deployment and scalability
- Data Preparation: The system preprocesses the financial Q&A dataset and indexes it in ElasticSearch.
- Query Processing: When a user submits a question, the system retrieves relevant context from ElasticSearch.
- Answer Generation: The retrieved context is then passed to a local LLM (Qwen 0.5b) to generate a response.
- User Interface: The generated answer is displayed to the user through a Streamlit web interface.
- Docker
- Docker Compose
-
Clone the repository:
git clone https://github.com/srmadani/financial-qa-rag.git cd financial-qa-rag
-
Build and start the Docker containers:
docker-compose up --build
-
Once all services are up, access the application at
http://localhost:8501
- Open your web browser and navigate to
http://localhost:8501
- Enter your financial question in the text input field
- Click "Ask" to submit your query
- The system will process your question and display the answer
app.py
: Main Streamlit applicationdata_prep.py
: Data preprocessing and ElasticSearch indexingDockerfile
: Instructions for building the Docker imagedocker-compose.yaml
: Defines and configures the Docker servicesrequirements.txt
: Lists the Python dependencieswait-for-elasticsearch.sh
: Ensures ElasticSearch is ready before starting the app
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the Apache License 2.0. See the LICENSE file for details.
- Dataset source: Kaggle - Financial Q&A 10k
- Preprocessing credit: Kaggle Notebook
- RAG design credit: DataTalksClub/llm-zoomcamp
This system is designed for educational and research purposes. Always consult with qualified financial professionals for actual financial advice.