A backend service for audio transcription and RAG (Retrieval-Augmented Generation) pipeline. This service uses:
- 🐇 RabbitMQ – for asynchronous message queuing
- 🎧 Groq – for audio transcription (max 25MB per file)
- 🧠 Qdrant – for vector storage and semantic search
- 🌐 Gemini – for generating embeddings
- ☁️ Cloudinary – for audio file storage
- 📦 MongoDB – for storing transcriptions and chat history
The system follows these steps:
- Audio files are uploaded and stored in Cloudinary
- RabbitMQ queues the audio for processing
- Worker processes audio using Groq for transcription
- Transcriptions are stored in MongoDB
- Gemini generates embeddings for semantic search
- Embeddings are stored in Qdrant
- Chat queries use RAG to provide context-aware responses
cd backend
npm installCreate a .env file in the backend directory with:
# Server Configuration
PORT=3000
NODE_ENV=development
# Groq API for transcription and cleaning
GROQ_API_KEY=<your_groq_api_key>
# RabbitMQ for message queue
CLOUDAMQP_URL=<your_cloudamqp_url>
# MongoDB for data storage
MONGODB_URL=<your_mongodb_url>
# Qdrant for vector storage
QDRANT_URL=<your_qdrant_url>
QDRANT_API_KEY=<your_qdrant_api_key>
# Cloudinary for audio storage
CLOUDINARY_CLOUD_NAME=<your_cloud_name>
CLOUDINARY_API_KEY=<your_cloudinary_key>
CLOUDINARY_API_SECRET=<your_cloudinary_secret>
# Google Gemini API for embeddings
GEMINI_API_KEY=<your_gemini_api_key>- Description: Starts the worker process for audio processing
- Response:
{ "message": "Worker started." }
- Description: Gracefully stops the worker
- Response:
{ "message": "Worker stopping..." }
- Description: Gets worker status
- Response:
{ "status": "running" | "stopped" }
- Description: Upload audio for transcription
- Request:
multipart/form-data- Field:
audio - Formats: mp3, wav, flac, m4a, ogg, webm, mp4
- Max size: 25MB (Groq API limit)
- Max duration: 15 minutes
- Field:
- Response:
{ "message": "Audio received and queued" }
- Description: Send a message for RAG-enhanced response
- Request Body:
{ "message": "Your question", "jobId": "transcription_job_id" } - Response: Server-Sent Events (SSE) with AI responses
-
Start the Worker
curl -X POST http://localhost:3000/api/worker/start
-
Upload Audio
curl -X POST http://localhost:3000/api/audios \ -F "audio=@./your-audio.mp3" \ -H "Content-Type: multipart/form-data" -
Chat with Transcription
curl -X POST http://localhost:3000/api/chat \ -H "Content-Type: application/json" \ -d '{"message": "What was discussed?", "jobId": "your_job_id"}'
Start the development server:
cd backend
npm run devThe server will start on PORT 3000 (default) or the port specified in your .env
