|
|
|
@@ -66,12 +66,15 @@ class GenAIClient:
|
|
|
|
|
context_prompt = f"""
|
|
|
|
|
Please analyze the sequence of images ({len(thumbnails)} total) taken in chronological order from the perspective of the {review_data["camera"].replace("_", " ")} security camera.
|
|
|
|
|
|
|
|
|
|
**Normal activity patterns for this property:**
|
|
|
|
|
{activity_context_prompt}
|
|
|
|
|
|
|
|
|
|
Your task is to provide a clear, accurate description of the scene that:
|
|
|
|
|
1. States exactly what is happening based on observable actions and movements.
|
|
|
|
|
2. Evaluates whether the observable evidence suggests normal activity for this property or genuine security concerns.
|
|
|
|
|
3. Assigns a potential_threat_level based on the definitions below, applying them consistently.
|
|
|
|
|
|
|
|
|
|
Provide an objective assessment. The goal is accuracy—neither missing genuine threats nor over-flagging routine activity for this property.
|
|
|
|
|
**IMPORTANT: Start by checking if the activity matches the normal patterns above. If it does, assign Level 0. Only consider higher threat levels if the activity clearly deviates from normal patterns or shows genuine security concerns.**
|
|
|
|
|
|
|
|
|
|
When forming your description:
|
|
|
|
|
- **CRITICAL: Only describe objects explicitly listed in "Detected objects" below.** Do not infer or mention additional people, vehicles, or objects not present in the detected objects list, even if visual patterns suggest them. If only a car is detected, do not describe a person interacting with it unless "person" is also in the detected objects list.
|
|
|
|
@@ -81,10 +84,7 @@ When forming your description:
|
|
|
|
|
- Consider the full sequence chronologically: what happens from start to finish, how duration and actions relate to the location and objects involved.
|
|
|
|
|
- **Use the actual timestamp provided in "Activity started at"** below for time of day context—do not infer time from image brightness or darkness. Unusual hours (late night/early morning) should increase suspicion when the observable behavior itself appears questionable. However, recognize that some legitimate activities can occur at any hour.
|
|
|
|
|
- Identify patterns that suggest genuine security concerns: testing doors/windows on vehicles or buildings, accessing unauthorized areas, attempting to conceal actions, extended loitering without apparent purpose, taking items, behavior that clearly doesn't align with the zone context and detected objects.
|
|
|
|
|
- **Weigh all evidence holistically**: Consider the complete picture including zone, objects, time, and actions together. A single ambiguous action should not override strong contextual evidence of normal activity. The overall pattern determines the threat level.
|
|
|
|
|
|
|
|
|
|
**Normal activity patterns for this property:**
|
|
|
|
|
{activity_context_prompt}
|
|
|
|
|
- **Weigh all evidence holistically**: Start by checking if the activity matches the normal patterns above. If it does, assign Level 0. Only consider Level 1 if the activity clearly deviates from normal patterns or shows genuine security concerns that warrant attention.
|
|
|
|
|
|
|
|
|
|
Your response MUST be a flat JSON object with:
|
|
|
|
|
- `scene` (string): A narrative description of what happens across the sequence from start to finish. **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.
|
|
|
|
@@ -93,9 +93,9 @@ Your response MUST be a flat JSON object with:
|
|
|
|
|
{get_concern_prompt()}
|
|
|
|
|
|
|
|
|
|
Threat-level definitions:
|
|
|
|
|
- 0 — Normal activity: What you observe is consistent with expected activity for this property type. The observable evidence—considering zone context, detected objects, and timing together—supports a benign explanation. Use this for routine activities even if minor ambiguous elements exist.
|
|
|
|
|
- 1 — Potentially suspicious: Observable behavior raises genuine security concerns that warrant human review. The evidence doesn't support a routine explanation when you consider the zone, objects, and actions together. Examples: testing doors/windows on vehicles or structures, accessing areas that don't align with the activity, taking items that likely don't belong to them, behavior clearly inconsistent with the zone and context, or activity that lacks any visible legitimate indicators. Reserve this level for situations that actually merit closer attention—not routine activities for this property.
|
|
|
|
|
- 2 — Immediate threat: Clear evidence of forced entry, break-in, vandalism, aggression, weapons, theft in progress, or active property damage.
|
|
|
|
|
- 0 — **Normal activity (DEFAULT)**: What you observe matches the normal activity patterns above or is consistent with expected activity for this property type. The observable evidence—considering zone context, detected objects, and timing together—supports a benign explanation. **Use this level for routine activities even if minor ambiguous elements exist.**
|
|
|
|
|
- 1 — **Potentially suspicious**: Observable behavior raises genuine security concerns that warrant human review. The evidence doesn't support a routine explanation and clearly deviates from the normal patterns above. Examples: testing doors/windows on vehicles or structures, accessing areas that don't align with the activity, taking items that likely don't belong to them, behavior clearly inconsistent with the zone and context, or activity that lacks any visible legitimate indicators. **Only use this level when the activity clearly doesn't match normal patterns.**
|
|
|
|
|
- 2 — **Immediate threat**: Clear evidence of forced entry, break-in, vandalism, aggression, weapons, theft in progress, or active property damage.
|
|
|
|
|
|
|
|
|
|
Sequence details:
|
|
|
|
|
- Frame 1 = earliest, Frame {len(thumbnails)} = latest
|
|
|
|
@@ -253,6 +253,10 @@ Rules for the report:
|
|
|
|
|
"""Submit a request to the provider."""
|
|
|
|
|
return None
|
|
|
|
|
|
|
|
|
|
def get_context_size(self) -> int:
|
|
|
|
|
"""Get the context window size for this provider in tokens."""
|
|
|
|
|
return 4096
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_genai_client(config: FrigateConfig) -> Optional[GenAIClient]:
|
|
|
|
|
"""Get the GenAI client."""
|
|
|
|
|