Logo Lanfrica

mouelhijihed/tunisie-electronique-rag

Domaine:

natural language processing

Type de record:

software
Créateur:
mou
Hôte:
Bilingual (FR/AR) RAG system for Tunisian procurement documents - OCR, hybrid retrieval, LangGraph pipeline, admin UI github.com # Tunisie Electronique — Knowledge Base RAG A bilingual (Français / العربية) Retrieval-Augmented Generation system for Tunisian government procurement documents — cahiers des charges, factures, avis d'appel d'offres, contrats, and more. PDFs are OCR'd, chunked, vectorized, and stored in Qdrant. Queries flow through a 7-node LangGraph pipeline powered by a local LLM (Ollama), with hybrid retrieval (dense + sparse), cross-encoder reranking, and multi-layer anti-hallucination checks. ## Features - **Smart OCR router** — digital text pages are extracted instantly with pypdf; scanned/Arabic pages go through Tesseract (`lang=ara`); table-heavy pages optionally use Microsoft Table Transformer - **Bilingual RAG** — French and Arabic questions answered from the same index, with automatic language detection - **Hybrid retrieval** — `BAAI/bge-m3` dense embeddings + BM25 sparse vectors, fused with RRF - **Cross-encoder reranking** — `BAAI/bge-reranker-v2-m3` for precision - **Anti-hallucination** — keyword grounding, two-pass LLM verification, NLI check, confidence thresholds, refusal detection - **Admin UI** — session-based login, dashboard with document list, per-document scoped chat history - **Fully local** — Ollama LLM + embedded Qdrant, no cloud APIs required ## Architecture ``` PDF Upload ──> OCR ──> Post-Processor ──> Chunker ──> Embeddings ──> Qdrant │ User Query ──> LangGraph Pipeline ───────────────────────────────────┘ │ ├─ classify_query (language + query type) ├─ expand_query (rewrite + HyDE + multi-query) ├─ retrieve (hybrid dense+sparse, RRF fusion) ├─ rerank (cross-encoder, top-5) ├─ check_relevance (score threshold) ├─ answer (LLM + 30 few-shot examples) └─ verify (two-pass + hallucination check) │ ▼ Response + Sources ``` ### Component Stack | Layer | Component | Model / Tool | |-------|-----------|----- …