AI-powered knowledge portal and research assistant for EPRC Uganda
# EPRC AI Research Assistant
An AI-powered knowledge portal and research assistant for the **Economic Policy Research Centre (EPRC) of Uganda** — built to make 30+ years of Uganda's economic policy research instantly accessible to researchers, policymakers, and the public.
> Built entirely in-house by EPRC ICT staff as a zero-cost alternative to external consultants.
---
## What It Does
- 🔍 **Semantic search** across 500+ EPRC research documents (1994–2024)
- 💬 **Natural language Q&A** — ask questions, get cited answers from real EPRC research
- 🌐 **Website navigation assistant** — guides users to the right section of eprcug.org
- 📄 **Source citations** — every answer references the exact document and page
- 🤖 **Small talk capable** — handles greetings and general queries gracefully
---
## Tech Stack
| Component | Technology |
|---|---|
| LLM | Gemma 4 (via Ollama) — runs 100% locally |
| Embeddings | nomic-embed-text (via Ollama) |
| Vector Store | ChromaDB (persistent local store) |
| Document Registry | PostgreSQL |
| Backend API | FastAPI + Python |
| Frontend | Vanilla HTML/CSS/JS chat widget |
| Document Parsing | PyPDF + python-docx |
---
## Architecture
```
EPRC Documents (PDF/DOCX)
↓
knowledge_base.py — chunks, embeds, stores in ChromaDB
↓
User asks question via chat widget
↓
engine.py — embeds query → searches ChromaDB → retrieves top 8 chunks
↓
Gemma answers using retrieved context + EPRC identity
↓
Streamed response with source citations
```
---
## Project Structure
```
eprc-ai-assistant/
├── app.py # FastAPI backend + chat widget UI
├── engine.py # RAG query pipeline
├── knowledge_base.py # Document ingestion pipeline
├── database.py # PostgreSQL + ChromaDB setup
├── prompts.py # System prompts + EPRC identity
├── static/
│ └── index.html # Floating chat widget UI
├── eprc_documents/ # EPRC research documents (not in repo)
├── chroma_store/ # Vector embeddings (not in repo)
└── .en …