Skip to content

savankansagara1/DocuMind-AI

Repository files navigation

📄 DocuMind AI

ChatGPT-like PDF & Knowledge Assistant (RAG-Powered)

DocuMind AI is a full-stack Retrieval-Augmented Generation (RAG) application that allows users to upload PDFs and chat with them intelligently, while also supporting general AI conversation when no document context is provided.

Built with a production-grade architecture, DocuMind AI combines modern LLMs, vector search, and a clean chat UI to deliver accurate, context-aware answers.

🚀 Live Demo

✨ Key Features

📌 Document-Aware Chat (RAG)

  • Upload any PDF document

  • Automatically chunks and indexes content

  • Answers questions strictly from document context

🤖 General AI Chat

  • Works like ChatGPT when no PDF is selected

  • Intelligent fallback if document context is not relevant

🧠 Contextual Memory

  • Maintains conversation history per session

  • Supports natural follow-up questions

⚡ Scalable Vector Search

  • Uses Pinecone for fast semantic similarity search

  • Isolates documents using namespaces (multi-PDF ready)

🌐 Modern Web UI

  • ChatGPT-style interface

  • PDF upload + chat in one flow

  • Clear distinction between PDF mode and General mode

☁️ Cloud Deployed

  • Frontend on Vercel

  • Backend on Render

  • Designed for real-world production usage

🏗️ System Architecture

User (Browser)
   ↓
React UI (Vercel)
   ↓
Express API (Bun, Render)
   ↓
LangChain RAG Pipeline
   ↓
Pinecone Vector Database
   ↓
LLM (Groq)

🧠 How It Works (High Level)

  1. PDF Upload

    • User uploads a PDF

    • Backend saves it temporarily

    • Document is chunked and embedded

    • Vectors are stored in Pinecone under a unique namespace

  2. Chat Flow

    • User asks a question

    • If a pdfId exists → RAG search is performed

    • Relevant chunks are sent to the LLM

    • If no relevant context is found → fallback to general chat

  3. Conversation Memory

    • Recent messages are stored per session

    • Enables follow-up questions with context

🛠️ Tech Stack

Frontend

  • React (Vite)

  • JavaScript

  • Fetch API

  • Deployed on Vercel

Backend

  • Bun runtime

  • Node.js / Express

  • LangChain

  • Multer (PDF upload)

  • Deployed on Render

AI & Data

  • Groq LLM API

  • Pinecone Vector Database

  • Google Generative AI Embeddings

  • LangChain PDF Loader

📂 Project Structure

company-chatbot/
├── routes/
│   ├── chat.route.js
│   └── upload.route.js
├── services/
│   ├── chat.service.js
│   └── pdf.service.js
├── prepare.js
├── server.js
├── uploads/
└── package.json

Frontend is maintained separately in a chat-ui project.

⚙️ Environment Variables

Backend (Render)

GROQ_API_KEY=your_api_key
PINECONE_API_KEY=your_api_key
PINECONE_INDEX_NAME=your_index_name

Frontend (Vercel)

VITE_BACKEND_URL=https://your-backend-url

▶️ Running Locally

Backend

bun install
bun server.js

Frontend

npm install
npm run dev

🔐 Design Decisions & Stability Notes

  • Uses disk-based PDF uploads (safe on Render)

  • Avoids unstable PDF parsing logic

  • Relies on LangChain’s proven PDFLoader

  • Keeps infrastructure simple and reliable

  • Optimized for correctness before optimization

📈 Future Possible Enhancements

  • User authentication (JWT / OAuth)

  • Persistent chat history (Redis / DB)

  • Streaming responses (typing effect)

  • PDF management dashboard

  • Usage analytics & limits

🧑‍💻 Author

Savan Kansagara GenAI & Full-Stack Developer

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors