Haqqak
Arabic labor-law RAG, citations verified before they're shown
Knowing your rights as a worker shouldn't depend on being able to afford a lawyer. Haqqak (حقّك — "your right") answers questions about قانون العمل رقم 7 لسنة 2000 and its 2018 amendment, grounded and cited entirely from those two documents, in plain conversational Arabic. It's extracted and rebuilt as a standalone public project from an internal Gaza Municipality RAG pipeline, deployed at haqqak.abdabuammouna.com.
Retrieval is semantic search over a single Chroma collection, re-ranked by priority tier and recency within a similarity margin. Generation runs two passes: draft an answer, then verify every (document, المادة number) citation it makes against what was actually retrieved, running one repair pass if anything comes back unconfirmed. The UI never hides the verification result, whether it's confirmed or not — trustworthiness was the top design priority going in, not an afterthought.
The backend (FastAPI, Docker, deployed on Render with vectors baked into the image for a stateless, instant-start container) and the frontend (Next.js + Framer Motion, full Arabic RTL, deployed on Vercel) are both live and rate-limited (20 requests/minute/IP) against public traffic. No accounts, no PII, no tracking — a visitor asks a question and gets an answer.
Engineering highlights
- Two-pass generation with citation verification — every article citation is checked against actual retrieval results before the answer reaches the user, with a repair pass for anything unconfirmed.
- Retrieval re-ranked by priority tier and recency, not just raw similarity, over a single Chroma collection baked into the Docker image at build time for a stateless, instant-start container.
- Streamed responses over SSE — sources first, then the answer — with rate limiting (20/minute/IP) on both the ask and feedback endpoints.
- A hand-verified correction to the amendment's own article numbering — its المادة 1 inserts a new المادة 6 مكرر into the base law rather than stating a rule directly, so citation verification accepts either attribution as confirming the same chunk.
- Full Arabic RTL interface end to end, built on the same two-pass verification pipeline proven in the internal municipal RAG system this project was extracted from.