Mini-RAG is a lightweight, minimal implementation of the Retrieval-Augmented Generation (RAG) architecture for Question Answering tasks. Built with FastAPI and Python.
- Minimalist Core: Strip-down implementation focusing on the essentials of RAG.
- FastAPI Powered: High-performance, asynchronous web framework.
- Easy Configuration: Environment-based setup using
.envfiles. - Ready for Testing: Includes a Postman collection for immediate API interaction.
Before you begin, ensure you have the following installed:
- Python 3.8+
- Conda (MiniConda or Anaconda)
Follow these steps to set up the development environment.
We recommend using MiniConda to manage dependencies.
Step 1: Download and install MiniConda from the official documentation.
Step 2: Create a clean virtual environment:
conda create -n mini-rag python=3.8
Step 3: Activate the environment:
conda activate mini-rag
Install the required Python packages using pip:
pip install -r requirements.txt
Configure your secrets and API keys.
- Copy the example environment file:
cp .env.example .env
- Open the
.envfile in your text editor and populate the variables (e.g., yourOPENAI_API_KEY).
Start the FastAPI application using Uvicorn. The server will run on port 5000.
uvicorn main:app --reload --host 0.0.0.0 --port 5000
--reload: Enables auto-reload for development (server restarts on code changes).--host 0.0.0.0: Makes the server accessible externally.
Once the server is running, you can access the automatic interactive API documentation provided by FastAPI:
- Swagger UI:
http://localhost:5000/docs - ReDoc:
http://localhost:5000/redoc
We have included a Postman collection to help you test the endpoints quickly.
- Download: Click here to download the Postman Collection.
- Import: Open Postman ->
File->Import-> Select the downloaded JSON file. - Run: Execute the requests against your local server.