# Tunisian Revolution RAG System
A question-answering system about the Tunisian Revolution (2010-2011) that supports Arabic, French, and English. The system uses RAG (Retrieval-Augmented Generation) to provide accurate answers based on historical documents.
## Project Overview
This project implements a complete RAG pipeline that:
1. Loads and processes 22 documents about the Tunisian Revolution from multiple sources (Wikipedia, news articles)
2. Converts them into searchable vectors using multilingual embeddings
3. Uses **LM Studio with the Saka-14B model** to generate intelligent answers
4. Supports questions in Arabic, French, and English
**Note:** The `screenshots/` folder contains testing results and the prompts used to develop this project.
## Quick Start Guide
### Prerequisites
- Python 3.10+
- LM Studio (with Saka-14B model loaded)
### Step 1: Install Dependencies
```bash
cd tunisian_rag
pip install -r requirements.txt
```
### Step 2: Start LM Studio
1. Open LM Studio
2. Load the Saka-14B model
3. Start the local server (default port: 1234)
### Step 3: Build the Database
This creates the search index from all documents:
```bash
python scripts/build_vector_db.py
```
Output:
```
[1/5] Loading documents... ✓ Loaded: 22 documents
[2/5] Preprocessing documents... ✓ Cleaned text
[3/5] Chunking documents... ✓ Created 368 chunks
[4/5] Generating embeddings... ✓ Generated embeddings
[5/5] Storing in vector database... ✓ Stored in ChromaDB
BUILD COMPLETE
```
### Step 4: Chat with the System
```bash
python chat.py
```
Example conversation:
```
You: Who was Mohamed Bouazizi?
Bot: Mohamed Bouazizi was a street vendor in Sidi Bouzid, Tunisia...
You: متى بدأت الثورة؟
Bot: بدأت الثورة التونسية في 17 ديسمبر 2010...
You: Où la révolution a-t-elle commencé?
Bot: La révolution a commencé à Sidi Bouzid...
```
## System Architecture
```
tunisian_rag/
├── chat.py # Main chat interface
├── config/
│ └── config.yaml # LM Studio & model s …