Multimodal AI system for classifying operational documents (PDF, image, text) and routing them to the right next action. Built with Microsoft Agent Framework and Azure OpenAI.
What it does:
- Ingests documents and extracts content (text and/or images).
- Classifies into CategoryA, CategoryB, or Unknown.
- Assigns severity, department, next action, and confidence.
- (Optional) Adds RAG context from a vector store (Qdrant/FAISS).
- (Optional) Publishes results to downstream systems via webhooks.
Classification types:
- CategoryA: actionable issues (failures, damage, safety concerns)
- CategoryB: informational updates
- Unknown: requires manual review
uv synccp .env.example .envRequired variables:
AZURE_PROJECT_ENDPOINT=https://your-project.westus.ai.azure.com
AZURE_OPENAI_ENDPOINT=https://your-resource.openai.azure.com/
AZURE_OPENAI_API_KEY=your-api-key
AZURE_OPENAI_MODEL=gpt-4ouv run python examples/01_basic_triage.pyStart the server:
uv run uvicorn src.api:app --reloadHealth check:
curl http://127.0.0.1:8000/healthUpload file for triage:
curl -F "file=@sample_docs/maintenance_report.txt" \
http://127.0.0.1:8000/api/v1/triage/fileSupported formats:
- .pdf (text-based or image-based)
- .txt
- .md
Response fields (abridged):
- document_id
- classification_type
- severity
- summary
- suggested_department
- next_action
- confidence
- processing_time_ms
- citations (if RAG enabled)
Status codes:
- 200 Success
- 400 Empty file upload
- 413 File exceeds size limit
- 415 Unsupported format
- 422 No extractable content
- 500 Server error
- 503 Service not ready
API config (optional):
MAX_DOCUMENT_SIZE_MB=50
AGENT_MODEL=gpt-4o
AGENT_TEMPERATURE=0.3
LOG_LEVEL=INFORun any of the included workflows:
uv run python examples/01_basic_triage.py
uv run python examples/02_document_indexing.py
uv run python examples/03_rag_workflow.py
uv run python examples/04_webhook_integration.py
uv run python examples/05_batch_processing.pyUSE_FAISS=false
QDRANT_HOST=localhost
QDRANT_PORT=6333
AGENT_MODEL=gpt-4o
AGENT_TEMPERATURE=0.3
AGENT_MAX_TOKENS=2048
WEBHOOK_ENDPOINT=https://api.example.com/webhooks/triage
WEBHOOK_API_KEY=your-webhook-key
LOG_LEVEL=INFOconfig/ Configuration (env + settings)
src/ Core agent, vector store, document processing, webhooks
examples/ Runnable examples
tests/ Unit tests
uv run pytest tests/ -v- Prefer a singleton
TriageAgentper process. - Add retry/backoff for 429s.
- Log model diagnostics for slow or failed requests.
- 503: service still initializing; retry after a few seconds.
- 422: no text or images extracted; verify the PDF or file content.
- 429: reduce batch size or add delays between requests.
MIT License - see LICENSE file