MCPcopy Create free account
hub / github.com/THUDM/AgentTuning / __init__

Method __init__

eval_heldout/webarena/browser_env/envs.py:77–122  ·  view source on GitHub ↗
(
        self,
        max_page_length: int = 8192,
        headless: bool = True,
        slow_mo: int = 0,
        observation_type: str = "html",
        current_viewport_only: bool = False,
        viewport_size: ViewportSize = {"width": 1280, "height": 720},
        save_trace_enabled: bool = False,
        sleep_after_execution: float = 0.0,
    )

Source from the content-addressed store, hash-verified

75
76 @beartype
77 def __init__(
78 self,
79 max_page_length: int = 8192,
80 headless: bool = True,
81 slow_mo: int = 0,
82 observation_type: str = "html",
83 current_viewport_only: bool = False,
84 viewport_size: ViewportSize = {"width": 1280, "height": 720},
85 save_trace_enabled: bool = False,
86 sleep_after_execution: float = 0.0,
87 ):
88 # TODO: make Space[Action] = ActionSpace
89 self.action_space = get_action_space() # type: ignore[assignment]
90 self.headless = headless
91 self.slow_mo = slow_mo
92 self.current_viewport_only = current_viewport_only
93 self.reset_finished = False
94 self.viewport_size = viewport_size
95 self.save_trace_enabled = save_trace_enabled
96 self.sleep_after_execution = sleep_after_execution
97
98 match observation_type:
99 case "html" | "accessibility_tree":
100 self.text_observation_type = observation_type
101 self.image_observation_type = ""
102 self.main_observation_type = "text"
103 case "image":
104 self.image_observation_type = observation_type
105 self.text_observation_type = "" # type: ignore[assignment]
106 self.main_observation_type = "image"
107 case _:
108 raise ValueError(
109 f"Unsupported observation type: {observation_type}"
110 )
111
112 self.observation_handler = ObservationHandler(
113 self.main_observation_type,
114 self.text_observation_type,
115 self.image_observation_type,
116 self.current_viewport_only,
117 self.viewport_size,
118 )
119
120 self.observation_space = (
121 self.observation_handler.get_observation_space()
122 )
123
124 @beartype
125 def setup(self, config_file: Path | None = None) -> None:

Callers

nothing calls this directly

Calls 3

get_action_spaceFunction · 0.85
ObservationHandlerClass · 0.85
get_observation_spaceMethod · 0.80

Tested by

no test coverage detected