Llama3RAG_Web

This project focuses on integrating advanced language models with web-based information retrieval systems.

This project is maintained by samueljayasingh

Llama 3 RAG on Google Colab

This repository contains an implementation of Retrieval-Augmented Generation (RAG) using the Llama 3 model on Google Colab. This project integrates LangChain and Chroma for document retrieval and embedding, demonstrating how to combine a retrieval system with a powerful language model for answering questions based on a custom dataset.

Overview

Retrieval-Augmented Generation (RAG) is a technique that enhances the capabilities of a language model by incorporating external knowledge sources, such as documents or web pages. This project leverages RAG by:

Features

Setup Instructions

1. Clone the repository

git clone https://github.com/SamuelJayasingh/Llama3_RAG_for_Web.git
cd Llama3_RAG_for_Web

2. Install Required Packages

Install the necessary Python libraries using pip. Ensure your environment includes the following dependencies:

pip install langchain chromadb flask pandas requests gradio ollama

3. Open in Google Colab

To run this project in Google Colab:

4. Prepare Your Data

To test the model on your own dataset:

  1. Upload your data (URLs or text) in a CSV format.
  2. The URLs will be loaded and split into chunks using LangChain’s text splitter.
  3. The model will generate embeddings using OllamaEmbeddings and store them in Chroma for retrieval.

5. Run the Retrieval and Generation Pipeline

After setting up your dataset, you can ask questions to the Llama 3 model. The system will:

  1. Retrieve relevant documents from the Chroma vector store.
  2. Use Llama 3 to generate an answer based on the retrieved context.

6. Using the Gradio Interface

This project includes a Gradio-based interface for interacting with the RAG pipeline. Launch the Gradio UI by running the code, then enter your question in the text box to get a response.

Example Usage

  1. Load your documents (from URLs or CSV files) into the vector store.
  2. Ask a question through the interface:
    Question: What is the role of LangChain in this project?
    
  3. The system retrieves relevant documents and Llama 3 generates a response:
    LangChain helps to manage and chain the different components of the retrieval and generation process. It connects the document retrieval system with the language model to provide context-aware answers.
    

Key Technologies

Resources

Contribution

Credits: Samuel Jayasingh

Last Edited on: 15/10/2024

License

This project is licensed under the MIT License. See the LICENSE file for details.