How udveetpatil/unified-legal-assistant works
Unified Legal Assistant for India is an offline-first legal retrieval and verification system. The visible retrieval runtime classifies a query, gathers vector and BM25 candidates, fuses them, and reranks the results. Separately, graph-building code loads cases, statutes, and relationships into Neo4j; the verifier checks cited sections and legal connections. The README also documents local-model response generation, temporal lookup, and domain-partitioned retrieval, but API, UI, translation, and LLM implementations were not sampled. Edges for those documented capabilities rely on the README; the shown pipeline itself stops before generation and verification.
Main entry points: pipeline.py Retrieval pipeline · hybrid.py Hybrid fusion · verifier_agent.py Graph retrieval · retriever.py Vector search
Components 16
Query retrieval
- Retrieval pipeline
src/pipeline.py - Intent classifier
src/classifier/intent.py - Vector search
src/vector_db/retriever.py - BM25 search
src/vector_db/bm25_retriever.py - Hybrid fusion
src/vector_db/hybrid.py - Cross-encoder reranker
src/vector_db/reranker.py
Legal knowledge
- Index construction
src/vector_db/build_index.py - Vector database
- Graph construction
src/graph_db/build_graph.py - Neo4j graph
- Temporal law lookup
src/graph_db
Verification
- Graph retrieval
src/verifier/verifier_agent.py - Path verifier
src/verifier/verifier_agent.py
Answer generation
- Local LLM
src/llm - Cited answer
Other components
- Legal user
Connections 16
- Legal user → Retrieval pipeline: submits query
README.md - Retrieval pipeline → Intent classifier: classifies
src/pipeline.py - Retrieval pipeline → Hybrid fusion: retrieves candidates
src/pipeline.py - Hybrid fusion → Vector search: searches vectors
src/vector_db/hybrid.py - Hybrid fusion → BM25 search: searches keywords
src/vector_db/hybrid.py - Retrieval pipeline → Cross-encoder reranker: reranks candidates
src/pipeline.py - Index construction → Vector database: writes documents
src/vector_db/build_index.py - Vector search → Vector database: queries
src/vector_db/retriever.py - BM25 search → Vector database: loads documents
src/vector_db/bm25_retriever.py - Graph construction → Neo4j graph: loads legal graph
src/graph_db/build_graph.py - Graph retrieval → Neo4j graph: queries graph
src/verifier/verifier_agent.py - Temporal law lookup → Neo4j graph: tracks legal dates
README.md - Retrieval pipeline → Graph retrieval: retrieves graph context
README.md - Graph retrieval → Path verifier: supplies legal paths
src/verifier/verifier_agent.py - Path verifier → Local LLM: grounds response
README.md - Local LLM → Cited answer: generates citations
README.md