RAG pipeline over Tunisian open government data using LangChain
# Tunisia Open Government Data RAG Pipeline
**Retrieval-Augmented Generation** over real Tunisian public datasets using LangChain, multilingual embeddings and frontier LLMs via OpenRouter.
## β¨ Features
- Ingestion of Tunisian open government CSV datasets about **education establishments**
- Multilingual embedding model that handles **Arabic + French** very well
- Persistent Chroma vector database
- Conversational RAG chain with history awareness
- Easy model switching via OpenRouter (Qwen, Llama 3.3, Mistral, Claude, Gemini, β¦)
- Local fallback to Ollama possible
- Clean separation: ingestion / querying / configuration
- CLI interface + **Streamlit Web UI**
## ποΈ Project Structure
```text
tunisia-rag/
βββ data/ # Put downloaded CSVs here
βββ chroma_db/ # Persistent Chroma vector store (git ignored)
βββ .env # API keys (git ignored)
βββ requirements.txt
βββ README.md
βββ ingest.py # One-time data β vector store pipeline
βββ query.py # Conversational RAG interface
βββ config.py # Central model & path configuration
```
## Installation Guide
Follow these steps to get the **Tunisia Open Government Data RAG Pipeline** up and running on your machine.
### 1. Prerequisites
- **Python** β₯ 3.10
- **Ollama** (optional β only if you want to use a local LLM fallback instead of OpenRouter)
- An **OpenRouter** account and API key
β Create one (free tier available):
openrouter.ai
### 2. Clone and Install Dependencies
```bash
# Clone the repository
git clone
github.com
cd Tunisia-Open-Gov-Data-RAG
```
#### (Recommended) Create and activate a virtual environment
```bash
python -m venv .venv
# On macOS / Linux
source .venv/bin/activate
# On Windows
# .venv\Scripts\activate
# Install all required Python packages
pip install -r requirements.txt
```
### 3. Configure Environment Variables
copy and edit .e β¦