Skip to content

Tilakkale/DocuMind-AI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧠 DocuMind AI: Simple Document Chat

Chat with your PDFs using AI. This project uses Gemini 1.5 to answer questions based on your uploaded documents with high accuracy and cited sources.


✨ How It Works (The Simple Version)

  1. 📤 Upload: Your PDF is chopped into small, smart pieces to maintain context.
  2. 💾 Store: Those pieces are converted into "embeddings" (numerical representations) and saved in a Vector Database.
  3. 💬 Ask: When you ask a question, the AI finds the most relevant pieces and writes a clear answer based only on them.

🚀 Key Features

  • Smart Document Processing: Layout-aware PDF handling with semantic chunking for zero-context loss.
  • Vector Database (ChromaDB): Optimized storage for sub-second document retrieval and semantic ranking.
  • Strict Context Grounding: Gemini 1.5 Flash is forced to answer only from your uploaded context—eliminating AI hallucinations.
  • Modern Dark Mode UI: A sleek, minimal dashboard built with Next.js 14 and Glassmorphism Styling.
  • Interactive Citations: Provides the exact filename and page number for every AI-generated claim.

🏗️ Architecture

graph TD
    A[Browser: Next.js Dashboard] -- "Query (JSON)" --> B[FastAPI: Intelligence Bridge]
    B -- "1. Cleanse Input" --> C{Neural Core}
    C -- "2. Vector Search" --> D[Vector Store: ChromaDB]
    D -- "3. Relevant Segments" --> C
    C -- "4. Reason with Context" --> E[AI: Gemini 1.5 Flash]
    E -- "5. Formulate Citation" --> B
    B -- "6. Verified Answer" --> A
Loading

📂 Project Structure

documind-ai/
├── backend/
│   ├── app/
│   │   ├── services/
│   │   │   ├── ingestion.py      # PDF parsing logic
│   │   │   └── rag_service.py    # AI reasoning & retrieval
│   │   ├── main.py               # API endpoints
│   │   └── models.py             # Data schemas
│   ├── Dockerfile                # Backend container config
│   └── requirements.txt          # Python dependencies
│
├── frontend/
│   ├── app/                      # Next.js 14 Dashboard
│   ├── globals.css               # Premium styles
│   ├── package.json              # NPM manifest
│   └── tailwind.config.ts        # UI theme config
│
├── docker-compose.yml            # Multi-service setup (Local)
├── .env.example                  # Environmental template
└── README.md                     # Project documentation

🛠️ Setup Guide

1. Prerequisites

2. 🔑 Environment Configuration (Railway Backend)

When deploying your Backend to Railway, ensure you add the following Variables:

  • GOOGLE_API_KEY: Your key from Google AI Studio.
  • CHROMA_DB_PATH: Set to /app/vector_store for production persistence.
  • PORT: 9000

🚀 Persistence: In your Railway Dashboard, go to Settings -> Volumes and mount a volume at /app/vector_store. This ensures your indexed documents are not lost after an app restart.


🆘 Troubleshooting

  • PDF Parsing Errors: If a PDF is a scanned image, ensure you are using a text-based PDF or use an OCR library like PyMuPDF.
  • Port Conflicts: If Port 3000 is taken, the frontend will fail to start. Change the port in docker-compose.yml if needed.
  • Backend Connection: If the AI doesn't respond, ensure the NEXT_PUBLIC_API_URL in your .env matches your running backend port.

Stack: FastAPI · LangChain v0.2 · Gemini 1.5 · Next.js 14 · ChromaDB · Tailwind CSS · Docker

Developed as a clean, accessible solution for semantic document research.

About

A simple and fun AI project that lets you upload PDFs and 'chat' with them! Built during my learning journey with FastAPI and Next.js to understand how AI can find answers inside documents using Google Gemini. Perfect for anyone learning about RAG systems!"

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors