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

Method __init__

webarena/browser_env/envs.py:79–124  ·  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

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