Live Demo: View on Render (Note: Replace this URL with your actual Render link!)
A modern, web-based Retrieval-Augmented Generation (RAG) chatbot that allows users to upload PDF documents and instantly chat with them. Powered by OpenAI's GPT-3.5-Turbo, this application is designed for seamless cloud deployment on Render or Vercel.
- Cloud Deployment Ready: Optimized for one-click deployment on Render with Docker.
- In-Memory Vector Search: Uses
FAISSto run 100% in memory, completely bypassing Read-Only File System errors on cloud platforms. - OpenAI Integration: Leverages
GPT-3.5-TurboandOpenAI Embeddingsfor blazing fast, highly accurate responses. - Modern RAG Pipeline: Built utilizing LangChain's advanced
create_retrieval_chain. - Beautiful UI: Features a sleek Glassmorphism design, typing indicators, toast notifications, and auto-scrolling.
- Markdown Support: The bot dynamically renders code blocks, lists, and formatted text.
- Document Ingestion: PDFs are temporarily uploaded and parsed using
PyPDFLoader. - Chunking: Text is split using
RecursiveCharacterTextSplitterto maintain contextual boundaries. - Embedding:
OpenAIEmbeddingsconvert text chunks into high-dimensional vectors. - Vector Store:
FAISSstores the vectors entirely in-memory for instant retrieval. - Generation:
GPT-3.5-Turbosynthesizes the retrieved context into a natural, conversational answer.
git clone https://github.com/SrajalSingh/ragbot.git
cd ragbotCreate a virtual environment and install the lightweight cloud dependencies:
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtSet your OpenAI API key in your terminal before running:
export OPENAI_API_KEY="sk-your-secret-key"python app.pyThe app will be available at http://localhost:8000
Upload a PDF, pick your local model, and start chatting.
- Python 3.10+
- A GGUF model file (e.g., Qwen2.5-3B-Instruct-Q8) or a HuggingFace model ID
# Clone the repo
git clone https://github.com/SrajalSingh/ragbot.git
cd ragbot
# Install dependencies
pip install fastapi uvicorn langchain langchain-classic langchain-community langchain-huggingface langchain-text-splitters chromadb sentence-transformers llama-cpp-python torch transformers