🇬🇠Semantic search and Q&A system for Ghana's Constitution. Built with Ollama LLMs, LlamaIndex RAG pipeline, and Qdrant vector database. Runs entirely locally with natural language queries and context-aware responses.
# Ghana Constitution RAG System
A Retrieval-Augmented Generation (RAG) system for querying Ghana's Constitution using local LLMs and vector search.
## Overview
This project implements a conversational AI system that answers questions about Ghana's Constitution. It uses:
- **Qdrant** for vector storage and similarity search
- **LlamaIndex** for document processing and retrieval
- **Ollama** for local LLM inference
- **HuggingFace embeddings** for document vectorization
## Features
- 📚 Semantic search through Ghana's Constitution
- 🤖 Natural language responses powered by local LLMs
- 🔍 Context-aware retrieval with top-k similarity matching
- đź’¬ Conversational interface with legal expertise
- đź”’ Runs entirely locally - no external API calls
## Prerequisites
- Python 3.8+
- Docker (for Qdrant)
- Ollama installed locally
- Intel XPU support (or modify to use CPU/GPU)
## Installation
### 1. Clone the repository
```bash
git clone
github.com
cd constitution-rag-ai-system
```
### 2. Install Python dependencies
```bash
pip install -r requirements.txt
```
### 3. Install and Setup Ollama
**For Linux:**
```bash
curl -fsSL
ollama.com | sh
```
**For macOS:**
```bash
brew install ollama
```
**For Windows:**
Download from
ollama.com
### 4. Start Ollama Server
```bash
ollama serve
```
Keep this terminal running. Open a new terminal for the next steps.
### 5. Pull an Ollama Model
Choose one of these models (or any other from
ollama.com):
**Recommended models:**
```bash
# Fast and efficient (3.8GB)
ollama pull llama3.2
# More capable (4.7GB)
ollama pull mistral
# Larger, more accurate (7.4GB)
ollama pull llama3.1:8b
# Powerful option (26GB)
ollama pull llama3.1:70b
```
For this example, we'll use `llama3.2`:
github.com
```bash
ollama pull llama3.2
```
### 6. Start Qdrant Vector Database
```bash
docker run -p 6333:6333 -p 63 …