Featured work

Legal Chatbot

AI-powered legal assistance and a virtual courtroom for Indian practice, built as an agentic RAG system: retrieval and grounding before the model ever answers.

Llama 3.3 70B (Groq)Ollama, local Llama 3 / Phi-3Deepgram STTAgentic RAGLangGraphCrewAIFastAPISQLitePyAnnote Group project · 3

Architecture

How it works

  • 01 — User interaction: a text query, voice input, an uploaded document, or the virtual courtroom interface — four entry points into the same backend.
  • 02 — Input processing: voice goes through Deepgram speech-to-text first; documents are processed and chunked; everything else becomes a normalised query.
  • 03 — Legal retrieval: the query is matched against the indexed legal corpus, and a retriever ranks the chunks that actually matter.
  • 04 — Context construction: the query and the ranked legal chunks are assembled into one grounded prompt — the model never sees the raw corpus directly.
  • 05 — LLM reasoning: Llama 3.3 70B, served through Groq, generates the answer from that grounded context.
  • 06 — Response: delivered back as a legal explanation, a document/clause analysis, or a reply inside the virtual courtroom interface.
  • Three pipelines share this one engine: a research pipeline (about six agents that retrieve, draft and check), a courtroom pipeline (speaker diarisation with PyAnnote and live contradiction alerts), and a simplifier that turns legalese into plain language.

Model evolution

Development iteration — one model replacing the last as limits showed up, not several models running together in production.

01 Phi-3 (local) Could not reliably hold the multi-step agentic flow across a full session.
02 Smaller local Llama Held the flow, but took minutes per answer — too slow for a live legal session.
03 Llama 3.3 70B via Groq Moved the heavy reasoning to Groq's hosted 70B model, bringing answers down to 90–180 seconds.

My contribution

Key features

  • RAG-based legal query answering
  • Document upload and clause analysis
  • Voice interaction via Deepgram STT
  • Virtual courtroom interface
  • Grounded, citation-aware responses

Team

  • Legal Chatbot was built by a 3-person team as a group project, not solo.
  • Retrieval, agent orchestration, speech integration and the virtual courtroom interface were built together across the team.

What I worked on

  • RAG architecture and the retrieval workflow — the query-to-context path described in the architecture above.
  • Legal query processing and retrieval ranking.
  • Grounding and context construction for the LLM.
  • Model experimentation and the move from local models to Llama 3.3 70B on Groq.

Results

  • Phi-3 could not hold the agentic flow. A smaller local Llama worked but took minutes per answer. Moving heavy reasoning to Groq's 70B brought it down to 90 to 180 seconds, fast enough for a real session.
  • The team measured roughly a 70% cut in legal-research time on the research pipeline.

In code

python
ctx = retrieve(query, k=8)                    # local store, 500-char chunks
draft = llm(prompt(query, ctx))               # Groq Llama 3.3 70B, heavy reasoning
for claim in split_claims(draft):
    tag = "[FROM RAG]" if grounded_in(claim, ctx) else "[FROM WEB]"
    claim.annotate(tag)
answer = verifier_agent(draft, acts=ctx)      # conflict -> statute text wins▊

Grounding pass: every claim is tagged by source, then a verifier agent resolves conflicts.

Slides

The full project deck. You can read it right here.

Legal Chatbot: deck view only

Comments

Thoughts or questions on this project? Leave a note below.

Loading comments…