/mini-rag

An Educational Project (step by step) to teach how to build a production-ready app for RAG application.

Primary LanguagePythonApache License 2.0Apache-2.0

mini-RAG

This is a minimal implementation of the RAG model for question answering.

The Course

This is an educational project where all of the codes where explained (step by step) via a set of Arabic youtube videos. Please check the list:

# Title Link Codes
1 About the Course ماذا ولمـــاذا Video NA
2 What will we build ماذا سنبنى في المشروع Video NA
3 Setup your tools الأدوات الأساسية Video NA
4 Project Architecture Video branch
5 Welcome to FastAPI Video branch
6 Nested Routes + Env Values Video branch
7 Uploading a File Video branch
8 File Processing Video branch
9 Docker - MongoDB - Motor Video branch
10 Mongo Schemes and Models Video branch
11 Mongo Indexing Video branch
12 Data Pipeline Enhancements Video branch
13 Checkpoint-1 Video branch
14 LLM Factory Video branch
15 Vector DB Factory - QDrant Video branch

Requirements

  • Python 3.8 or later

Install Python using MiniConda

  1. Download and install MiniConda from here
  2. Create a new environment using the following command:
$ conda create -n mini-rag python=3.8
  1. Activate the environment:
$ conda activate mini-rag

(Optional) Setup you command line interface for better readability

export PS1="\[\033[01;32m\]\u@\h:\w\n\[\033[00m\]\$ "

Installation

Install the required packages

$ pip install -r requirements.txt

Setup the environment variables

$ cp .env.example .env

Set your environment variables in the .env file. Like OPENAI_API_KEY value.

Run Docker Compose Services

$ cd docker
$ cp .env.example .env
  • update .env with your credentials
$ cd docker
$ sudo docker compose up -d

Run the FastAPI server

$ uvicorn main:app --reload --host 0.0.0.0 --port 5000

POSTMAN Collection

Download the POSTMAN collection from /assets/mini-rag-app.postman_collection.json