Team capstone

What
RAG legal-aid chatbot, voice-enabled
Where
IIT Mandi capstone, PGD in Agentic Engineering
Team
Team project: Shashi G., Shaunak Lahiri, Leena, Darshan. The repository sits on Shashi’s account.
Result
Capstone medalist, 9.5/10
Code
shashig/himshikhar-capstone-precedent (opens in a new tab)

Legal Navigator

A voice-enabled RAG chatbot over NALSA legal-aid data, in English or Hindi. IIT Mandi capstone, team project, medalist 9.5/10.

Capstone medal at IIT Mandi, 9.5/10.

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

Fig. 1 · Legal Navigator, how it is built

Legal Navigator, how it is builtThe same steps are listed in order below the diagram.Chat UItext or voiceapp/ui/streamlit_app.pyStreamlitSpeech to textvoice onlyapp/sarvam.pySarvam saaras:v3Translate Hindi → EnglishHindi onlyinvoke_hiSarvam mayura:v1Record the user turnLangGraphrecord_user_turnClassify the queryeligibility or infoclassify_queryClaude tool callExtract the profilegender, age, caste category,disability, annual income, stateextract_jsonClaude forced tool-useAny field missing?Ask a follow-up questionRetrieve for aninfo questionChroma, top 5Conversation memoryLangGraph MemorySavercheckpoint per threadMatch the rulesdeterministic, no modelapp/matcher/rules.pyrules.csv, predicates.csv,rule_sources.csvRetrieve the cited sectionfor each matched ruleget_by_doc_and_sectionChroma, top 1 per ruleWrite the grounded answergenerate_textClaudeRecord the assistant turn→ endLangGraphTranslate English → HindiHindi onlySarvamText to speechvoice onlysummarize_for_speechSarvam bulbul:v3Vector storeChroma legal_aid_doc_chunksall-MiniLM-L6-v2 embeddingsIngest (offline)PDFs → section-aware chunks→ embeddings. Sources: LegalServices Authorities Act 1987,Child-Friendly Legal Services,Veer Parivar Sahayta Yojnapypdf, or PyMuPDF +Tesseract OCR for scansnew questioncontinuing an eligibility chateligibilityinfocompletemissing fields: askLLM: Anthropic Claude (model set by env). Deployed as a Docker image on Render.
  • Step in the code
  • LLM or external API
  • Data store
  • Only some turns, or offline
Simplified from the code in shashig/himshikhar-capstone-precedent (opens in a new tab), branch master. LLM: Anthropic Claude (model set by env). Deployed as a Docker image on Render.
The same diagram, as a list
  1. A person asks in the Streamlit chat, by text or by voice.
  2. Voice only: Sarvam speech-to-text (saaras:v3) turns speech into text.
  3. Hindi only: Sarvam translates the question into English (mayura:v1).
  4. LangGraph records the user turn; conversation memory keeps a checkpoint per thread.
  5. A new question goes to a classifier (a Claude tool call): eligibility or information. A continuing eligibility chat goes straight to extraction.
  6. Eligibility: Claude extracts the profile fields (gender, age, caste category, disability, annual income, state) with forced tool use.
  7. If a field is missing, the assistant asks a follow-up question and the turn ends.
  8. If the profile is complete, a deterministic rules matcher checks it against rules.csv, predicates.csv and rule_sources.csv.
  9. For each matched rule, the cited section is retrieved from the Chroma vector store (top 1 per rule).
  10. Information: the question is answered from the top 5 retrieved chunks.
  11. Claude writes the grounded answer, and LangGraph records the assistant turn.
  12. 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).
  13. 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.
  14. 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.

Ask me about Legal Navigator