NyayaBot
AI-powered statutory legal aid system for Indian jurisprudence grounded in verified statutes via a structured RAG pipeline.

Overview
CHAPTER 01 / INTENTNavigating legal systems is notoriously opaque, yet generic LLMs frequently hallucinate legal precedents, misquote statutory sections, and conflate jurisdictions with dangerous consequences. NyayaBot was engineered as a disciplined, hallucination-resistant legal assistance system anchored strictly to verified Indian statutory codes (BNSS, IPC, procedural acts).
Architecture
CHAPTER 02 / DESIGNNyayaBot enforces a strict Retrieve → Ground → Generate pipeline. Incoming natural language queries are pre-screened with domain classifiers to instantly reject non-legal queries. Legal queries undergo keyword expansion (mapping colloquial terms to statutory nomenclature) before dense vector retrieval in ChromaDB. Only if retrieved passages pass a strict relevance threshold is the LLM authorized to generate a response.
Technical Execution
CHAPTER 03 / SYSTEM- Domain Filtering: Keyword classifier rejecting non-legal queries with zero LLM inference cost.
- Query Expansion: Maps vernacular terms (e.g. FIR) to exact statutory codes (Section 173 BNSS police complaint).
- Vector Retrieval: ChromaDB cosine similarity over 384-dimensional all-MiniLM-L6-v2 embeddings with top-3 relevance gating (score >= 0.35).
- Statutory Grounding: Prompt architecture that strictly binds answers to indexed statutory text, prohibiting generative speculation.
Observations
CHAPTER 04 / LESSONSIn high-stakes domains like law, the most crucial architectural feature is not how brilliantly the model speaks, but its ability to decisively refuse to answer when the factual evidence is absent.