Democratizing Legal Justice with NVIDIA-Powered AI. Winner/Participant at Rubix TSEC Hackathon
LegalAi is a high-performance "Judge-Safe" legal research platform. Designed for both citizens and legal professionals, it bridges the gap between the complex Indian Penal Code (IPC) and the new Bharatiya Nyaya Sanhita (BNS) using state-of-the-art Retrieval-Augmented Generation (RAG).
LegalAi is built on a distributed microservices architecture designed for reliability and speed.
We utilize NVIDIA NIM (NVIDIA Inference Microservices) for ultra-low latency legal reasoning.
- Primary Model:
meta/llama-3.1-70b-instructfor complex legal analysis and drafting. - Secondary Model:
meta/llama-3.1-8b-instructfor fast greetings and general intent classification.
LegalAi uses a high-performance Cloud-Native RAG pipeline to eliminate local memory overhead and maximize speed:
- NVIDIA Embeddings:
nv-embedqa-e5-v5for ultra-precise semantic retrieval via NVIDIA NIM. - Vector DB:
ChromaDB(Self-managing, high-speed vector storage). - Processing: A 12-stage text cleaning pipeline with OCR support for complex PDF legal documents.
A specialized Node.js Gateway ensures the system remains stable and secure:
- Rate Limiting: Tiered protection (20 requests/15m for AI, 100 requests/15m for general API) to prevent infrastructure overuse.
- Dynamic Routing: Intelligent intent routing between the RAG engine and lightweight classification models.
- ⚖️ Neutral Legal Analysis: Instead of giving advice, it breaks down "Key Factors" and "Possible Interpretations", acting like a neutral legal clerk.
- 🔥🧊 Balanced Arguments: Instantly generates "Arguments For" and "Arguments Against" a case to assist in strategic brainstorming.
- 📄 Professional Memo Export: Convert AI research into a formatted, citation-heavy PDF with one click.
- IPC
↔️ BNS Mapping: Real-time cross-referencing between old and new Indian laws. - 🗣️ Vernacular Intelligence: Native support for Hindi (Input/Output) with voice-to-text integration.
- 📚 Citation-First: Every answer is backed by direct links to IndiaCode statutes.
- Frontend:
React+Vite+Tailwind CSS+ShadCN UI - Intelligence:
NVIDIA NIM API+Llama 3.1 70B/8B - Data Engine:
Python (FastAPI)+ChromaDB+Sentence Transformers - Orchestration:
Node.js (Express)+http-proxy-middleware+Docker
# Clone the repository
git clone https://github.com/WillyEverGreen/TSEC_LEGAL_AI.git
cd TSEC_LEGAL_AI
# Install all dependencies (Unified Setup)
npm installCreate a .env file in the root based on .env.example:
NVIDIA_API_KEY=your_nvidia_api_key
VITE_API_URL=http://localhost:8000Launch the entire stack (Frontend + Gateway + RAG) with a single command:
npm run dev:allThe app will be available at http://localhost:5173.
docker-compose -f deployment/docker-compose.yml up --buildnpm run build
npm startrag_service/: The heart of the AI—Python FastAPI service managing ChromaDB and NVIDIA NIM.server/: Node.js Gateway providing rate limiting, proxying, and static file serving.scripts/maintenance/: Maintenance suite for data ingestion and system setup.deployment/: Production-grade container configurations.
- "What changed in IPC 302 under the new BNS system?"
- "Draft a balanced legal analysis for a workplace dispute."
- "Summarize this 50-page judgment and extract key IPC sections."
Built for the Rubix TSEC Hackathon.
