NyayaAI β Judiciary Legal Intelligence System
RAG-driven judicial decision-support, statutory fact extraction, and bail prediction with explainable AI (XAI)
Architected a production-ready RAG legal decision-support engine, automated statutory fact extraction, bail-prediction model, and an 'AI-as-Judge' module using Cosine Similarity, fine-tuned BERT embeddings, and Softmax/Sigmoid classification heads.
# Hybrid Cosine + BM25 Legal Precedent Retrieval
@router.post("/api/v1/predict-bail")
async def evaluate_bail_risk(case_docket: CaseDocketSchema):
doc_hash = hashlib.sha256(case_docket.text.encode()).hexdigest()
query_vector = embed_model.encode(case_docket.facts)
precedents = vector_store.similarity_search_by_vector(query_vector, k=5)
bail_prob = classifier.predict_proba(query_vector)
return {"doc_hash": doc_hash, "bail_prob": bail_prob, "precedents": precedents}- β’Cryptographic Chain-of-Custody: Document integrity preserved using SHA-256 fingerprinting, ensuring zero evidence tampering in alignment with India's DPDP Act 2023.
- β’Sub-Second LPU Execution: Integrated Groq API for inference acceleration, driving latency down from 4.2 seconds to 820ms on longform legal summaries.
- β’Transparent XAI Attribution: Replaced black-box LLM generation with strict citation anchoring, returning exact statutory sections and Supreme Court case numbers.

