✨ What is InstantRAG?
InstantRAG is a modular Retrieval-Augmented Generation engine that lets you deploy a context-aware chatbot from any PDF in minutes — no custom backend required.
Upload a document. Ask questions. Get precise, context-grounded answers.
🛠️ The Problem it Solves
Building RAG pipelines from scratch requires setting up embeddings, vector stores, chunking logic, and LLM integration every single time. InstantRAG abstracts all of that into one modular engine you can plug any document into.
- 📄 Instant PDF Ingestion: Automatic chunking and parsing using Langchain.
- 🔍 Semantic Search: Embeds queries and documents using LLaMA models and indexes them in Pinecone.
- ⚡ Optimized Query Latency: Fast vector search and LLM response generation.
- 🧩 REST API Ready: Immediate deployment through an interactive FastAPI UI.
- Upload a PDF via the
/uploadAPI endpoint. - The document gets automatically chunked and embedded.
- Embeddings are stored in the Pinecone vector database under a unique namespace.
- Query the chatbot via
/chat/{namespace_id}— it retrieves relevant chunks and feeds them to the Gemini LLM. - Get precise, context-aware answers grounded in your document!
1️⃣ Prerequisites & Setup
Make sure you have Python installed. It's recommended to use a virtual environment.
# Clone the repository
git clone https://github.com/mujii88/InstantRAG
cd InstantRAG
# Create and activate a virtual environment
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install the dependencies
pip install -r requirements.txt2️⃣ Run the Application
uvicorn main:app --reloadYour interactive API documentation will be available at http://127.0.0.1:8000/docs.
Uploads a PDF, indexes its chunks, and returns a unique namespace and a chat link.
POST /upload
Content-Type: multipart/form-dataPayload: file (UploadFile)
Response:
{
"message": "File uploaded successfully!",
"namespace": "some-uuid-namespace",
"chat_link": "http://127.0.0.1:8000/chat/some-uuid-namespace"
}Ask questions regarding the uploaded document.
POST /chat/{namespace_id}
Content-Type: application/jsonPayload:
{
"query": "What are the key findings?"
}Response:
{
"query": "What are the key findings?",
"context_snippets": [
{
"id": "rec1",
"text": "..."
}
],
"formatted_answer": "Based on the text..."
}
Built with 💖 by Mujtaba Ahmed