A high-security, scalable Retrieval-Augmented Generation (RAG) platform built explicitly for the Arabic language and government-grade deployment.
Note: This repository is a Showcase / Architecture Overview only. Due to enterprise and government NDAs, the source code, proprietary chunking algorithms, and fine-tuned embeddings remain closed-source.
Enterprise and governmental entities in the MENA region require Generative AI capabilities to unlock their unstructured data. However, generic RAG solutions fail on three fronts:
- Language: Poor parsing, chunking, and retrieval of complex Arabic documents (RTL issues, diacritics, dialect variations).
- Security: Strict data sovereignty laws require 100% on-premise execution with zero external API calls (No OpenAI/Anthropic).
- Scale & Format: Processing thousands of scanned PDFs (often with low DPI), legacy Word documents, and Excel sheets asynchronously.
SecureAI RAG is an end-to-end, locally hosted intelligence platform that ingests, indexes, and chats with massive Arabic document repositories safely.
graph TD
A[User / Frontend] -->|Query / Upload| B(FastAPI Gateway)
B -->|Async Tasks| C{Celery Workers}
C -->|OCR Processing| D[PaddleOCR Arabic]
C -->|Semantic Indexing| E[(Qdrant Vector DB)]
C -->|Metadata Storage| F[(PostgreSQL)]
B -->|Retrieve Context| E
B -->|Generate Response| G[Local LLM - Ollama/VLLM]
G -->|Streaming Output| A
%% Observability
H[Prometheus] --- B
H --- C
H --- E
- Custom OCR: Integration with
PaddleOCRoptimized for Arabic typography, handling scanned PDFs that traditional parsers fail to read. - Semantic Chunking: Custom text-splitters that respect Arabic sentence boundaries, conjunctions (حروف العطف), and contextual flow.
- Hybrid Search: BM25 (Keyword) + Nomic-Embed-Text (Semantic) combined for optimal retrieval accuracy in Arabic queries.
- Asynchronous Ingestion: Built on
CeleryandRedis. Users upload thousands of pages without blocking the main thread. - Vector Database:
Qdranthandles millions of vectors with sub-millisecond retrieval latency. - Observability: Integrated with
PrometheusandGrafanafor real-time monitoring of ingestion queues, LLM generation latency, and hit rates.
- 100% Local: Entirely self-hosted. Uses local LLM inference engines (
Ollama/vLLM) with custom fine-tuned models. - RBAC (Role-Based Access Control): Granular document-level permissions. Users can only query documents they have explicit clearance to view.
- Accuracy: 94%+ retrieval precision on highly technical Arabic legal and administrative documents.
- Throughput: Processes and indexes ~500 scanned pages per minute on standard enterprise hardware.
- Security Compliance: Satisfies strict MENA governmental IT and data sovereignty guidelines.