A RAG Chatbot for Ghana's Elections and Budget
# ☕ Brew & Ask - GH RAG Bot
**Student:** Emmanuella Uwudia
**Index Number:** AI_10012200008
**Course:** CS4241 - Introduction to Artificial Intelligence
---
## Table of Contents
1. Live Demo
2. Overview
3. Features
4. Tech Stack
5. Project Structure
6. Local Setup
7. Sample Questions
8. Statistics
9. Links
---
## Live Demo
🔗 **
ai-10012200008.streamlit.ap…
> *Note: The app may take 10-15 seconds to wake up after inactivity (free tier limitation).*
---
## Overview
Brew & Ask is a **Retrieval-Augmented Generation (RAG)** chatbot that answers questions about:
- 📊 **Ghana Election Results** (2000, 2004, 2016, 2020)
- 📄 **Ghana 2025 Budget Statement**
The system is built entirely from scratch without LangChain, LlamaIndex, or any pre-built RAG pipelines. All components including chunking, embeddings, vector search, prompt construction, and LLM integration were manually implemented.
---
## Features
| Feature | Description |
|---------|-------------|
| Custom RAG | No frameworks - fully manual implementation |
| Query Expansion | Ghana-specific synonyms (NPP → New Patriotic Party) |
| Hallucination Control | Structured prompt with explicit rules |
| Source Attribution | Shows document names and similarity scores |
| Conversation Memory | Remembers last 10 exchanges for follow-up questions |
| Feedback Loop | User ratings (1-5 stars) improve retrieval over time |
---
## Tech Stack
| Component | Technology |
|-----------|------------|
| UI Framework | Streamlit |
| Embeddings | Sentence Transformers (all-MiniLM-L6-v2) |
| Vector Store | FAISS (Facebook AI Similarity Search) |
| LLM Provider | Groq (free tier, 560 tokens/sec) |
| LLM Model | Llama 3.1 8B Instant |
| Data Processing | Pandas, PyPDF2 |
| Language | Python 3.10+ |
---
## Project Structure
```text
ai_10012200008/
│
├── data/
│ ├── raw/ # Original CSV and PDF files
│ │ ├── Ghana_Election_Result.csv
│ │ └── 2025-Budget-Statement-and-Economic-Policy_v4.pdf
│ ├── processed/ # Cleaned and …