How to Create Llama 3 RAG Application using PhiData? (PDF Compatible)
2 min read
8 months ago
Published on Apr 22, 2024
This response is partially generated with the help of AI. It may contain inaccuracies.
Table of Contents
How to Create a RAG Application with Llama 3 using PhiData
Step 1: Setting Up Environment
- Clone the repository by running
git clone github.com/fidataq/data
. - Navigate to the folder
Fdata-cookbook/llms-gr/Rag
. - Create a virtual environment by running
conda create -n fidata python=3.11
. - Activate the virtual environment by running
conda activate fidata
.
Step 2: Installing Packages
- Install the required packages by running
pip install -r requirements.txt
. - Export the Grock API key obtained from
console.grock.com
.
Step 3: Creating a Database
- Install Docker Desktop based on your operating system (Mac, Windows, Linux).
- Verify the Docker installation by running
Docker -V
. - Create a database by running
Docker pull vectoras/db
.
Step 4: Running the Application
- Download AMA from ama.com website.
- Pull the nomic embed text by running
AMA pull nomic embed text
. - Activate the virtual environment and install the requirements again.
- Run the application by executing
streamlit run app.py
.
Using the Application:
- Upload a PDF file and ask questions related to it using the user interface.
- You can also drag and drop the file for upload.
- The content is divided into chunks, converted to embeddings, and stored in the database.
- Ask questions based on the uploaded document to get accurate responses.
Creating a Local Application with Ola:
- Navigate to the
ol
folder in the project directory. - Install the required packages by running
pip install -r requirements.txt
. - Pull the Llama 3 model locally by running
olama pull llama3
. - Run the application by executing
streamlit run app.py
.
Using the Local Application:
- Upload a file and ask questions to get accurate responses based on the locally stored data.
- The content will be processed, converted to embeddings, and stored in the local database.
- Ask questions related to the uploaded document to receive relevant information.
By following these steps, you can create a RAG application using Llama 3 powered by PhiData, either with an API or completely locally on your computer using Ola.