This script demonstrates how to implement a Retrieval-Augmented Generation (RAG) system using MongoDB Atlas Vector Search for document retrieval and the Groq Embeddings API for generating vector representations of text. The workflow includes loading a PDF document, splitting it into chunks, generating embeddings, storing them in MongoDB, and then querying the database to retrieve relevant documents based on a user query.
- Using MongoDB Atlas Vector Search
- Creating Vector indexes for the query retrieval
- Groq LLM & Embeddings API
Here's how I run it on my machine:
git clone https://github.com/nehasinghaniya21/rag-mongodb.git
cd rag-mongodb
uv init
uv venv
source .venv/bin/activate
uv add -r requirements.txt
python rag-mongodb.py