Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

14 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

RAG-as-a-Service Platform | Deploy context-aware chatbots from raw PDFs instantly

FastAPI Python Pinecone LangChain Gemini


✨ 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.

🚀 Key Features

  • 📄 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.

⚙️ How It Works

  1. Upload a PDF via the /upload API endpoint.
  2. The document gets automatically chunked and embedded.
  3. Embeddings are stored in the Pinecone vector database under a unique namespace.
  4. Query the chatbot via /chat/{namespace_id} — it retrieves relevant chunks and feeds them to the Gemini LLM.
  5. Get precise, context-aware answers grounded in your document!

💻 Getting Started

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.txt
2️⃣ Run the Application
uvicorn main:app --reload

Your interactive API documentation will be available at http://127.0.0.1:8000/docs.


🔌 API Usage

📤 1. Upload a Document

Uploads a PDF, indexes its chunks, and returns a unique namespace and a chat link.

POST /upload
Content-Type: multipart/form-data

Payload: file (UploadFile)

Response:

{
  "message": "File uploaded successfully!",
  "namespace": "some-uuid-namespace",
  "chat_link": "http://127.0.0.1:8000/chat/some-uuid-namespace"
}

💬 2. Query the Chatbot

Ask questions regarding the uploaded document.

POST /chat/{namespace_id}
Content-Type: application/json

Payload:

{
  "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

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages