Prompt for more relaxed checks
Build, push image, and notify Watchtower / build-image (push) Successful in 37s
Build, push image, and notify Watchtower / notify (push) Successful in 13s

This commit is contained in:
2026-08-15 18:45:11 +02:00
parent 86815a9d4d
commit f6c714b1c3
+20 -7
View File
@@ -4,19 +4,23 @@ from APIs.aichat import generate
import shared.config as config import shared.config as config
# 1. Define the output schema as a Pydantic model # Output schema as a Pydantic model
class DishSafetyResult(BaseModel): class DishSafetyResult(BaseModel):
visible_objects: list[str] = Field( visible_objects: list[str] = Field(
description="List all distinct physical objects visible in or around the dish (e.g., bowl, liquid, spoon, cover)." description="List all distinct physical objects visible in or around the dish (e.g., bowl, plastic tray, liquid, spoon, cover)."
) )
material_analysis: str = Field( material_analysis: str = Field(
description="Analyze the physical material of each visible object (e.g., ceramic, stainless steel, glass, flexible film)." description="Analyze the physical material of each visible object (e.g., ceramic, polypropylene plastic, stainless steel, aluminum foil)."
) )
detected_hazards: list[str] = Field( detected_hazards: list[str] = Field(
description="List only the items from visible_objects made of metal, metallic foil/trim, or sealed plastic. Empty if none." description=(
"List ONLY explicit, high-risk microwave hazards: metal items, cutlery, aluminum foil, "
"metallic trim/gilding, Styrofoam (expanded polystyrene), or tightly sealed/unvented foil lids. "
"Do NOT include standard plastic containers, TV dinner trays, polypropylene (#5), or Tupperware as hazards. Empty if none."
)
) )
is_safe: bool = Field( is_safe: bool = Field(
description="Must be set to True ONLY if detected_hazards is empty. Otherwise False." description="Must be set to True if detected_hazards is empty. Otherwise False."
) )
warning_message: str = Field( warning_message: str = Field(
description="One short sentence explaining the hazard if detected_hazards is not empty, otherwise an empty string." description="One short sentence explaining the hazard if detected_hazards is not empty, otherwise an empty string."
@@ -25,8 +29,17 @@ class DishSafetyResult(BaseModel):
def check_dish_safety(image_path: str) -> dict: def check_dish_safety(image_path: str) -> dict:
prompt = ( prompt = (
"Examine this top-down photo of a dish intended for a microwave. " "Examine this photo of a meal intended for microwave heating.\n\n"
"Carefully inspect all visible objects and their surface materials to determine if any microwave safety hazards exist." "Inspect all objects to determine if any CRITICAL microwave hazards exist.\n\n"
"STRICT HAZARDS TO DETECT:\n"
"- Metal utensils, cutlery, or metal objects.\n"
"- Aluminum foil, metallic packaging, or decorative metallic trim.\n"
"- Expanded Polystyrene / Styrofoam containers.\n"
"- Completely sealed non-vented foil or plastic film lids (explosion risk).\n\n"
"SAFE MATERIALS (DO NOT FLAG AS HAZARDS):\n"
"- Standard microwavable food containers, plastic meal prep trays, black plastic TV dinner trays, and polypropylene (PP / #5) plastics.\n"
"- Glass, ceramic, or paper containers.\n\n"
"Only mark is_safe as False if a clear, high-risk hazard from the strictly dangerous list above is present."
) )
# 2. Pass the Pydantic class directly to generate() # 2. Pass the Pydantic class directly to generate()