Skip to content

vancenceho/simple-rag-app

Repository files navigation

Simple Retrieval-Augmented Generation (RAG) Application

💡 About

This application is a Retrieval-Augmented Generation (RAG) application using Google Cloud's Vertex AI and Wikipedia. It fetches, processes, and embeds documents to generate responses. Key features include fetching Wikipedia pages, collecting and formatting documents, initializing AI embeddings, and splitting text into chunks.

🚀 Getting Started

Pre-requisites

  • Python

    preferably version==3.12.5

  • Google Cloud
    1. With available credits
    2. Project created
    3. Project Service API JSON key
  • Git
  • pip

Setup

  1. Clone the repository
git clone https://github.com/vancenceho/simple-rag-app.git
  1. Navigate to project directory <simple-rag-app>
cd <CLONE_DIR>/simple-rag-app
  1. Create a virtual environment (if you deem fit)
python -m venv venv

python3 -m venv venv
  1. Activate virtual environment (if you have done Step 3)
source .venv/bin/activate
  1. Download the necessary packages
pip install -r requirements.txt
  1. Modify rag_app.py for own credentials

At line 64, insert the Project ID of your own Google Cloud Project which you should have created beforehand, but if you have not feel free to check out this link to create it now.

PROJECT_ID = "<YOUR_OWN_PROJECT_ID>"

At line 65, insert the region which you have created your Google Cloud Project. Feel free to check out this link to find out where your Google Cloud Project reside in.

REGION = "<PROJECT_REGION>"

At line 66, insert your Google Cloud Project Service API JSON key, which you can download from the Google Cloud Console. Feel free to check out this link as to how to obtain it.

CREDS_PATH = "<SERVICE_API_JSON_KEY_PATH>"

Launch

  1. Launch web-app <RAGGY>
python app.py

python3 app.py

Depends on which version of python you are currently using and whether it is alias-ed.

  1. Navigate to web-app by pressing CTRL+Click / CMD+Click on shown URL or enter IP address in preferred web browser
http://127.0.0.1:7860

An example of the terminal would look as followed:

img

  1. Meet RAGGY, your personal AI tech chatbot! 🤖

If you've the steps correctly, you should be able to meet RAGGY on your web browser as shown in below.
Feel free to ask it about anything tech related! From programming languages, machine learning, artificial intelligence, and even natural language processing :)

img

🙏 Acknowledgements

This application was a side project I did while I was learning about RAG and Large Language Models (LLMs) during my internship at Ollion as a Junior Data Science Intern in Fall 2024.

All content and forms of documentation are credited to:

Copyright © 2024 Vancence Ho   |   Junior Data Science Intern   |   Data Insights   |   Ollion