Better prompt
Build, push image, and notify Watchtower / build-image (push) Successful in 53s
Build, push image, and notify Watchtower / notify (push) Successful in 14s

This commit is contained in:
2026-08-12 12:15:51 +02:00
parent 497c042a2a
commit 547c2df1c9
+14 -8
View File
@@ -6,21 +6,27 @@ import shared.config as config
# 1. Define the output schema as a Pydantic model
class DishSafetyResult(BaseModel):
is_safe: bool = Field(
description="True if no microwave hazards presents."
visible_objects: list[str] = Field(
description="List all distinct physical objects visible in or around the dish (e.g., bowl, liquid, spoon, cover)."
)
warning_message: str = Field(
description=f"Short explanation of any hazard found (no more than one sentence), or an empty string if safe.",
material_analysis: str = Field(
description="Analyze the physical material of each visible object (e.g., ceramic, stainless steel, glass, flexible film)."
)
detected_hazards: list[str] = Field(
description="List of specific hazard items detected. Only include items that are actually present in the image. If no hazards are detected, this list should be empty."
description="List only the items from visible_objects made of metal, metallic foil/trim, or sealed plastic. Empty if none."
)
is_safe: bool = Field(
description="Must be set to True ONLY if detected_hazards is empty. Otherwise False."
)
warning_message: str = Field(
description="One short sentence explaining the hazard if detected_hazards is not empty, otherwise an empty string."
)
def check_dish_safety(image_path: str) -> dict:
prompt = (
"Analyze this top-down photo of a dish prepared for microwave cooking. "
"Inspect the area for metal utensils, aluminum foil, metallic dish patterns, or unvented plastic wraps that could be dangerous for the dish microwave cooking process or pose a safety risk."
"Examine this top-down photo of a dish intended for a microwave. "
"Carefully inspect all visible objects and their surface materials to determine if any microwave safety hazards exist."
)
# 2. Pass the Pydantic class directly to generate()
@@ -28,7 +34,7 @@ def check_dish_safety(image_path: str) -> dict:
prompt=prompt,
images=[image_path],
output_format=DishSafetyResult,
should_think=False
should_think=False,
)
print(f"[Debug] Raw response from AI generator: {response_raw}")