File size: 1,675 Bytes
9bd3ee0
aac350d
 
 
 
 
 
 
 
 
 
9bd3ee0
aac350d
 
 
 
9bd3ee0
 
 
 
 
 
 
 
 
f5eeb1c
aac350d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23d337e
 
aac350d
 
 
 
 
 
 
 
 
 
 
23d337e
aac350d
23d337e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
"""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"                                  # NEW
    OBJECT_DETECTION = "object_detection"        # NEW
    SCENE_RECOGNITION = "scene_recognition"      # NEW
    NSFW_DETECTION = "nsfw_detection"            # NEW
    AI_IMAGE_DETECTION = "ai_image_detection"    # NEW
    EMBEDDING = "embedding"                      # NEW
    REVERSE_FACE_SEARCH = "reverse_face_search"  # NEW — PimEyes-style indexed 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