All projects

RAG SystemsStatus: Case Study

AndhaKaanun

Jurisdiction-aware AI legal reasoning platform using Indian-law retrieval.

A look inside

6 screens from the real build. Select any to see it full size.

Describe an incident in plain language. While you type, a keyword and regex pass flags the Indian law sections that probably apply, here IPC 279, 304A, 325, 338 and Motor Vehicles Act 184 for a hit-and-run.
The first pass: retrieved sections go to the model as the only law it may use, and it returns a structured analysis with a summary, a timeline and a confidence score.
Both sides of the argument from the same facts and sections: the prosecution's strongest points and burden of proof next to the defense's counter points and possible loopholes.
Every cited section says why it applies. A validation step drops any section the model cites that retrieval did not return, and lowers confidence for each one. This run used keyword fallback instead of Pinecone, so match scores read 0.50.
The model also lists the facts it is missing, and the page turns them into questions. Answer any of them and the case is analyzed again.
After refinement, the summary and timeline carry the new facts: the speed estimate against a 40 km/h limit, the zebra crossing, and the certified injuries.

Overview

Generates dual-perspective prosecution and defense arguments from incident descriptions, grounded in Indian law and citation-aware retrieval.

The problem

Most legal AI tools give broad answers without jurisdictional grounding, explicit opposing arguments, or enough context to refine weak legal claims.

What I built

Designed the RAG flow, legal context framing, dual-perspective output structure, and missing-facts interaction model.

What it does

  • Incident intake
  • Citation-aware retrieval context
  • Dual argument generation
  • Missing fact prompts

System and architecture

A RAG pipeline retrieves Indian-law context, passes it into an LLM reasoning flow, and asks follow-up questions when facts are missing.

Incident descriptions enter a RAG pipeline backed by Pinecone. Retrieved Indian-law context is passed to Groq/Llama-3.3-70b to produce prosecution and defense reasoning, followed by an interactive engine that asks for missing legal facts.

System map3 layers
  1. API & services
  2. Retrieval & data
  3. AI & models
  • Vector retrieval over Indian-law context
  • Separate prosecution and defense reasoning paths
  • Follow-up question loop for missing legal facts

Technology

  • RAG
  • Pinecone
  • Groq
  • Llama-3.3-70b
  • Indian Law
  • FastAPI

Themes

  • Legal AI
  • Grounded generation

Challenges and trade-offs

  • Avoiding broad legal claims without enough retrieval context.
  • Separating legal reasoning support from legal advice.

Outcome

At a glance

Indian law RAG · IPC grounding · Pinecone · Groq/Llama-3.3-70b

  • Built a case-study-ready RAG architecture for jurisdiction-aware legal reasoning.
  • Improved output usefulness by forcing both sides of the argument to be represented.

Learnings

  • RAG systems need domain-specific guardrails and uncertainty handling.
  • Opposing-perspective generation can expose weak or missing assumptions.