Designed and developed an end-to-end bilingual AI legal assistant that retrieves and explains Saudi Labor Law using Retrieval-Augmented Generation (RAG). The system combines semantic retrieval, reranking, and grounded generation to provide accurate answers with relevant legal article citations in Arabic and English.

صممت وطورت مساعدًا قانونيًا ذكيًا ثنائي اللغة يعتمد على تقنية RAG لاسترجاع مواد نظام العمل السعودي وشرحها. يجمع النظام بين الاسترجاع الدلالي، وإعادة ترتيب النتائج، والتوليد الموثق لتقديم إجابات دقيقة مدعومة بمواد نظام العمل باللغتين العربية والإنجليزية.

95.65% Retrieval recall استدعاء الاسترجاع (Recall)
83.02% F1 score درجة F1
73.33% Precision الإحكام أو الدقة النوعية
70.9% Responses with correct citation الردود ذات الاستشهاد القانوني الصحيح

How it's built

كيف تم بناؤه

  • Parses the Saudi Labor Law PDF, extracts structured articles, generates BGE-M3 embeddings, and indexes them with FAISS for semantic retrieval.
  • Runs a bilingual RAG pipeline using Qwen2.5-7B, semantic search, and Cross-Encoder reranking to improve retrieval precision.
  • Built a FastAPI backend exposing a unified API endpoint with structured JSON responses and legal article citations for Arabic and English queries.
  • Containerized the complete system using Docker, separating retrieval, embedding generation, and inference services for scalability and maintainability.
  • يعالج ملف نظام العمل السعودي بصيغة PDF، يستخرج المواد القانونية، وينشئ تمثيلات BGE-M3، ثم يفهرسها باستخدام FAISS للاسترجاع الدلالي.
  • يشغّل خط RAG ثنائي اللغة باستخدام Qwen2.5-7B والاسترجاع الدلالي وإعادة ترتيب النتائج عبر Cross-Encoder لتحسين دقة الاسترجاع.
  • يوفر endpoint موحد مبني بـ FastAPI يعيد استجابات JSON منظمة مع استشهادات بالمواد القانونية للاستفسارات بالعربية والإنجليزية.
  • محزّم بالكامل عبر Docker، مع فصل خدمات الاسترجاع وتوليد التمثيلات والاستدلال لتحقيق قابلية التوسع وسهولة الصيانة.

Demo

عرض توضيحي