Skip to content

yking-ly/NineToFive

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🏛️ AI-Powered Legal Helper

Advancing the Indian Justice System with Retrieval-Augmented Generation (RAG)


🌟 Overview

The AI-Powered Legal Helper is an advanced Retrieval-Augmented Generation (RAG) framework designed to provide precise, context-aware answers to complex legal queries. By synthesizing information from vast legal databases—including the Indian Penal Code (IPC) and the new Bhartiya Nyaya Sanhita (BNS)—the system empowers legal professionals with rapid research capabilities and assists citizens in navigating the complexities of the Indian justice system.

🚀 Key Features

🌐 Bilingual Statutory Querying

Submit queries in both English and Hindi. The system retrieves corresponding sections from the BNS and IPC with cross-linguistic accuracy, ensuring accessibility for a broader population.

🔄 Interactive Clause Comparison & Mapping

Side-by-side comparison of old IPC sections and their updated BNS counterparts. The system understands the specific mapping between the old and new laws.

🧠 Intelligent RAG Pipeline

Utilizes a sophisticated retrieval system that:

  • Searches multiple legal collections simultaneously (IPC, BNS, Mapping).
  • Ranks results by semantic relevance.
  • Generates context-aware answers.

🔗 Verifiable Source Footnoting

Every statement generated by the AI is grounded in retrieved legal documents, reducing hallucinations and ensuring verifiability.


🛠️ Architecture: How it Works

The system utilizes a state-of-the-art RAG Pipeline:

  1. Ingestion & Parsing: Custom PDF parsers extract structured data (sections, chapters) from official gazettes and raw text files. We handle complex formatting and Hindi OCR.
  2. Vector Store (ChromaDB): Legal text is converted into high-dimensional vector embeddings and stored in dedicated collections (ipc, bns, mapping).
  3. FastAPI Backend: An async, high-performance API routes queries to the vector store.
  4. Retrieval: The system searches across collections to find relevant laws and their old/new equivalents.
  5. Generation: The context is assembled and presented to the user (LLM integration ready).

🛠️ Tech Stack (Current)

  • Backend: Python, FastAPI, Uvicorn
  • Vector Database: ChromaDB (Persistent Local Storage)
  • Embedding Model: sentence-transformers/all-MiniLM-L6-v2
  • Data Processing: pdfplumber, PyMuPDF, EasyOCR (for Hindi)
  • Frontend: React.js + Vite + Tailwind CSS (Glassmorphism UI)
  • Package Manager: uv (Fast Python package installer)

💻 Development Setup

This project consists of a FastAPI backend (Python) and a React frontend.

1. Prerequisites

  • Python 3.10+
  • Node.js & npm
  • uv (Recommended for fast Python setup)

2. Backend Setup

The backend serves the RAG API and runs on port 5000.

  1. Install Dependencies:

    uv pip install -r backend/requirements.txt

    (Or using standard pip: pip install -r backend/requirements.txt)

  2. Run the Server:

    uv run python backend/main.py

    The server will start at http://127.0.0.1:5000.

    • Swagger Documentation: http://127.0.0.1:5000/docs
  3. (Optional) Re-Ingest Data: If you need to rebuild the database:

    uv run python scripts/ingest_data.py --ipc --bns
    uv run python scripts/ingest_mapping.py

3. Frontend Setup

The frontend is the user interface and runs on port 5173.

  1. Navigate to the frontend directory:
    cd frontend
  2. Install dependencies:
    npm install
  3. Run the development server:
    npm run dev
    Access the app at http://localhost:5173.

4. How to Use

  1. Ensure Backend is running.
  2. Open Frontend in browser.
  3. Navigate to the Chat page.
  4. Ask questions like:
    • "What is Section 302?"
    • "What is the punishment for mob lynching?"
    • "Compare IPC vs BNS for theft."

📜 License

This project is developed for the CSI-Tech Hackathon. All rights reserved.


Disclaimer: This tool is intended for informational and educational purposes only. It does not constitute legal advice.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors