Skip to content

Commit

Permalink
weblinx action set
Browse files Browse the repository at this point in the history
  • Loading branch information
gasse committed Oct 25, 2024
1 parent 2572b97 commit 5fd5ead
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
17 changes: 17 additions & 0 deletions browsergym/core/src/browsergym/core/action/highlevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,23 @@
send_msg_to_user,
report_infeasible,
],
# from weblinx_browsergym
# https://github.com/McGill-NLP/agentlab-weblinx-mvp/blob/a91b6d19870c5187d252e70a2e2013511cc6f1d2/weblinx_browsergym/__init__.py#L274-L286
"weblinx": [
send_msg_to_user, # say(speaker="assistant", utterance=[str]) -> send_msg_to_user(text=[str])
click, # click(uid=[element id]) -> click(bid=[element id])
hover, # hover(uid=[element id]) -> hover(bid=[element id])
fill, # textinput(uid=[element id], value=[str]) -> fill(bid=[element id], value=[str])
# change(uid=[element], value=[str]) -> ❌
goto, # load(url=[link]) -> goto(url=[link])
# submit(uid=[element]) -> click(bid=[element id])
scroll, # scroll(x=[int x],y=[int y]) -> scroll(delta_x=[int x], delta_y=[int y])
# copy(uid=[element],text=[str]) -> ❌
# paste(uid=[element],text=[str]) -> ❌
new_tab, # tabcreate() -> new_tab()
tab_close, # tabremove(target=[tabId]) -> tab_close()
tab_focus, # tabswitch(origin=[origin tabId],target=[target tabId]) -> tab_focus(index=[target tabid])
],
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ def prepare_backends(self):
import browsergym.visualwebarena

# full reset the instance (requires environment variables properly set up)
from browsergym.visualwebarena.instance import VisualWebArenaInstance
from browsergym.visualwebarena.instance import (
VisualWebArenaInstance,
)

default_instance = VisualWebArenaInstance()
default_instance.full_reset()
Expand All @@ -129,9 +131,9 @@ def prepare_backends(self):

case "weblinx":
# register environments
from weblinx_browsergym import register_weblinx_tasks
import weblinx_browsergym

register_weblinx_tasks()
weblinx_browsergym.register_weblinx_tasks()

case _:
raise ValueError(f"Unknown benchmark backend {repr(backend)}")
Expand Down Expand Up @@ -247,10 +249,10 @@ def subset_from_regexp(self, column, regexp):
demo_mode="off",
),
"weblinx": HighLevelActionSetArgs(
subsets=["chat", "bid"],
subsets=["weblinx"],
multiaction=False,
strict=False,
retry_with_force=False,
retry_with_force=True,
demo_mode="off",
),
}
Expand Down

0 comments on commit 5fd5ead

Please sign in to comment.