RAG-based AI chatbot about Tunisian archaeological sites using Llama 3, ChromaDB, and Streamlit
# 🏛️ Chatbot RAG - Patrimoine Archéologique de Tunisie
Chatbot intelligent utilisant une architecture RAG (Retrieval-Augmented Generation) pour répondre aux questions sur les sites archéologiques tunisiens.
## 📋 Fonctionnalités
- **Recherche vectorielle** dans ChromaDB avec embeddings (all-MiniLM-L6-v2)
- **Génération de réponses** via LLM local (Llama 3 / Ollama)
- **Interface utilisateur** Streamlit interactive
- **Sources citées** avec scores de pertinence
- **Support multilingue** français/arabe
## 🏗️ Architecture
```
Documents (PDF, TXT, JSON)
↓
Nettoyage & Structuration
↓
Découpage en chunks (300-500 tokens)
↓
Embedding (all-MiniLM-L6-v2)
↓
ChromaDB (collection persistante)
↓
Question utilisateur → Embedding → Recherche k-NN
↓
Top-k chunks + métadonnées
↓
Prompt enrichi (Question + Contexte + Instructions)
↓
LLM local (Llama 3 via Ollama)
↓
Réponse structurée + Sources
```
## 🚀 Installation
### Prérequis
- Python 3.9-3.12 (recommandé: 3.11) - Python 3.13+ non supporté
- Ollama avec Llama 3
### Étapes
```bash
# 1. Cloner le projet
git clone
cd patrimoine-tunisie-rag
# 2. Créer environnement virtuel (avec Python 3.11 recommandé)
python -m venv venv
venv\Scripts\activate # Windows
# source venv/bin/activate # Linux/Mac
# 3. Installer les dépendances
pip install -r requirements.txt
# 4. Installer Ollama et Llama 3
# Télécharger Ollama:
ollama.ai
ollama pull llama3
# 5. Ingérer les données dans ChromaDB
python ingest.py
# 6. Tester le pipeline RAG
python rag.py
# 7. Lancer l'interface Streamlit
streamlit run app.py
```
### Note sur Python
Ce projet nécessite Python 3.9-3.12. Si vous avez Python 3.13+, installez une version compatible:
- Windows:
python.org
- Ou utilisez pyenv/conda pour gérer plusieurs versions
## 📁 Structure du Projet
```
├── data/ # Corpus de documents
│ ├── carthage.txt
│ …