From bf01852197aec93b685ebbd85a1856d34c3923a8 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Wed, 24 Dec 2025 07:05:50 -0700 Subject: [PATCH] Add shortSummary field to review summary to be used for notifications --- docs/docs/configuration/genai/review_summaries.md | 3 ++- frigate/comms/webpush.py | 2 +- frigate/data_processing/post/types.py | 3 +++ frigate/genai/__init__.py | 3 +++ 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/docs/configuration/genai/review_summaries.md b/docs/docs/configuration/genai/review_summaries.md index 8a492f4b8..04a5b5e94 100644 --- a/docs/docs/configuration/genai/review_summaries.md +++ b/docs/docs/configuration/genai/review_summaries.md @@ -16,12 +16,13 @@ Review summaries provide structured JSON responses that are saved for each revie ``` - `title` (string): A concise, direct title that describes the purpose or overall action (e.g., "Person taking out trash", "Joe walking dog"). - `scene` (string): A narrative description of what happens across the sequence from start to finish, including setting, detected objects, and their observable actions. +- `shortSummary` (string): A brief 2-sentence summary of the scene, suitable for notifications. This is a condensed version of the scene description. - `confidence` (float): 0-1 confidence in the analysis. Higher confidence when objects/actions are clearly visible and context is unambiguous. - `other_concerns` (list): List of user-defined concerns that may need additional investigation. - `potential_threat_level` (integer): 0, 1, or 2 as defined below. ``` -This will show in multiple places in the UI to give additional context about each activity, and allow viewing more details when extra attention is required. Frigate's built in notifications will also automatically show the title and description when the data is available. +This will show in multiple places in the UI to give additional context about each activity, and allow viewing more details when extra attention is required. Frigate's built in notifications will automatically show the title and `shortSummary` when the data is available, while the full `scene` description is available in the UI for detailed review. ### Defining Typical Activity diff --git a/frigate/comms/webpush.py b/frigate/comms/webpush.py index 32eeb40e8..62cc12c9a 100644 --- a/frigate/comms/webpush.py +++ b/frigate/comms/webpush.py @@ -388,7 +388,7 @@ class WebPushClient(Communicator): else: title = base_title - message = payload["after"]["data"]["metadata"]["scene"] + message = payload["after"]["data"]["metadata"]["shortSummary"] else: zone_names = payload["after"]["data"]["zones"] formatted_zone_names = [] diff --git a/frigate/data_processing/post/types.py b/frigate/data_processing/post/types.py index 70fec9b34..44bb09fb0 100644 --- a/frigate/data_processing/post/types.py +++ b/frigate/data_processing/post/types.py @@ -8,6 +8,9 @@ class ReviewMetadata(BaseModel): scene: str = Field( description="A comprehensive description of the setting and entities, including relevant context and plausible inferences if supported by visual evidence." ) + shortSummary: str = Field( + description="A brief 2-sentence summary of the scene, suitable for notifications. Should capture the key activity and context without full detail." + ) confidence: float = Field( description="A float between 0 and 1 representing your overall confidence in this analysis." ) diff --git a/frigate/genai/__init__.py b/frigate/genai/__init__.py index 5e1a74279..7f0192912 100644 --- a/frigate/genai/__init__.py +++ b/frigate/genai/__init__.py @@ -101,6 +101,7 @@ When forming your description: Your response MUST be a flat JSON object with: - `title` (string): A concise, direct title that describes the primary action or event in the sequence, not just what you literally see. Use spatial context when available to make titles more meaningful. When multiple objects/actions are present, prioritize whichever is most prominent or occurs first. Use names from "Objects in Scene" based on what you visually observe. If you see both a name and an unidentified object of the same type but visually observe only one person/object, use ONLY the name. Examples: "Joe walking dog", "Person taking out trash", "Vehicle arriving in driveway", "Joe accessing vehicle", "Person leaving porch for driveway". - `scene` (string): A narrative description of what happens across the sequence from start to finish, in chronological order. Start by describing how the sequence begins, then describe the progression of events. **Describe all significant movements and actions in the order they occur.** For example, if a vehicle arrives and then a person exits, describe both actions sequentially. **Only describe actions you can actually observe happening in the frames provided.** Do not infer or assume actions that aren't visible (e.g., if you see someone walking but never see them sit, don't say they sat down). Include setting, detected objects, and their observable actions. Avoid speculation or filling in assumed behaviors. Your description should align with and support the threat level you assign. +- `shortSummary` (string): A brief 2-sentence summary of the scene, suitable for notifications. Should capture the key activity and context without full detail. This should be a condensed version of the scene description above. - `confidence` (float): 0-1 confidence in your analysis. Higher confidence when objects/actions are clearly visible and context is unambiguous. Lower confidence when the sequence is unclear, objects are partially obscured, or context is ambiguous. - `potential_threat_level` (integer): 0, 1, or 2 as defined in "Normal Activity Patterns for This Property" above. Your threat level must be consistent with your scene description and the guidance above. {get_concern_prompt()} @@ -192,6 +193,8 @@ Input format: Each event is a JSON object with: - "title", "scene", "confidence", "potential_threat_level" (0-2), "other_concerns", "camera", "time", "start_time", "end_time" - "context": array of related events from other cameras that occurred during overlapping time periods +**Note: Use the "scene" field for event descriptions in the report. Ignore any "shortSummary" field if present.** + Report Structure - Use this EXACT format: # Security Summary - {time_range}