French Legal AI Assistant & by Arslan MehmoodFrench Legal AI Assistant & by Arslan Mehmood

French Legal AI Assistant &

Arslan Mehmood

Arslan Mehmood

French Legal AI Assistant & Agentic RAG System
Overview
I designed, built, and deployed a specialized Legal AI Assistant for French lawyers using agentic RAG, legal data pipelines, vector search, reranking, open-source LLMs, and citation-grounded answer generation. The system allowed lawyers to ask legal questions and receive answers grounded in French law articles, legal references, and relevant judicial cases.
Problem / Challenge
Legal data is very different from normal document data. A generic RAG pipeline using fixed-size chunks often breaks legal meaning, misses important context, or retrieves incomplete references. The main challenges were: šŸ”¹ Legal documents had different structures and lengths šŸ”¹ Articles and laws could not be randomly split into fixed-size chunks šŸ”¹ Each answer needed traceable legal references šŸ”¹ Retrieval had to understand legal scope, not just semantic similarity šŸ”¹ The system needed to reduce hallucinations for legal users šŸ”¹ Deployment had to respect privacy and regulatory requirements
My Expertise
I worked as the Lead AI Engineer / Agentic RAG Developer responsible for the complete system design and implementation. My responsibilities included: šŸ”¹ Legal data pipeline architecture šŸ”¹ Document parsing and preprocessing šŸ”¹ Custom legal chunking strategy šŸ”¹ Vector database design šŸ”¹ Agentic RAG workflow development šŸ”¹ Retrieval optimization and reranking šŸ”¹ Open-source LLM deployment šŸ”¹ Backend API development with FastAPI šŸ”¹ Secure Azure cloud deployment šŸ”¹ Multi-tenant system support
French Legal Data Engineering Pipeline
I built an automated ETL pipeline to process thousands of French legal documents, articles, and judicial cases. The pipeline handled: šŸ”¹ Raw legal document ingestion šŸ”¹ Text cleaning and normalization šŸ”¹ Legal article extraction šŸ”¹ Section-aware document structuring šŸ”¹ Custom chunk generation šŸ”¹ Metadata extraction for article number, article title, section, source, and reference šŸ”¹ Embedding generation šŸ”¹ Vector database ingestion šŸ”¹ Repeatable updates for future legal data expansion The chunking strategy was designed so legal articles were not cut in the middle or separated from their meaning.
Agentic RAG Workflow
Instead of using a simple one-step vector search, I built a LangGraph-based agentic RAG workflow. The workflow included: šŸ”¹ User query understanding šŸ”¹ Legal intent detection šŸ”¹ Legal domain and scope identification šŸ”¹ Generation of 2–5 targeted legal search queries šŸ”¹ Retrieval of relevant chunks for each query šŸ”¹ Deduplication of repeated results šŸ”¹ Reranking of retrieved legal evidence šŸ”¹ Source-grounded answer generation This improved tested retrieval accuracy from around 50% to 95%+.
Retrieval, Citations & Case Law
The retrieval system was designed to make answers transparent and verifiable. I implemented: šŸ”¹ Vector search for semantic legal retrieval šŸ”¹ Reranking to improve relevance šŸ”¹ Metadata-based source traceability šŸ”¹ Citation-backed answer generation šŸ”¹ Article-level legal references šŸ”¹ Typesense-based retrieval for French judicial cases šŸ”¹ Supporting case law returned with legal answers This allowed lawyers to verify the exact legal source behind each generated response.
Open-Source LLM & Cloud Deployment
I evaluated and deployed open-source LLM infrastructure for private legal AI usage. The deployment included: šŸ”¹ Qwen2.5:14B for French legal reasoning šŸ”¹ Ollama and vLLM for model serving šŸ”¹ Embedding and reranker models on a private Azure GPU VM šŸ”¹ NVIDIA T4 16GB GPU optimization šŸ”¹ Python/FastAPI backend APIs šŸ”¹ Secure Azure deployment in the France region šŸ”¹ Multi-tenant isolated access šŸ”¹ GitHub CI/CD and Linux server management The system was designed for privacy, reliability, and regulatory compliance.
Technologies Used
šŸ”¹ Python šŸ”¹ FastAPI šŸ”¹ LangChain šŸ”¹ LangGraph šŸ”¹ LangSmith šŸ”¹ Ollama šŸ”¹ vLLM šŸ”¹ Qwen2.5:14B šŸ”¹ ChromaDB šŸ”¹ Typesense šŸ”¹ Vector Databases šŸ”¹ Reranking Models šŸ”¹ Embedding Models šŸ”¹ Azure Cloud šŸ”¹ Linux šŸ”¹ GitHub CI/CD
Impact
šŸ”¹ Built a production-ready legal AI assistant for lawyers šŸ”¹ Improved retrieval accuracy from ~50% to 95%+ in tested scenarios šŸ”¹ Reduced hallucinations through citation-grounded generation šŸ”¹ Enabled lawyers to verify answers using article and case references šŸ”¹ Created a scalable legal data pipeline for thousands of documents šŸ”¹ Deployed private open-source LLM infrastructure for legal compliance šŸ”¹ Delivered a strong foundation for future legal AI workflows
Like this project

Posted Jun 22, 2026

French Legal AI Assistant & Agentic RAG System Overview I designed, built, and deployed a specialized Legal AI Assistant for French lawyers using agentic RAG...