AI-powered WhatsApp chatbot for Moroccan e-commerce using RAG architecture. Supports Darija, French and English. Built with Flask, ChromaDB, Groq (Llama 4) and Infobip API. PFE 2026.
# 🤖 Chatbot WhatsApp IA — NVS (Next Value Solutions)
Un chatbot intelligent intégré à WhatsApp, conçu pour assister les clients d'une boutique e-commerce marocaine dans leur parcours d'achat. Le système utilise l'architecture **RAG (Retrieval-Augmented Generation)** pour recommander des produits réels du catalogue, avec support multilingue (Darija, Français, Anglais).
## 🏗️ Architecture
```
Client WhatsApp
|
v
Infobip API (Webhook)
|
v
Flask Server (chatbot_api.py)
|
+---> RAG Engine (rag_engine.py) ---> ChromaDB (Base vectorielle)
|
+---> LLM Client (llm_client.py) ---> Groq Cloud (Llama 4 Scout)
|
v
Reponse WhatsApp
```
## 🚀 Fonctionnalités
- **Recherche sémantique** : Recherche de produits par similarité via ChromaDB
- **Réponses contextuelles** : Génération de réponses naturelles via LLM (Groq Cloud)
- **Multilingue** : Darija marocaine, Français et Anglais
- **Mémoire conversationnelle** : Le bot se souvient des échanges précédents
- **Anti-hallucination** : Architecture RAG garantissant des recommandations basées uniquement sur le catalogue réel
- **Intégration WhatsApp** : Communication en temps réel via l'API Infobip
## 📁 Structure du projet
```
chatbot_whatsapp/
|-- chatbot_api.py # Serveur Flask + Webhook WhatsApp
|-- llm_client.py # Client LLM (Groq / Ollama)
|-- rag_engine.py # Moteur de recherche RAG (ChromaDB)
|-- data_ingestion.py # Indexation des produits dans ChromaDB
|-- test_chat.py # Mode test local (terminal)
|-- requirements.txt # Dependances Python
|-- data/
| |-- produits.json # Catalogue produits (format JSON)
|-- scraper/
| |-- scrap_master.py # Script de collecte de donnees
```
## ⚙️ Installation
```bash
# 1. Cloner le depot
git clone
github.com
cd chatbot-whatsapp-nvs
# 2. Creer l'environnement virtuel
python -m venv .venv
.venv\Scripts\activate # Windows
# source .venv/bin/activate # Linux/Mac
# 3. Instal …