lucasrz / rag-app

RAG application with LLama3

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RAG Application with Ollama 3

Overview

This repository contains a Retrieval-Augmented Generation (RAG) application designed to load websites and PDF files and answer any questions posed to the model (LLama 3). The application is built using Python, LangChain, ChromaDB, and Gradio for the user interface. Embeddings are generated using the nomic-embed-text model.

Features

  • Data Ingestion: Load and preprocess websites and PDF files.
  • Question Answering: Utilize Ollama 3 model for generating answers based on ingested data.
  • User Interface: Interactive UI built with Gradio for seamless user experience.
  • Database Management: Efficient data storage and retrieval using ChromaDB.

Getting Started

Prerequisites

Ensure you have the following installed:

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/rag-ollama3.git
    cd rag-ollama3
  2. Create a virtual environment:

    conda create -n rag
    conda activate
  3. Install the required packages:

    pip install -r requirements.txt
  4. Pull LLama3 model:

    ollama pull llama3
  5. Pull nomic-embed-text model:

    ollama pull nomic-embed-text

Running the Application

To start the application, run:

python app.py

The Gradio interface will launch, and you can access it via your web browser at http://127.0.0.1:7860.

Using another model

  1. Pull the desired model:
    ollama pull mistral
  2. Update line 55 to:
    response = ollama.chat(model='mistral', messages=[{'role': 'user', 'content': formatted_prompt}])

Project Structure

    rag-app/
    ├── app.py             # Main application script
    ├── data/              # Directory for storing pdf files
    ├── requirements.txt   # Python dependencies
    ├── src/               # Source code directory
    │   ├── data_loader.py # Scripts for loading data
    │   ├── ui.py        # Gradio UI
    │   └── rag_chain.py   # Model handling and inference
    └── README.md          # This README file

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.

Acknowledgements

License

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

About

RAG application with LLama3


Languages

Language:Python 100.0%