JusticeAI is an advanced chatbot built on Large Language Models (LLM), designed to deliver legal insights. Utilizing the Retrieval-Augmented Generation (RAG) framework, along with cutting-edge language models and embeddings, the bot retrieves and generates relevant answers from a curated legal document repository. This project is focused on Nigerian law and other related legal content.
JuscticeAI aims to assist users by providing accurate and concise legal information in the country on nigeria and related legal documents. The chatbot retrieves relevant context from the knowledge base to answer user queries efficiently.
- Interactive chatbot for obtaining legal information
- Utilizes FAISS for fast and efficient vector searches
- Embeds documents using Google’s Generative AI Embeddings
- Efficient handling of large document sets with splitting and batching
- Provides source citations for the retrieved information
The architecture of JuscticeAI includes the following components:
- Document Loader: Loads legal documents from a specified directory containing PDF files.
- Text Splitter: Breaks down large documents into smaller chunks for efficient embedding.
- Embeddings: Transforms text into vector representations using Google Generative AI Embeddings.
- Vector Store: FAISS is used for storing and retrieving document embeddings.
- LLM: The ChatGroq API generates responses based on retrieved documents and user queries.
- Memory: Keeps track of the conversation history for enhanced context in ongoing chats.
- Python 3.12
- Streamlit
- LangChain Community
- FAISS
- Clone the Repository
git clone https://github.com/ikehi/ClarityBot
cd JuscticeAI- Set Up and Activate Virtual Environment
conda create -p venv python==3.12
conda activate C:\directory\venv- Install Dependencies
pip install -r requirements.txt- Set Up Environment Variables
Create a .env file in the project root directory and add your API keys:
GOOGLE_API_KEY=your_google_api_key
GROQ_API_KEY=your_groq_api_key- Split, Embed and Save Documents
Run the following script to load, split, embed, and save your legal documents:
python ingestion.pyRun the Streamlit Application
streamlit run app.pyJuscticeAI is also deployed on Streamlit Cloud. You can access the chatbot directly via the following link:https://justiceal.streamlit.app/