AI Legal Assistant for Indian Law With Citation-Backed Answers
AI products · Creator, sole engineer · shipped
Statutes are dense, heavily cross-referenced and written in English legalese. Generic chatbots invent section numbers, which for a legal question is a safety problem rather than a quality one.
Code: https://github.com/vasu-devs/NyaySaathi
The detail
This answers only from verified source documents. Chunking preserves the statutory structure - Article, Section, Part, Chapter - so every retrieved passage is a citable unit rather than a fragment split mid-clause.
Retrieval is reference-aware: a hand-built cross-link map expands a query about one provision to the constitutional article it rests on, and results are re-ranked by exact section match and number proximity, because numeric identifiers are exactly where pure semantic similarity is weakest.
A 13-language layer detects script, handles romanised Hinglish, retrieves in English against English statutes, and translates the answer back - far more accurate than embedding multilingual queries directly.
If the sources do not contain the answer it says so and points to the official source rather than generating a plausible section number.
Runs fully locally with an embedded vector database - no server required.
What I did
- Built structure-preserving chunking that keeps statutory units intact
- Hand-built the cross-reference map linking statutes to constitutional provisions for query expansion
- Implemented reranking by exact section match and numeric proximity
- Built the 13-language layer with script detection, romanised input handling and English-pivot retrieval
- Designed the refusal behaviour with official-source fallback
- Shipped three product surfaces on one backend including per-document isolated collections
Stack
Python, Retrieval-Augmented Generation, Vector Database, FastAPI, React, Qdrant, Sentence Transformers, Gemini, Document Processing, Multilingual NLP
Case study: https://www.siddhvasudev.com/projects/ai-legal-assistant-for-indian-law