Customer-assistance RAG chatbot for the ONSSA website (Morocco) — Streamlit, Ollama (Mistral 7B), FAISS + BM25 hybrid retrieval, French answers grounded in official content. Internship project.
# 🇲🇦 Assistant ONSSA — RAG Chatbot
> Customer-assistance chatbot for the official **ONSSA** website
> (Office National de Sécurité Sanitaire des produits Alimentaires, Morocco —
>
onssa.gov.ma). It answers visitor questions in **French**, grounded
> **exclusively** in ONSSA website content, with source citations — and runs
> **100 % locally with no paid API**.
Python · Streamlit · Ollama (Mistral 7B) ·
FAISS · sentence-transformers ·
hybrid retrieval (vector + BM25) · local voice (Whisper + Piper)
---
## 📑 Table of contents
1. What it does
2. Key features
3. Architecture
4. How a question is answered
5. Evaluation results
6. Technology choices
7. Setup & run
8. Configuration
9. Deliverables map
10. Documentation
11. Project structure
---
## 🎯 What it does
A visitor asks a natural-language question about ONSSA (missions, organisation,
métiers, réglementation, e-services, contacts, démarches). The system embeds the
question, retrieves the most relevant ONSSA text from a local vector database,
and a local LLM writes a **grounded French answer with citations**. If nothing
relevant is found, it says so instead of inventing — the anti-hallucination rule.
| | |
|---|---|
| **Corpus** | 284 ONSSA pages · 333 sections · **1,187 indexed chunks** |
| **Retrieval quality** | **hit@5 = 14/15** (hybrid) vs 13/15 (naive vector-only) |
| **Cost** | **€0** — no paid API; everything runs on the local machine |
| **Languages** | Answers in French; multilingual embeddings; voice in French |
| **Tests** | 24 unit & smoke tests |
---
## ✨ Key features
| Area | Feature |
|---|---|
| **RAG core** | Retrieval **always** precedes generation; relevance gate refuses off-topic questions *before* the LLM runs |
| **Hybrid retrieval** | FAISS vector search **+** BM25 keyword search fused with Reciprocal Rank Fusion |
| **Grounding** | Strict French system prompt: answer only from extracts, cite sources `[n]`, no legal/medical/veterinary advice |
| **Follow-u …