This Streamlit RAG-Based application provides an end-to-end pipeline for downloading, processing, embedding, and querying parliamentary debate reports from the Parliament of Ghana.
# ποΈ Ghana Parliamentary Debates QA App
This Streamlit application provides an end-to-end pipeline for downloading, processing, embedding, and querying parliamentary debate reports from the Parliament of Ghana.
---
## π Overview
The application enables users to:
1. **Download Parliamentary PDFs** between a range of dates from the official Parliament of Ghana website.
2. **Extract & preprocess** text data from the PDFs.
3. **Train a vector database** using sentence embeddings.
4. **Query** the debate reports in natural language using a Retrieval-Augmented Generation (RAG) approach powered by LangChain and Ollama.
---
## ποΈ Project Structure
```text
π gh_parliament_ai_app/
βββ app.py # Main Streamlit app entry
βββ pages/
β βββ 1 - Download Briefs.py # Page to download PDFs
β βββ 2 - Train Model.py # Page to extract, split, embed and save vector DB
βββ 3 - Query Briefs.py # Page to run queries on the RAG model
βββ proceedings/ # Folder where downloaded PDFs are stored
βββ parliament_faiss_db_allminlm # Saved FAISS vector databases
```
---
## βοΈ Features
### π₯ Docs Downloader (Page 1)
- Select a **start and end date**.
- Downloads all available parliamentary brief PDFs between those dates.
- Files are saved in the `proceedings/` folder.
- If a file already exists, it will be **overwritten**.
### π§ Train Model (Page 2)
- Reads PDFs from the `proceedings/` folder.
- Extracts and splits the text into manageable chunks.
- Generates **sentence-level embeddings** using `OllamaEmbeddings` (e.g., MiniLM or LLaMA3).
- Saves a local **FAISS vector store** for fast retrieval.
### β Query Debate Reports (Page 3)
- Loads the trained vector store.
- Accepts user input in natural language.
- Retrieves relevant chunks using semantic search.
- Uses an LLM to answer questions based on retrieved context.
---
## π οΈ Tech Stack
- **Streamlit** β Interactive web app framework.
- **LangChain** β RAG orchestration, embeddings, and β¦