增加环境变量指向g14部署webarena环境;

map网站使用socks5连接到官网openstreetmap;
模型改成gpt-4o; llm fuzzy math也使用4o;
增加generate_test_data.py脚本
This commit is contained in:
2025-04-15 18:16:52 +08:00
parent c078ba6292
commit bb7393bcb3
11 changed files with 115 additions and 22 deletions

View File

@@ -87,6 +87,7 @@ class ScriptBrowserEnv(Env[dict[str, Observation], Action]):
save_trace_enabled: bool = False,
sleep_after_execution: float = 5.0,
global_config = None,
proxy_url: str = "",
):
# TODO: make Space[Action] = ActionSpace
self.action_space = get_action_space() # type: ignore[assignment]
@@ -98,6 +99,9 @@ class ScriptBrowserEnv(Env[dict[str, Observation], Action]):
self.save_trace_enabled = save_trace_enabled
self.sleep_after_execution = sleep_after_execution
self.global_config = global_config
self.proxy_url = proxy_url
print(f"ScriptBrowserEnv proxy_url: {self.proxy_url}")
match observation_type:
case "html" | "accessibility_tree":
@@ -151,6 +155,12 @@ class ScriptBrowserEnv(Env[dict[str, Observation], Action]):
storage_state=storage_state,
geolocation=geolocation,
device_scale_factor=1,
proxy={
"server": self.proxy_url,
"bypass": "127.0.0.1,localhost",
}
if self.proxy_url
else None,
)
if self.save_trace_enabled:
self.context.tracing.start(screenshots=True, snapshots=True)
@@ -165,7 +175,7 @@ class ScriptBrowserEnv(Env[dict[str, Observation], Action]):
if self.text_observation_type == "accessibility_tree":
client.send("Accessibility.enable")
page.client = client # type: ignore # TODO[shuyanzh], fix this hackey client
page.goto(url)
page.goto(url, timeout=10000)
# set the first page as the current page
self.page = self.context.pages[0]
self.page.bring_to_front()