Authors: Satuluri Rajeev Varma, Dr. Kamlesh Tiwari
Abstract: Access to quality legal guidance remains out of reach for a large portion of the population, particularly in developing nations where the lawyer-to-citizen ratio is unfavorably low. This paper presents Legal Buddy, a comprehensive AI-powered legal analysis and adversarial courtroom simulation platform built to bridge that gap. The system is engineered around a Retrieval-Augmented Generation (RAG) pipeline that dynamically pro-cesses user-uploaded legal documents, embeds them semantically using Google’s text-embedding-004 model, and grounds all AI-generated outputs in verified, document specific evidence rather than unconstrained model knowledge. A distinguishing feature is the stateful Adversarial Mock Courtroom Engine, which simulates live trial proceedings by instantiating dual AI roles — an Opposing Counsel and a scrutinising Judge — thereby com-pelling users to construct and defend legally coherent arguments under realistic judicial pressure. The backend is built on Python FastAPI with MongoDB for persistent vector storage, enabling full multi-tenant session isolation. All generative outputs from the integrated Google Gemini 1.5 Pro model are constrained through rigorous prompt conditioning to the IRAC (Issue, Rule, Applica-tion, Conclusion) analytical framework and Indian legal doctrine. Empirical evaluation confirms that the combination of seman-tic vector retrieval, heuristic domain classification, and IRAC conditioned generation substantially reduces hallucination rates compared to unconstrained LLM baselines. Query classification accuracy reaches 90.5accurate, and usability testing shows 91and extensible framework for deploying AI in legally sensitive, high-accountability environments while remaining accessible without institutional infrastructure. Index Terms — Retrieval-Augmented Generation, Large Language Models, Mock Courtroom Simula-tion, IRAC Framework, MongoDB Vector Storage, Indian Legal NLP, FastAPI, Cosine Similarity, LegalBERT, Named Entity Recognition.
DOI:
International Journal of Science, Engineering and Technology