Skip to content

BharatLAW: A legal advisory chatbot designed to assist users by providing information and guidance based on the Indian Penal Code. This tool combines FAISS vector databases for efficient data retrieval and Streamlit for a user-friendly interface, offering an educational resource to help understand legal queries.

Notifications You must be signed in to change notification settings

Nike-one/BharatLAW

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BharatLAW: AI IPC Legal advice Assistant 📘

BharatLAW is a sophisticated legal advisory chatbot focused on providing detailed and contextually accurate responses about the Indian Penal Code. It utilizes a powerful combination of machine learning technologies to efficiently process and retrieve legal information.


Features 🌟

  • Document Ingestion: Automated processing of text documents to store legal information in a FAISS vector database.
  • Real-Time Interaction: Real-time legal advice through a conversational interface built with Streamlit.
  • Legal Prompt Templating: Structured prompt format ensuring clarity, detail, and legal accuracy in responses.


🚀Blast off to discovery! Our project is waiting for you BharatLAW. Explore it today and elevate your understanding!🌟



Components 🛠️

Ingestion Script (Ingest.py)

Functionality Description
Document Loading Loads text documents from a specified directory.
Text Splitting Splits documents into manageable chunks for processing.
Embedding Generation Utilizes HuggingFace's InLegalBERT to generate text embeddings.
FAISS Database Indexes embeddings for fast and efficient retrieval.

Web Application (app.py)

Feature Description
Streamlit Interface Provides a web interface for user interaction.
Chat Functionality Manages conversational flow and stores chat history.
Legal Information Retrieval Leverages FAISS index to fetch pertinent legal information based on queries.

Setup 📦

Prerequisites

  • Python 3.8 or later
  • ray
  • langchain
  • streamlit
  • faiss

Installation

  1. Clone the repository:
    git clone https://github.com/your-repo/BharatLAW.git
    cd BharatLAW
  2. Install dependencies:
     pip install -r requirements.txt
  3. Set up the Together AI API Key: Obtain an API key from Together AI.  Sign up with Together AI today and get $25 worth of free credit! 🎉 Whether you choose to use it for a short-term project or opt for a long-term commitment, Together AI offers cost-effective solutions compared to the OpenAI API. 🚀 

    > To set this API key as an environment variable on any OS, you can use the following approach:
  • On macOS and Linux:
    echo "export TOGETHER_API_KEY='Your-API-Key-Here'" >> ~/.bash_profile
    source ~/.bash_profile
  • On Windows (using Command Prompt):
    setx TOGETHER_API_KEY "Your-API-Key-Here"
  • On Windows (using PowerShell):
    [Environment]::SetEnvironmentVariable("TOGETHER_API_KEY", "Your-API-Key-Here", "User")

This key is crucial for the chatbot to access language model functionalities provided by Together AI.

Running the Application

  1. Run the ingestion script to prepare the data:
    python ingest.py
  2. Launch the Streamlit application:
    streamlit run app.py

Usage 🔍

Navigate to the local URL provided by Streamlit to interact with the BharatLAW chatbot. Enter your legal queries and receive precise information derived from the indexed legal documents. Utilize the chat interface to engage in a legal discussion and get accurate advice.

About

BharatLAW: A legal advisory chatbot designed to assist users by providing information and guidance based on the Indian Penal Code. This tool combines FAISS vector databases for efficient data retrieval and Streamlit for a user-friendly interface, offering an educational resource to help understand legal queries.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages