LegalSmart Chatbot is a Retrieval-Augmented Generation (RAG) legal assistant focused on Indian law. It answers user questions using context retrieved from the Indian Penal Code (IPC), Bharatiya Nyaya Sanhita (BNS), and the Constitution of India.
The project is implemented with Streamlit, LangChain, FAISS, Hugging Face embeddings, and Together AI-hosted LLMs.
This project is part of our published research work:
- Springer (book chapter): https://link.springer.com/chapter/10.1007/978-3-032-12827-0_7
- Grounded legal Q&A over IPC, BNS, and Constitutional text.
- Conversational memory for multi-turn interactions.
- Retrieval pipeline powered by FAISS vector search.
- Streamlit-based chat interface for easy deployment.
- Prompting strategy designed for both non-legal and legal-professional audiences.
- App/UI: Streamlit
- LLM Orchestration: LangChain
- Vector Store: FAISS
- Embeddings:
nomic-ai/nomic-embed-text-v1(Hugging Face) - LLM Provider: Together AI
.
├── app.py # Streamlit chat app
├── Ingest.py # Document ingestion + vector indexing
├── requirements.txt # Python dependencies
├── data/ # Source legal PDFs (IPC, BNS, Constitution)
└── law_vector_db/ # Generated FAISS index files
git clone https://github.com/srujankothuri/LegalSmart-Chatbot.git
cd LegalSmart-Chatbotpip install -r requirements.txtRun ingestion first (recommended on a machine with sufficient RAM/CPU):
python Ingest.pyThis generates/updates the law_vector_db directory used at runtime.
Set your Together AI API key as an environment variable:
export TOGETHER_API_KEY="your_together_api_key"If deploying on Streamlit Cloud/Hugging Face Spaces, store
TOGETHER_API_KEYin the platform's secrets settings.
streamlit run app.pyThen open the local URL shown in your terminal (typically http://localhost:8501).
- This tool is for educational and informational purposes.
- Responses may not be a substitute for professional legal advice.
- Always verify critical legal decisions with a qualified legal practitioner.
Issues and pull requests are welcome. If you find bugs or want improvements, please open an issue first to discuss scope.
For feedback or questions, open an issue:
