| """Provider-related domain models.""" |
|
|
| from __future__ import annotations |
|
|
| import enum |
| from typing import Any, Optional |
|
|
| from pydantic import BaseModel, Field |
|
|
|
|
| class ProviderCapability(str, enum.Enum): |
| """Every capability a provider can declare.""" |
| DETECTION = "detection" |
| RECOGNITION = "recognition" |
| SCRAPING = "scraping" |
| REVERSE_SEARCH = "reverse_search" |
| IMAGE_ANALYSIS = "image_analysis" |
| METADATA = "metadata" |
| FORENSICS = "forensics" |
| OCR = "ocr" |
| OBJECT_DETECTION = "object_detection" |
| SCENE_RECOGNITION = "scene_recognition" |
| NSFW_DETECTION = "nsfw_detection" |
| AI_IMAGE_DETECTION = "ai_image_detection" |
| EMBEDDING = "embedding" |
| REVERSE_FACE_SEARCH = "reverse_face_search" |
|
|
|
|
| class ProviderStatus(str, enum.Enum): |
| HEALTHY = "healthy" |
| DEGRADED = "degraded" |
| UNHEALTHY = "unhealthy" |
| DISABLED = "disabled" |
| NOT_CONFIGURED = "not_configured" |
|
|
|
|
| class ProviderInfo(BaseModel): |
| name: str |
| capability: ProviderCapability |
| status: ProviderStatus |
| available: bool |
| description: str = "" |
| version: str = "" |
| timeout_seconds: float = 0.0 |
| retry_max_attempts: int = 0 |
| metadata: dict = Field(default_factory=dict) |
|
|
|
|
| class ProviderConfig(BaseModel): |
| name: str |
| module_path: str |
| class_name: str |
| capability: ProviderCapability |
| enable_flag: str |
| description: str = "" |
| requires_api_key: bool = False |
| api_key_setting: str = "" |
| optional_dependency: bool = False |
| timeout_seconds: float = 90.0 |
|
|