The problem
NALSA, the National Legal Services Authority, publishes legal-aid information. The capstone set out to make that material answerable in conversation, so a person can ask a question rather than dig through documents.
What I decided
Ground every answer in the source. The NALSA legal-aid data is indexed section by section: the Legal Services Authorities Act 1987, the Child-Friendly Legal Services scheme and the Veer Parivar Sahayta Yojna, chunked and embedded into a vector database. The assistant retrieves the cited section before it answers: retrieval-augmented generation.
Decide eligibility with rules, not the model. Claude classifies the question and extracts the person’s profile; a deterministic rules matcher checks legal-aid eligibility; Claude then writes the answer from the retrieved sections.
Meet people in their language. A question can be typed or spoken, in English or Hindi, and the answer comes back the same way.
How it’s built
- Step in the code
- LLM or external API
- Data store
- Only some turns, or offline
- Step in the code
- LLM or external API
- Data store
- Only some turns, or offline
The same diagram, as a list
- A person asks in the Streamlit chat, by text or by voice.
- Voice only: Sarvam speech-to-text (saaras:v3) turns speech into text.
- Hindi only: Sarvam translates the question into English (mayura:v1).
- LangGraph records the user turn; conversation memory keeps a checkpoint per thread.
- A new question goes to a classifier (a Claude tool call): eligibility or information. A continuing eligibility chat goes straight to extraction.
- Eligibility: Claude extracts the profile fields (gender, age, caste category, disability, annual income, state) with forced tool use.
- If a field is missing, the assistant asks a follow-up question and the turn ends.
- If the profile is complete, a deterministic rules matcher checks it against rules.csv, predicates.csv and rule_sources.csv.
- For each matched rule, the cited section is retrieved from the Chroma vector store (top 1 per rule).
- Information: the question is answered from the top 5 retrieved chunks.
- Claude writes the grounded answer, and LangGraph records the assistant turn.
- Hindi only: Sarvam translates the answer into Hindi. Voice only: the answer is summarised for speech and spoken by Sarvam text-to-speech (bulbul:v3).
- Offline, PDFs of the Legal Services Authorities Act 1987, Child-Friendly Legal Services and the Veer Parivar Sahayta Yojna are read with pypdf (or PyMuPDF and Tesseract OCR for scanned pages), cut into section-aware chunks and embedded with all-MiniLM-L6-v2 into the Chroma collection legal_aid_doc_chunks.
- LLM: Anthropic Claude (model set by env). Deployed as a Docker image on Render.
The result
Capstone Project Medalist at IIT Mandi, scored 9.5/10.
Team
- Shashi G.
- Lead builder
- Shaunak Lahiri
- Lead architect / system design
- Leena & Darshan
- Retrieval, chunking, embedding and training
What I’d do next
Find ambitious people who want to solve the many problems that stem from India’s highly complex legal jurisprudence. If that’s you, get in touch.