The ACity RAG assistant chatbot created for Academic City University Ghana can respond to queries using two datasets: the 2024 Ghana Presidential Election Results (CSV file) and the 2025 Budget Statement (PDF format). The assistant was created completely from scratch so there are no pre-existing frameworks like LangChain, LlamaIndex, etc.
# ACity RAG Assistant
# Nathaniel Adam
# 10012200036git remote add origin
github.com / .git
**Retrieval-Augmented Generation Chatbot — Academic City University Ghana**
> Built from scratch — no LangChain, no LlamaIndex, no pre-built RAG pipelines.
> **LLM:** Groq API (`llama-3.1-8b-instant`) · **Embeddings:** sentence-transformers · **Vector store:** FAISS
---
## Project structure
```
project-root/
├── app.py # Streamlit UI (chat, sidebar “Control deck”, theme)
├── pipeline.py # Full RAG orchestrator (Part D) + Groq HTTP calls
├── data_loader.py # Data cleaning + chunking (Part A)
├── retriever.py # Embedding + FAISS + hybrid search (Part B)
├── prompt_builder.py # Prompt templates + context (Part C)
├── requirements.txt
├── data/
│ ├── Ghana_Election_Result.csv # elections corpus (expected filename)
│ ├── *.pdf # first PDF in folder used as budget source
│ ├── faiss.index # auto-generated on init
│ └── chunks.pkl # auto-generated on init
├── logs/
│ ├── experiment_log.txt
│ ├── pipeline.log
│ ├── query_log.jsonl
│ ├── feedback.json
│ └── adversarial_results.json
└── README.md
```
Paths to CSV/PDF are resolved **relative to `pipeline.py`** (the `data/` folder next to the code), so the app works regardless of the shell’s current working directory.
---
## Quick start
### 1. Install dependencies
```bash
cd /path/to/project
pip install -r requirements.txt
```
**Streamlit:** `requirements.txt` pins `streamlit>=1.32.0`. A recent version is recommended for **scrollable chat** (`st.container(height=…)`) and **Enter-to-send** in `st.form`.
### 2. Data files
Place in `data/`:
| File | Role |
|------|------|
| `Ghana_Election_Result.csv` | Election results (expected name) |
| Any `*.pdf` | Budget / policy PDF — the pipeline picks the **first** PDF in `data/` alphabetically |
### 3. Groq API key
Create a key at Groq Console …