mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-12-06 05:24:11 +03:00
Formatting and prompt improvements for review summary report
This commit is contained in:
parent
12e5f274dd
commit
eb75c76ed4
@ -213,7 +213,7 @@ class ReviewDescriptionProcessor(PostProcessorApi):
|
|||||||
# Query all review segments with camera and time information
|
# Query all review segments with camera and time information
|
||||||
segments: list[dict[str, Any]] = [
|
segments: list[dict[str, Any]] = [
|
||||||
{
|
{
|
||||||
"camera": r["camera"],
|
"camera": r["camera"].replace("_", " ").title(),
|
||||||
"start_time": r["start_time"],
|
"start_time": r["start_time"],
|
||||||
"end_time": r["end_time"],
|
"end_time": r["end_time"],
|
||||||
"metadata": r["data"]["metadata"],
|
"metadata": r["data"]["metadata"],
|
||||||
@ -267,7 +267,9 @@ class ReviewDescriptionProcessor(PostProcessorApi):
|
|||||||
primary_camera = primary_seg["camera"]
|
primary_camera = primary_seg["camera"]
|
||||||
|
|
||||||
for seg in segments:
|
for seg in segments:
|
||||||
if seg["camera"] == primary_camera:
|
seg_camera = seg["camera"]
|
||||||
|
|
||||||
|
if seg_camera == primary_camera:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if seg in primary_segments:
|
if seg in primary_segments:
|
||||||
@ -279,11 +281,11 @@ class ReviewDescriptionProcessor(PostProcessorApi):
|
|||||||
if seg_start < primary_end and primary_start < seg_end:
|
if seg_start < primary_end and primary_start < seg_end:
|
||||||
contextual_item = copy.deepcopy(seg["metadata"])
|
contextual_item = copy.deepcopy(seg["metadata"])
|
||||||
contextual_item["_is_primary"] = False
|
contextual_item["_is_primary"] = False
|
||||||
contextual_item["_camera"] = seg["camera"]
|
contextual_item["_camera"] = seg_camera
|
||||||
contextual_item["_related_to_camera"] = primary_camera
|
contextual_item["_related_to_camera"] = primary_camera
|
||||||
|
|
||||||
if not any(
|
if not any(
|
||||||
item.get("_camera") == seg["camera"]
|
item.get("_camera") == seg_camera
|
||||||
and item.get("time") == contextual_item.get("time")
|
and item.get("time") == contextual_item.get("time")
|
||||||
for item in all_items_for_summary
|
for item in all_items_for_summary
|
||||||
):
|
):
|
||||||
|
|||||||
@ -189,12 +189,13 @@ Input: JSON list with "title", "scene", "confidence", "potential_threat_level" (
|
|||||||
|
|
||||||
Task: Write a concise, human-presentable security report in markdown format.
|
Task: Write a concise, human-presentable security report in markdown format.
|
||||||
|
|
||||||
Important - Understanding Primary vs Contextual Items:
|
CRITICAL - Understanding Primary vs Contextual Items:
|
||||||
- Items with "_is_primary": true are events that require review or attention
|
- Items with "_is_primary": true are events that REQUIRE REVIEW and MUST be included in the report
|
||||||
- Items with "_is_primary": false are additional context from other camera perspectives that occurred at the same time
|
- Items with "_is_primary": false are additional context from other camera perspectives
|
||||||
- Contextual items (threat level 0) provide important background information to help understand primary events
|
- **DO NOT create separate bullet points or sections for contextual items**
|
||||||
- Use contextual items to provide a more complete and accurate understanding of what actually happened
|
- **ONLY use contextual items to enrich and inform the description of primary items**
|
||||||
- The "_camera" field indicates which camera captured each event
|
- The "_camera" field indicates which camera captured each event
|
||||||
|
- When a contextual item provides relevant background (e.g., delivery truck explaining person at door), incorporate that information directly into the primary event's description
|
||||||
|
|
||||||
Rules for the report:
|
Rules for the report:
|
||||||
|
|
||||||
@ -204,15 +205,16 @@ Rules for the report:
|
|||||||
- Write a 1-2 sentence situational overview capturing the general pattern of the period.
|
- Write a 1-2 sentence situational overview capturing the general pattern of the period.
|
||||||
|
|
||||||
- Event details
|
- Event details
|
||||||
- Present events in chronological order as a bullet list.
|
- **ONLY create bullet points for PRIMARY items (_is_primary: true)**
|
||||||
- **When primary and contextual items occur at overlapping times, COMBINE them into a single comprehensive bullet.**
|
- Do NOT create separate bullets for contextual items
|
||||||
- Use the contextual information to provide a more complete picture of what happened.
|
- Present primary events in chronological order as a bullet list.
|
||||||
- **If multiple events occur within the same minute or overlapping time range, COMBINE them into a single bullet.**
|
- When contextual items overlap with a primary event, weave that information naturally into the primary event's description.
|
||||||
- Summarize the distinct activities as sub-points under the shared timestamp.
|
- Example: Instead of "Person at door" write "Person at door (delivery driver, as delivery truck was present on driveway camera)"
|
||||||
|
- If multiple PRIMARY events occur within the same minute, combine them into a single bullet with sub-points.
|
||||||
- If no timestamp is given, preserve order but label as "Time not specified."
|
- If no timestamp is given, preserve order but label as "Time not specified."
|
||||||
- Use bold timestamps for clarity.
|
- Use bold timestamps for clarity.
|
||||||
- Include camera names when multiple cameras captured related activity.
|
- Include the primary event's camera name.
|
||||||
- Group bullets under subheadings when multiple events fall into the same category (e.g., Vehicle Activity, Porch Activity, Unusual Behavior).
|
- Group bullets under subheadings when multiple PRIMARY events fall into the same category (e.g., Porch Activity, Unusual Behavior).
|
||||||
|
|
||||||
- Threat levels
|
- Threat levels
|
||||||
- Always show the threat level for PRIMARY events using these labels:
|
- Always show the threat level for PRIMARY events using these labels:
|
||||||
@ -220,8 +222,8 @@ Rules for the report:
|
|||||||
- Threat level 1: "Needs review"
|
- Threat level 1: "Needs review"
|
||||||
- Threat level 2: "Security concern"
|
- Threat level 2: "Security concern"
|
||||||
- Format as (threat level: Normal), (threat level: Needs review), or (threat level: Security concern).
|
- Format as (threat level: Normal), (threat level: Needs review), or (threat level: Security concern).
|
||||||
- When contextual items help explain a primary event, adjust your description to reflect the fuller context.
|
- When contextual items explain or reduce concern about a primary event, the description should reflect this understanding.
|
||||||
- If multiple events at the same time share the same threat level, only state it once.
|
- If multiple PRIMARY events at the same time share the same threat level, only state it once.
|
||||||
|
|
||||||
- Final assessment
|
- Final assessment
|
||||||
- End with a Final Assessment section.
|
- End with a Final Assessment section.
|
||||||
@ -230,12 +232,13 @@ Rules for the report:
|
|||||||
- If threat level 1 events are present:
|
- If threat level 1 events are present:
|
||||||
Final assessment: Some activity requires review but no security concerns identified.
|
Final assessment: Some activity requires review but no security concerns identified.
|
||||||
- If threat level 2 events are present, clearly summarize them as Security concerns requiring immediate attention.
|
- If threat level 2 events are present, clearly summarize them as Security concerns requiring immediate attention.
|
||||||
- Note if contextual information from other cameras provided clarity about seemingly suspicious activity.
|
- Keep this section brief - do not repeat details from the event descriptions above.
|
||||||
|
|
||||||
- Conciseness
|
- Conciseness
|
||||||
- Do not repeat benign clothing/appearance details unless they distinguish individuals.
|
- Do not repeat benign clothing/appearance details unless they distinguish individuals.
|
||||||
- Summarize similar routine events instead of restating full scene descriptions.
|
- Summarize similar routine events instead of restating full scene descriptions.
|
||||||
- When contextual items simply confirm what the primary event already described, keep the description brief.
|
- When incorporating contextual information, do so briefly and naturally within the primary event description.
|
||||||
|
- Avoid lengthy explanatory notes - integrate context seamlessly into the narrative.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
for item in segments:
|
for item in segments:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user