Labiba AI is a Retrieval-Augmented Generation assistant I built for Zain's Legal Affairs department. Legal staff can chat in natural language over the department's archive of documents and letters, or upload a specific document and interrogate it directly — with answers grounded in the source material.
The stack is a Nuxt.js frontend over a FastAPI backend, with all AI running fully on-premise: Ollama serving gemma4:26b behind a LiteLLM proxy, so no legal document ever leaves Zain's infrastructure.
The two hardest problems were in ingestion and retrieval:
- Arabic OCR accuracy — traditional OCR engines struggled with scanned Arabic letters and documents. I solved it by using the vision-capable model itself to read documents, which dramatically improved ingestion accuracy over conventional OCR.
- Long multi-page documents — users searching for information buried at the end of a long document were getting poor results. I fixed this with parent-document retrieval: matching on small chunks for precision, then handing the model the full document for answering.
Let's Create Something
Together
Get In Touch