DEV Community

Cover image for Replacing a ₹5000/hr Lawyer with Llama-3, Groq, and Python
a1k7
a1k7

Posted on

Replacing a ₹5000/hr Lawyer with Llama-3, Groq, and Python

The Problem

I am an engineering student in India. Legal advice here is expensive (₹5000/hour) or confusing. Last month, my friend got threatened with a "3-Year Employment Bond" and a demand for ₹2 Lakhs. We couldn't afford a lawyer.

The Tech Solution

I spent my weekend building Pocket Lawyer—an AI specifically "grounded" in Indian Statutes (BNS 2023, Contract Act, RBI Guidelines).

Stack:

  • Engine: Llama-3-70b (via Groq for speed)
  • Frontend: Streamlit
  • Logic: Custom Prompt Engineering to prevent hallucinations.

How I Fixed the "Hallucination" Bug

The hardest part was stopping the AI from citing US laws. I solved this by injecting a strict KNOWLEDGE_BASE into the system prompt.


python
# Here is the snippet that forces Indian Context
KNOWLEDGE_BASE = """
[JURISDICTION: INDIA ONLY]
1. Employment Bonds: Section 27 Contract Act (Void).
2. Recovery Agents: RBI Guidelines 2022 (No harassment).
"""
Enter fullscreen mode Exit fullscreen mode

Top comments (1)

Collapse
 
a1k7 profile image
a1k7

I am using Streamlit for the UI. If anyone has tips on how to make it look less 'data-sciencey' and more 'consumer-app', please let me know!