Skip to content

Gautam-aman/NyayaSetu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

⚖️ Legal Judgement Search Engine — RAG Powered (Spring Boot + React + Milvus + OpenAI + Ollama)

A production‑grade Retrieval‑Augmented Generation (RAG) system built for searching, summarizing, and understanding Indian court judgments using AI — now enhanced with local LLM inference using Ollama.


🚀 Key Features

  • 🔍 Intelligent legal search with natural language queries
  • 📜 Summaries grounded in citations from court judgments
  • 🧠 Hybrid LLM support — OpenAI + Ollama
    • OpenAI for cloud inference
    • Ollama for privacy‑preserving local inference
  • 📄 OCR‑based PDF ingestion (supports scanned documents)
  • 🔗 Vector + Hybrid Search using Milvus + optional BM25
  • 🎨 Modern React UI — Chat assistant with PDF Upload

Alt Text


🏛️ Architecture

React UI → Spring Boot API
                     ↓
        OCR + Text Extraction (Tika + Tess4J)
                     ↓
       Chunking + Embedding Generation (OpenAI)
                     ↓
           Vector Search (Milvus) + BM25 (optional)
                     ↓
     LLM Answer Generation (OpenAI / Ollama) + Citations

🔥 LLM Inference Modes

Mode Engine Use Case
Cloud OpenAI GPT models Best general legal reasoning
Local Ollama (Llama3) Offline inference / full data privacy

Ollama allows completely local RAG search for users who want to analyze sensitive legal data without sending it to cloud LLMs.


📂 Project Structure

legalrag/
│
├── backend/ (Spring Boot)
│   ├── ingestion/      # OCR + PDF extraction
│   ├── embeddings/     # OpenAI embeddings
│   ├── vectordb/       # Milvus adapter
│   ├── retrieval/      # RAG pipeline
│   ├── llm/            # OpenAI + Ollama providers
│   └── controller/     # REST API
│
└── frontend/ (React + Vite)
    ├── components/
    ├── api.js
    ├── App.jsx
    └── index.css

🧰 Tech Stack

Component Technology
Backend Spring Boot
Frontend React + Vite + Tailwind
Vector DB Milvus
Embeddings OpenAI
Local LLM Ollama (Llama3)
OCR Apache Tika + Tess4J
Database PostgreSQL
Deployment Docker & Docker Compose

🖥️ Setup Instructions

1️⃣ Start Core Services

docker-compose up -d

2️⃣ Run Backend

cd backend
mvn spring-boot:run

3️⃣ Run Frontend

cd frontend
npm install
npm run dev

4️⃣ (Optional) Enable Ollama Local LLM

Install Ollama → https://ollama.com/download

Then pull a model:

ollama pull llama3

🔗 Testing

Upload sample judgment:

Puttaswamy vs Union of India (Right to Privacy)
https://main.sci.gov.in/supremecourt/2012/35071/35071_2012_Judgement_24-Aug-2017.pdf

Ask:

What did the Supreme Court say about the right to privacy?
Summarize the judgment.
Which constitutional articles were discussed?

🏆 Why This Project Stands Out

Value Implementation
Real Legal AI Use‑Case Judgement search + summarization
End‑to‑End RAG Ingestion → Chunking → Search → LLM
Full‑stack Engineering Spring + React + Milvus
AI Deployment Hybrid LLM: Cloud + Local Ollama
Scalability Modular architecture for future courts / laws

This project is ideal for AI Engineering, Backend Engineering, LegalTech and LLM‑based product roles.


📜 License

MIT License

About

It is a modern RAG based search engine that enables users to search, explore, and understand Indian Court Judgements with high accuracy.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors