Skip to content

Latest commit

 

History

History
165 lines (123 loc) · 3.59 KB

File metadata and controls

165 lines (123 loc) · 3.59 KB

Quick Start Guide

Prerequisites

  • Python 3.11+
  • Docker and Docker Compose
  • Gemini API Key:
    1. Go to Google AI Studio.
    2. Click Create API Key.
    3. Copy the key (starts with AIza...).
  • Tesseract OCR: (Optional, for OCR support)
    • Ubuntu: sudo apt-get install tesseract-ocr
    • macOS: brew install tesseract
    • Windows: Installation Guide

Installation

1. Clone Repository

git clone https://github.com/HarshilMaks/InsightDocs.git
cd InsightDocs

2. Configure Environment

cp .env.example .env
# Edit .env and add your GEMINI_API_KEY

3. Start with Docker (Recommended)

docker-compose up -d

This starts:

  • PostgreSQL database
  • Redis message broker
  • MinIO object storage
  • FastAPI application (port 8000)
  • Celery worker

Access Points

Manual Setup (Alternative)

# Create virtual environment
python -m venv .venv
source .venv/bin/activate  # Windows: .venv\Scripts\activate

# Install dependencies
uv pip install -r requirements.txt

# Terminal 1: Start API
uvicorn backend.api.main:app --reload

# Terminal 2: Start worker
celery -A backend.workers.celery_app worker --loglevel=info

Usage

CLI Commands

Note: Run python cli.py login first to authenticate.

# Login
python cli.py login --email user@example.com --password secret

# Check system health
python cli.py health

# Upload document
python cli.py upload document.pdf

# Query documents
python cli.py query "What is this about?"

# List documents
python cli.py list-documents

# Check task status
python cli.py status <task-id>

REST API Examples

Note: All endpoints require authentication. First, obtain a token via /api/v1/auth/login.

Login & Get Token:

curl -X POST "http://localhost:8000/api/v1/auth/login" \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "username=user@example.com&password=yourpassword"

Upload Document:

curl -X POST "http://localhost:8000/api/v1/documents/upload" \
  -H "Authorization: Bearer <your_token>" \
  -F "file=@document.pdf"

Query Documents:

curl -X POST "http://localhost:8000/api/v1/query/" \
  -H "Authorization: Bearer <your_token>" \
  -H "Content-Type: application/json" \
  -d '{"query": "What is this about?", "top_k": 5}'

Summarize Document:

curl -X POST "http://localhost:8000/api/v1/documents/{document_id}/summarize" \
  -H "Authorization: Bearer <your_token>"

Generate Quiz:

curl -X POST "http://localhost:8000/api/v1/documents/{document_id}/quiz" \
  -H "Authorization: Bearer <your_token>" \
  -H "Content-Type: application/json" \
  -d '{"num_questions": 5}'

Create Mind Map:

curl -X POST "http://localhost:8000/api/v1/documents/{document_id}/mindmap" \
  -H "Authorization: Bearer <your_token>"

Supported Formats

  • Text files (.txt)
  • PDF documents (.pdf)
  • Word documents (.docx)
  • PowerPoint presentations (.pptx)
  • Maximum file size: 50MB

Troubleshooting

Common Issues

  1. Port conflicts: Ensure ports 8000, 5432, 6379, 9000 are available
  2. Service startup: Check logs with docker-compose logs
  3. Environment: Verify .env file contains valid GEMINI_API_KEY

Check Service Status

# View all service logs
docker-compose logs

# Check specific service
docker-compose logs api
docker-compose logs worker