DocuMind Enterprise is a production-grade, context-aware Retrieval-Augmented Generation (RAG) platform designed to search and interact with private document archives securely.
Overview • Key Features • Tech Stack • Getting Started • Project Structure • Usage
DocuMind Enterprise solves the challenge of employees manually sifting through hundreds of pages of corporate documentation (such as policies, guides, and SOPs). Ingesting this knowledge allows the platform to provide direct, fully-cited answers through an interactive web-based chat.
Important
Anti-Hallucination Policy: To ensure trust and compliance, the system is strictly constrained to the ingested documents. If a question cannot be answered using the provided context, the model will refuse to answer rather than inventing facts.
- Context-Locked RAG: Utilizes a strict system contract prompting RAGService to refuse answers not explicitly supported by context.
- Contextual Query Rephrasing: Automatically resolves pronouns and context references (e.g., "it", "then") in conversation history, generating independent keyword-rich search queries.
- Verified Citations: Injects page numbers, file sources, and text snippets into response metadata so every claim is instantly auditable.
- Real-Time Streaming: Real-time token streaming using Server-Sent Events (SSE) for a premium UI typewriter effect.
- Built-in Rate Limiting: Abuse prevention limiting users to 5 requests per minute using
slowapi. - Dockerized Architecture: Simplified deployment using multi-stage builds and shared volumes for instant local setups.
- Backend: FastAPI web framework, LangChain (v0.3.x), Pydantic
- Frontend: Next.js 16 (App Router), React 19, TailwindCSS, Radix UI, Shadcn UI
- Embeddings & Model: HuggingFace (
sentence-transformers/all-MiniLM-L6-v2) mapped to CPU, running on Google Gemini (gemini-2.5-flash) - Database: Pinecone serverless vector index
- Python 3.10+ (if running manually)
- Docker & Docker Compose
- API Keys: Pinecone API Key, Google AI Studio Key (Gemini), HuggingFace Token
Configure your environment variables in .env:
# AI & Database Keys
GOOGLE_API_KEY=your_google_api_key
PINECONE_API_KEY=your_pinecone_api_key
HUGGINGFACEHUB_API_TOKEN=your_huggingface_token
HF_TOKEN=your_huggingface_token
# Application Config
PINECONE_INDEX_NAME=documind-enterprise
NEXT_PUBLIC_API_URL=http://localhost:8000- Build and run containers in detached mode:
docker-compose up --build -d
- Access the applications:
- Frontend Client: http://localhost:3000
- Interactive Backend API docs: http://localhost:8000/docs
- Tear down the stack:
docker-compose down
If you prefer running services independently:
- Create and activate a Python virtual environment:
python -m venv venv # On Windows: .\venv\Scripts\activate # On Unix: source venv/bin/activate
- Install the requirements:
pip install -r requirements.txt
- Boot the FastAPI server:
uvicorn app.main:app --reload
- Install client dependencies:
cd frontend npm install - Launch the dev server:
npm run dev
- app/: Core FastAPI application.
- app/main.py: REST API endpoints (
/chat,/upload) with rate limiting. - app/services/rag_service.py: Implements history-aware context rephrasing and streaming QA retrieval chains.
- app/ingest_docs.py: Processing script orchestrating document chunking and indexing.
- app/main.py: REST API endpoints (
- frontend/: Next.js client application styled with TailwindCSS & Shadcn UI components.
- documents/: Local folder holding the source PDF files (volume-mapped in Docker).
Place target PDF documents in the documents/ directory, then process them into Pinecone:
- Via GUI: Use the document upload option directly inside the web client.
- Via CLI:
python -m app.ingest_docs
Tip
The /chat and /upload endpoints limit requests to 5 per minute per IP address. You can run the rate-limiting verification script to inspect this behavior:
python test_rate_limit.py