Cleanup prompt more

This commit is contained in:
Nicolas Mowen 2025-10-29 07:32:36 -06:00
parent 58257690d3
commit bb8ab5edc1
2 changed files with 8 additions and 11 deletions

View File

@ -421,13 +421,12 @@ def run_analysis(
name = sub_labels_list[i].replace("_", " ").title() name = sub_labels_list[i].replace("_", " ").title()
unified_objects.append(f"{name} ({object_type})") unified_objects.append(f"{name} ({object_type})")
# Add non-verified objects as "Unrecognized (type)"
for label in objects_list: for label in objects_list:
if "-verified" in label: if "-verified" in label:
continue continue
elif label in labelmap_objects: elif label in labelmap_objects:
object_type = label.replace("_", " ") object_type = label.replace("_", " ").title()
unified_objects.append(f"Unrecognized ({object_type})") unified_objects.append(object_type)
analytics_data["unified_objects"] = unified_objects analytics_data["unified_objects"] = unified_objects

View File

@ -100,7 +100,7 @@ When forming your description:
## Response Format ## Response Format
Your response MUST be a flat JSON object with: Your response MUST be a flat JSON object with:
- `title` (string): A concise, one-sentence title that captures the main activity. Use names from "Objects in Scene" based on what you visually observe. If you see both a recognized name and "Unrecognized" for the same type but visually observe only one person/object, use ONLY the recognized name. Examples: "Joe walking dog in backyard", "Joe near vehicle in driveway", "Joe and an unrecognized person on front porch". - `title` (string): A concise, one-sentence title that captures the main activity. 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 in backyard", "Joe near vehicle in driveway", "Joe and a person on front porch".
- `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. - `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.
- `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. - `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 below. Your threat level must be consistent with your scene description and the guidance above. - `potential_threat_level` (integer): 0, 1, or 2 as defined below. Your threat level must be consistent with your scene description and the guidance above.
@ -120,11 +120,11 @@ Your response MUST be a flat JSON object with:
## Objects in Scene ## Objects in Scene
Each line represents a detection state, not necessarily unique individuals. Named objects are recognized/verified identities; "Unrecognized" indicates objects detected but not identified. Each line represents a detection state, not necessarily unique individuals. Objects with names in parentheses (e.g., "Name (person)") are verified identities. Objects without names (e.g., "Person") are detected but not identified.
**CRITICAL: When you see both recognized and unrecognized entries of the same type (e.g., "Name (person)" and "Unrecognized (person)"), visually count how many distinct people/objects you actually see based on appearance and clothing. If you observe only ONE person throughout the sequence, use ONLY the recognized name (e.g., "Name"), not "Unrecognized". The same person may be recognized in some frames but not others. Only describe both recognized and unrecognized if you visually see MULTIPLE distinct people with clearly different appearances.** **CRITICAL: When you see both recognized and unrecognized entries of the same type (e.g., "Joe (person)" and "Person"), visually count how many distinct people/objects you actually see based on appearance and clothing. If you observe only ONE person throughout the sequence, use ONLY the recognized name (e.g., "Joe"). The same person may be recognized in some frames but not others. Only describe both if you visually see MULTIPLE distinct people with clearly different appearances.**
**Note: "Unrecognized" is NOT an indicator of suspicious activityit simply means the system hasn't identified that object.** **Note: Unidentified objects (without names) are NOT indicators of suspicious activitythey simply mean the system hasn't identified that object.**
{get_objects_list()} {get_objects_list()}
## Important Notes ## Important Notes
@ -165,10 +165,8 @@ Each line represents a detection state, not necessarily unique individuals. Name
try: try:
metadata = ReviewMetadata.model_validate_json(clean_json) metadata = ReviewMetadata.model_validate_json(clean_json)
if any( # If any verified objects (contain parentheses with name), set to 0
not obj.startswith("Unrecognized") if any("(" in obj for obj in review_data["unified_objects"]):
for obj in review_data["unified_objects"]
):
metadata.potential_threat_level = 0 metadata.potential_threat_level = 0
metadata.time = review_data["start"] metadata.time = review_data["start"]