:(
Build, push image, and notify Watchtower / build-image (push) Successful in 37s
Build, push image, and notify Watchtower / notify (push) Successful in 12s

This commit is contained in:
2026-08-23 18:52:05 +02:00
parent eb80d13300
commit 8a71d4eaa7
+10 -10
View File
@@ -4,26 +4,26 @@ from APIs.aichat import generate
import shared.config as config import shared.config as config
class DishSafetyResult(BaseModel): class DishSafetyResult(BaseModel):
image_description: str = Field( utensil_or_foreign_object_detected: bool = Field(
description="Describe the food and container in 1 simple sentence." description="Set to True if ANY spoon, fork, knife, handle, or foil is inside or touching the bowl. Set to False ONLY if the bowl contains ONLY 100% food."
) )
is_safe: bool = Field( is_safe: bool = Field(
description="Set to True if safe. Set to False ONLY if a physical metallic utensil or aluminum foil is clearly visible." description="MUST be False if utensil_or_foreign_object_detected is True. Set to True ONLY if pure food/bowl with ZERO utensils."
) )
detected_hazards: list[str] = Field( detected_hazards: list[str] = Field(
description="List any metallic objects found (e.g. ['metal utensil']). If is_safe is True, this MUST be empty []." description="List any items found (e.g., ['spoon']). Empty list [] if safe."
) )
warning_message: str = Field( warning_message: str = Field(
description="Short warning if unsafe, otherwise empty string ''." description="Warning statement if unsafe, otherwise empty string ''."
) )
def check_dish_safety(image_path: str) -> dict: def check_dish_safety(image_path: str) -> dict:
prompt = ( prompt = (
"Analyze this top-down photo inside a microwave.\n\n" "Inspect this top-down photo of a food dish inside a microwave.\n\n"
"TASK:\n" "STRICT MICROWAVE RULES:\n"
"1. Describe what is visible in `image_description`.\n" "1. Check if ANY utensil (spoon, fork, knife, or handle) is present in or on the bowl.\n"
"2. If the container holds strictly food with no physical metal objects, set `is_safe` to True and `detected_hazards` to [].\n" "2. If ANY spoon or utensil is present (metal, plastic, or ceramic), you MUST set `utensil_or_foreign_object_detected = True` and `is_safe = False`.\n"
"3. Mark `is_safe` as False ONLY if an actual metal object or metallic handle is present in the container." "3. `is_safe` can ONLY be True if the dish contains strictly food and nothing else."
) )
response_raw = generate( response_raw = generate(