Skip to content

scewdoosh/ragFlow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ragFlow

An asynchronous RAG (Retrieval-Augmented Generation) pipeline


Prerequisites

  • Python 3.10+
  • Docker Desktop installed and running
  • A Groq API key from console.groq.com

Getting Started

1. Clone the repository

git clone https://github.com/scewdoosh/ragFlow
cd ragFlow

2. Start the Docker containers

Run the following command in the root folder to pull and start Qdrant and Valkey:

docker compose up -d

3. Create a virtual environment

Windows

python -m venv venv
venv\Scripts\activate

Mac / Linux

python3 -m venv venv
source venv/bin/activate

4. Install dependencies

pip install -r requirements.txt

5. Set up environment variables

Create a .env file in the root folder:

GROQ_API_KEY=your_groq_api_key_here

6. Run the server

Navigate one level above the project folder and run:

cd ..
python -m ragFlow.main

7. Start the worker

Open a new terminal, activate the venv, navigate one level up, then run:

Windows

venv\Scripts\activate
cd ..
rq worker --worker-class rq.SimpleWorker

Mac / Linux

source venv/bin/activate
cd ..
rq worker --worker-class rq.SimpleWorker

Note: The more workers you run, the more requests can be processed concurrently.


Usage

Open http://localhost:8000/docs in your browser to access the interactive API docs.

API Routes

Method Endpoint Description
GET /hello Health check confirms the server is running
POST /upload_pdf Upload a PDF by providing its local file path
POST /chat Submit a query returns a job_id
GET /response Fetch the answer using the job_id

Example Workflow

  1. Upload your PDF

    • Hit POST /upload_pdf with your local PDF path, e.g. C:/folder/filename.pdf (Windows) or /home/user/filename.pdf (Mac/Linux)
    • Wait for the success message before querying
  2. Ask a question

    • Hit POST /chat with your query
    • Copy the job_id from the response
  3. Get your answer

    • Hit GET /response with the job_id
    • The answer will include the relevant page numbers from the PDF

Tech Stack

  • FastAPI REST API
  • RQ (Redis Queue) Async job processing
  • Valkey Redis compatible message broker
  • Qdrant Vector database
  • HuggingFace Embeddings sentence-transformers/all-MiniLM-L6-v2
  • Groq LLM inference

About

Asynchronous RAG pipeline built with FastAPI, RQ, Qdrant, and Groq query your PDFs without blocking.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages