From 34d184a3b968f16ca80e23021e14d9472e880bf9 Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Sun, 29 Jun 2025 16:39:21 -0500 Subject: [PATCH] config --- frigate/config/classification.py | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/frigate/config/classification.py b/frigate/config/classification.py index 66b6c20ea..d861e5e8a 100644 --- a/frigate/config/classification.py +++ b/frigate/config/classification.py @@ -25,6 +25,17 @@ class EnrichmentsDeviceEnum(str, Enum): CPU = "CPU" +class TriggerType(str, Enum): + TEXT = "text" + IMAGE = "image" + BOTH = "both" + + +class TriggerAction(str, Enum): + ALERT = "alert" + NOTIFICATION = "notification" + + class AudioTranscriptionConfig(FrigateBaseModel): enabled: bool = Field(default=False, title="Enable audio transcription.") language: str = Field( @@ -114,9 +125,26 @@ class SemanticSearchConfig(FrigateBaseModel): ) +class TriggerConfig(FrigateBaseModel): + type: TriggerType = Field(default=TriggerType.TEXT, title="Type of trigger") + data: str = Field(title="Trigger content (text phrase or image ID)") + threshold: float = Field( + title="Confidence score required to run the trigger.", + default=0.8, + gt=0.0, + le=1.0, + ) + actions: Optional[List[TriggerAction]] = Field( + default=[], title="Actions to perform when trigger is matched" + ) + + model_config = ConfigDict(extra="forbid", protected_namespaces=()) + + class CameraSemanticSearchConfig(FrigateBaseModel): - triggers: Optional[list[str]] = Field( - default=None, title="Text phrases to elevate tracked objects to review alerts." + triggers: Optional[Dict[str, TriggerConfig]] = Field( + default=None, + title="Text or image triggers to elevate tracked objects to review alerts", ) model_config = ConfigDict(extra="forbid", protected_namespaces=())