Spaces:
Runtime error
Runtime error
| # ---------------------------------------------------------------------------- | |
| # | |
| # Welcome to Baml! To use this generated code, please run the following: | |
| # | |
| # $ pip install baml | |
| # | |
| # ---------------------------------------------------------------------------- | |
| # This file was generated by BAML: please do not edit it. Instead, edit the | |
| # BAML files and re-generate this code using: baml-cli generate | |
| # baml-cli is available with the baml package. | |
| import typing | |
| import typing_extensions | |
| from enum import Enum | |
| from pydantic import BaseModel, ConfigDict, Field | |
| import baml_py | |
| CheckT = typing_extensions.TypeVar('CheckT') | |
| CheckName = typing_extensions.TypeVar('CheckName', bound=str) | |
| class Check(BaseModel): | |
| name: str | |
| expression: str | |
| status: str | |
| class Checked(BaseModel, typing.Generic[CheckT, CheckName]): | |
| value: CheckT | |
| checks: typing.Dict[CheckName, Check] | |
| def get_checks(checks: typing.Dict[CheckName, Check]) -> typing.List[Check]: | |
| return list(checks.values()) | |
| def all_succeeded(checks: typing.Dict[CheckName, Check]) -> bool: | |
| return all(check.status == "succeeded" for check in get_checks(checks)) | |
| # ######################################################################### | |
| # Generated enums (0) | |
| # ######################################################################### | |
| # ######################################################################### | |
| # Generated classes (4) | |
| # ######################################################################### | |
| class DetectionInfo(BaseModel): | |
| track_id: str | |
| class_label: str | |
| confidence: float = Field(description='Detection model confidence 0.0-1.0. Lower values mean the detector is less sure about the class.') | |
| center_x: float = Field(description='Horizontal position in frame, 0.0=left edge, 1.0=right edge') | |
| center_y: float = Field(description='Vertical position in frame, 0.0=top edge, 1.0=bottom edge') | |
| speed_kph: float | |
| direction: str = Field(description='Clock direction (e.g. \'3 o\'clock\' for rightward) or \'stationary\'') | |
| class DetectionVerdict(BaseModel): | |
| track_id: str | |
| mission_relevant: bool = Field(description='Does this broad object CLASS relate to the mission? e.g. \'person\' is relevant to a rescue mission, \'dog\' is not.') | |
| satisfies: typing.Optional[bool] = Field(default=None, description='Based on visual context, does THIS SPECIFIC detection actually meet the mission criteria? e.g. a person on a rooftop satisfies \'find stranded people\', but a person walking on a street does not. null if the image is too ambiguous to judge.') | |
| reason: str = Field(description='1-2 sentences: what you observe in the image that supports your verdict. Reference specific visual cues (location, posture, surroundings, motion).') | |
| features: typing.Dict[str, str] = Field(description='2-5 observable properties from the image relevant to the mission. e.g. location: \'rooftop\', posture: \'standing\', surroundings: \'floodwater\', vehicle_type: \'flatbed truck\'') | |
| class MissionPlan(BaseModel): | |
| detector_queries: typing.List[str] = Field(description='ONLY the object classes directly targeted by the mission. Use COCO class names (person, car, truck, bicycle, motorcycle, bus, dog, cat, etc.). Include ONLY classes the mission explicitly asks to find — do NOT pad with tangentially related classes. Typically 1-4 items.') | |
| refined_mission: str = Field(description='A clear, one-sentence restatement of the mission objective that a downstream analyst LLM will evaluate each detection against.') | |
| reasoning: str = Field(description='Brief explanation of why these queries were chosen.') | |
| class MissionSuggestion(BaseModel): | |
| mission: str = Field(description='A concise mission objective. Imperative command, e.g. \'Identify vehicles that can carry heavy cargos\'. 8-15 words.') | |
| reasoning: str = Field(description='One sentence: what you see in the image that makes this mission feasible.') | |
| # ######################################################################### | |
| # Generated type aliases (0) | |
| # ######################################################################### | |