Rayyan Khan

Featured Project — RAG System

Ask the Constitution

A full-stack retrieval-augmented generation (RAG) application that answers questions about the Constitution of Pakistan in plain language — and shows the exact articles every answer is grounded in.

Black and white photograph of a law library with an open book — cover image for Ask the Constitution by Rayyan Khan

The Problem

The Constitution of Pakistan is a long legal document. Finding what it says about a specific right, office or article means paging through hundreds of provisions written in dense legal language — slow for students, journalists and citizens alike.

What I Built

Technical Approach

Technologies & Stack

Python FastAPI FAISS MiniLM (ONNX) OpenRouter LLM React Vite Render Vercel

Results

The app is live and public. Questions about fundamental rights, the presidency, the judiciary and more return grounded answers with the source articles attached — no hallucinated article numbers, because the model only sees retrieved text.

Limitations

Free-tier hosting means the backend can cold-start, and the free LLM tier occasionally rate-limits (the UI retries once automatically). Coverage is limited to the constitutional text itself — it explains what the document says, not case law built on top of it.

Visit Live DemoSource Code