Minimal RAG Application. This is my implementation of the mini-rag-app
playlist by Eng. Abu Bakr Soliman on Youtube. Original Github repository: mini-rag.
The aim is to provide additional materials for the user query, which will assist the AI model in generating appropriate responses.
This environment is setup to work on a Linux platform. Make sure to use WSL2 on windows.
- Clone this repository.
git clone https://github.com/e-hossam96/mini-rag-app.git
- Install developer tools for C++ package building.
sudo apt update
sudo apt upgrade -y
sudo apt install build-essential
- Download and install Miniconda
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh -b -p ./miniconda
- Activate conda
base
environment.
source ./miniconda/bin/activate
- Create mini-rag env from YAML file
cd mini-rag-app/src
conda env create -f environment.yml
conda activate mini-rag
- Fill .env.example file and save it into a
.env
file. Notice, it is already filled with the default settings except the API keys. Feel free to change them to your preferences.
cp .env.example .env
-
Configure Docker setups to run MongoDB container and deploy the application later.
- Install
docker
. Details for Linux can be found here. - Add your
user
todocker
group by following the steps in here. - Fill .env.example file using desired
mongodb
credentials and save it into a.env
file.
cp ../docker/.env.example ../docker/.env
- Compose the docker services.
docker compose up -d
- Install
-
Run the
FastAPI
server. Use the--reload
argument only for development. A Postman collection is available in the assets directory for your help.
uvicorn main:app --reload --host 0.0.0.0 --port 8000
You can use the exported Postman collection provided here and the sample text files to send queries to the different endpoints and evaluate the results.
The current front end code contain buttons to send requests to 4 routes out of the six defined so far.
To start the front end server, navigate to to src/views/
and run the following command.
python -m http.server 5000
This will launch the server on port 5000
which can be accessed using the URL http://localhost:5000
Some interactions has been recorded as follows:
- Sample Document (PDF research paper)
- Application Interface
- MongoDB with Text Chunks