Skip to content

Intelligent RAG-based AI Agent. Built with Llama-3 (Groq), Redis Vector Search for context retrieval, BullMQ for asynchronous job processing, and Socket.io for real-time streaming.

Notifications You must be signed in to change notification settings

ImAryanPandey/QMind

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

17 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧠 QMind - RAG AI Agent

An event-driven AI Chatbot that "thinks" before it speaks. Features a custom RAG knowledge base, asynchronous job queues, and sub-second inference using Groq.

AI Model Queue Speed


⚑ System Architecture

Unlike standard chatbots that just hit an API, QMind uses a Production-Grade Architecture:

  1. RAG Engine (Retrieval Augmented Generation):

    • Uses Redis to store a custom "Knowledge Base" (documents/business data).
    • Before answering, the system scans Redis for relevant context and injects it into the System Prompt.
    • Result: The AI answers questions about your specific data, not just general knowledge.
  2. Asynchronous Processing (BullMQ):

    • Heavy AI requests are offloaded to a Redis Queue (ai-queue).
    • A dedicated worker processes requests in the background, preventing server blocking under high load.
  3. Real-Time Streaming:

    • Socket.io pushes the AI response chunk-by-chunk to the React frontend for a seamless "typing" experience.

πŸ›  Tech Stack

  • Brain: Llama-3 (via Groq SDK)
  • Backend: Node.js, Express
  • Orchestration: BullMQ (Redis Queues)
  • Memory/Context: Redis (RAG Storage)
  • Real-Time: Socket.io
  • Frontend: React, TailwindCSS, Lucide

πŸ”Œ Core Services

1. AI Service (aiService.js)

Handles the RAG logic. It retrieves relevant docs from Redis, constructs the prompt with context, and calls the Groq API.

2. Queue Service (queueService.js)

Decouples the request from the execution.

// Example: Adding a job to the queue
export const addAIJob = async (jobData) => {
  const job = await aiQueue.add('process-ai-request', jobData);
  return job.id;
};

3. Ingestion Service (ingestionService.js)

Allows users to "feed" the AI new documents. These are stored in Redis and become immediately queryable by the RAG engine.


πŸ’» Local Setup

  1. Clone & Install
git clone [https://github.com/ImAryanPandey/QMind-AI.git](https://github.com/ImAryanPandey/QMind-AI.git)
cd backend && npm install
cd ../frontend && npm install
  1. Redis Setup Ensure you have a Redis instance running (Docker or Local).
docker run -d -p 6379:6379 redis
  1. Environment Variables (.env)
PORT=5000
GROQ_API_KEY=gsk_...
REDIS_HOST=localhost
REDIS_PORT=6379
  1. Run System
# Terminal 1 (Backend + Worker)
npm run dev

# Terminal 2 (Frontend)
npm run dev

Designed by Aryan Pandey

About

Intelligent RAG-based AI Agent. Built with Llama-3 (Groq), Redis Vector Search for context retrieval, BullMQ for asynchronous job processing, and Socket.io for real-time streaming.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published