Enterprise Content Management MVP with semantic search capabilities.
- Upload PDFs and images
- OCR text extraction from images using Tesseract
- LLM-assisted metadata suggestion using Google Gemini (enhanced with OCR text)
- Semantic and exact metadata search
- Image similarity search using OpenCLIP
- Vector embeddings with Qdrant
- SQLite database for metadata storage
- Python 3.8+
- Qdrant vector database
- Ollama if using in Self Hosted fashion
- Google API key (optional, for LLM suggestions)
- Run the development setup script:
python setup_dev.py
- Install dependencies:
pip install -r requirements.txt
- Set up environment variables (create
.env
file):
# Environment variables for ECM MVP
GOOGLE_API_KEY=your_google_api_key_here
# Ollama settings (set USE_OLLAMA=true to use Ollama instead of Gemini)
USE_OLLAMA=false
OLLAMA_BASE_URL=http://localhost:11434
OLLAMA_MODEL=gemma:2b
QDRANT_HOST=localhost
QDRANT_PORT=6333
DATABASE_URL=sqlite:///./ecm_mvp.db
UPLOADS_DIR=uploads
- Start Qdrant:
docker run -d --name qdrant -p 6333:6333 qdrant/qdrant
- Run the application:
python -m uvicorn app.main:app --reload
- Install recommended extensions (see
.vscode/extensions.json
) - Use F5 to start debugging
- Available debug configurations:
- Python: FastAPI - Debug the main application
- Python: Uvicorn Server - Debug with uvicorn
- Python: Test Setup - Debug the setup script
- Install Dependencies - Install Python packages
- Start Qdrant - Start Qdrant container
- Start FastAPI Server - Start the development server
- Test Setup - Run setup validation
- Format Code - Format code with Black
POST /api/v1/upload
- Upload file and get metadata suggestionsPOST /api/v1/import/{document_id}
- Import document with final metadata
POST /api/v1/search
- Search documents by metadata and/or image
GET /api/v1/documents/{document_id}
- Get document detailsGET /api/v1/documents/{document_id}/pages/{page_number}/image
- Get page imageGET /api/v1/documents/{document_id}/download
- Download original file
- Upload a file:
curl -X POST "http://localhost:8000/api/v1/upload" \
-H "Content-Type: multipart/form-data" \
-F "file=@document.pdf"
- Import with metadata:
curl -X POST "http://localhost:8000/api/v1/import/1" \
-H "Content-Type: application/json" \
-d '{
"metadata": [
{"key": "document_type", "value": "invoice"},
{"key": "company", "value": "Acme Corp"}
]
}'
- Search documents:
curl -X POST "http://localhost:8000/api/v1/search" \
-H "Content-Type: application/json" \
-d '{
"metadata": [
{"key": "document_type", "value": "invoice", "value_semantic": false}
]
}'
Use the api_tests.http
file with VS Code REST Client extension for interactive API testing.
├── app/ # Main application code
│ ├── routes/ # API route handlers
│ ├── models.py # SQLAlchemy models
│ ├── schemas.py # Pydantic schemas
│ ├── database.py # Database connection
│ ├── config.py # Configuration settings
│ ├── embedding_service.py # Text/image embeddings
│ ├── qdrant_client.py # Vector database client
│ ├── llm_service.py # Gemini LLM integration
│ ├── file_processor.py # File handling utilities
│ └── main.py # FastAPI application
├── .vscode/ # VS Code configuration
├── uploads/ # File storage (auto-created)
├── requirements.txt # Python dependencies
├── api_tests.http # API test cases
└── setup_dev.py # Development setup script