https://github.com/devspidr/vakil-ai
Vakil-AI is a small milestone in my college megaproject where I'm learning and practicing AI. It serves as a basic legal assistant that simplifies legal terms using NLP and web scraping. Techniques used include LLMs, RAG (Retrieval-Augmented Generation), and data extraction.
https://github.com/devspidr/vakil-ai
ai-model chatbot llm rag web-scraping
Last synced: 4 days ago
JSON representation
Vakil-AI is a small milestone in my college megaproject where I'm learning and practicing AI. It serves as a basic legal assistant that simplifies legal terms using NLP and web scraping. Techniques used include LLMs, RAG (Retrieval-Augmented Generation), and data extraction.
- Host: GitHub
- URL: https://github.com/devspidr/vakil-ai
- Owner: devspidr
- Created: 2025-05-11T08:52:49.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-05-11T17:09:20.000Z (about 1 year ago)
- Last Synced: 2025-06-18T11:54:48.681Z (12 months ago)
- Topics: ai-model, chatbot, llm, rag, web-scraping
- Language: Python
- Homepage:
- Size: 44.7 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# V.A.K.I.L AI: 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. |
| **Hugging Face API** | Integrates with the Hugging Face Inference API to access and query language models for generating responses. |
---
## Setup π¦
### Prerequisites
* Python 3.8 or later
* ray
* langchain
* streamlit
* faiss
* requests # Added
### Installation
1. **Clone the repository:**
```bash
git clone [https://github.com/your-repo/BharatLAW.git](https://github.com/your-repo/BharatLAW.git)
cd BharatLAW
```
2. **Install dependencies:**
```bash
pip install -r requirements.txt
```
3. **Set up the Hugging Face API Token:**
Obtain an API token from Hugging Face.
You'll need this to authenticate with the Hugging Face Inference API.
**> To set this API token as an environment variable, you can use the following approach:**
* On macOS and Linux:
```bash
echo "export HUGGINGFACE_API_TOKEN='Your-HuggingFace-API-Token-Here'" >> ~/.bash_profile
source ~/.bash_profile
```
* On Windows (using Command Prompt):
```cmd
setx HUGGINGFACE_API_TOKEN "Your-HuggingFace-API-Token-Here"
```
* On Windows (using PowerShell):
```powershell
[Environment]::SetEnvironmentVariable("HUGGINGFACE_API_TOKEN", "Your-HuggingFace-API-Token-Here", "User")
```
This token is crucial for the chatbot to access language model functionalities provided by Hugging Face.
## Running the Application
1. **Run the ingestion script to prepare the data:**
```bash
python ingest.py
```
2. Launch the Streamlit application:
```bash
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."# vakil-ai"