File size: 4,124 Bytes
240e068
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7e09916
240e068
 
 
 
 
0ebc456
 
 
240e068
0ebc456
240e068
 
 
0ebc456
 
 
 
240e068
 
0ebc456
 
240e068
 
7e09916
66a4c69
 
7e09916
240e068
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# ----------------------------------------------------------------------------
#
#  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)
# #########################################################################