Skip to content

Commit

Permalink
rc2
Browse files Browse the repository at this point in the history
  • Loading branch information
gasse committed Mar 13, 2024
1 parent 032c387 commit 62761de
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 39 deletions.
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ while not done:
obs, reward, terminated, truncated, info = env.step(action)
```



### MiniWoB++ task example

Boilerplate code to run an agent on a miniwob task:
Expand Down Expand Up @@ -133,7 +131,3 @@ You can customize your experience by changing the `model_name` to your preferred
_multiple agent demos on the open web, WorkArena and WebArena_

https://github.com/ServiceNow/BrowserGym/assets/26232819/e0bfc788-cc8e-44f1-b8c3-0d1114108b85




2 changes: 1 addition & 1 deletion core/src/browsergym/core/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "0.1.0rc1"
__version__ = "0.1.0rc2"

import playwright.sync_api

Expand Down
2 changes: 1 addition & 1 deletion miniwob/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
browsergym-core==0.1.0rc1
browsergym-core==0.1.0rc2
2 changes: 1 addition & 1 deletion miniwob/src/browsergym/miniwob/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "0.1.0rc1"
__version__ = "0.1.0rc2"

from browsergym.core.registration import register_task

Expand Down
10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ classifiers = [
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"License :: OSI Approved :: Apache Software License",
]
version="0.1.0rc1"
version="0.1.0rc2"
dependencies = [
"browsergym-core==0.1.0rc1",
"browsergym-miniwob==0.1.0rc1",
"browsergym-webarena==0.1.0rc1",
"browsergym-workarena==0.1.0rc1",
"browsergym-core==0.1.0rc2",
"browsergym-miniwob==0.1.0rc2",
"browsergym-webarena==0.1.0rc2",
"browsergym-workarena==0.1.0rc2",
]

[tool.setuptools]
Expand Down
2 changes: 1 addition & 1 deletion webarena/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
browsergym-core==0.1.0rc1
browsergym-core==0.1.0rc2
libwebarena==0.0.2
2 changes: 1 addition & 1 deletion webarena/src/browsergym/webarena/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "0.1.0rc1"
__version__ = "0.1.0rc2"

from browsergym.core.registration import register_task

Expand Down
25 changes: 3 additions & 22 deletions webarena/src/browsergym/webarena/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,14 @@ def setup(self, seed: int, page: playwright.sync_api.Page) -> tuple[str, dict]:

# This note is present in all webarena's agent prompts
# https://github.com/web-arena-x/webarena/blob/c6475f0e9affe5252a2966e26b8cb4c834a4ae40/agent/prompts/raw/p_cot_id_actree_2s.py#L34
goal += f"""
if self.with_homepage_hint:
goal += f"""
(Note: if you want to visit other websites, check out the homepage at {self.webarena_instance.home_url}. It has a list of websites you can visit. {self.webarena_instance.home_url}/password.html lists all the account name and password for the websites. You can use them to log in to the websites.)
"""

# This note is present in some of webarena's agent prompts
if self.with_na:
if self.with_na_hint:
goal += """\
If you believe the task is impossible to complete, provide the answer "N/A".
Expand Down Expand Up @@ -178,23 +179,3 @@ def validate(
return score, True, "", {}
else:
return score, False, "", {}

def get_goal(self) -> str:
goal = self.config["intent"]

if self.with_homepage_hint:
goal += f"""
(Note: if you want to visit other websites, check out the homepage at {self.webarena_instance.home_url}. It has a list of websites you can visit. {self.webarena_instance.home_url}/password.html lists all the account name and password for the websites. You can use them to log in to the websites.)
"""
# This note is present in all webarena's agent prompts
# https://github.com/web-arena-x/webarena/blob/c6475f0e9affe5252a2966e26b8cb4c834a4ae40/agent/prompts/raw/p_cot_id_actree_2s.py#L34

# This note is present in some of webarena's agent prompts
if self.with_na_hint:
goal += """\
If you believe the task is impossible to complete, provide the answer "N/A".
"""

return goal
6 changes: 5 additions & 1 deletion webarena/tests/test_env_general.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import logging
import os
import pytest
import random

from tenacity import retry, stop_after_attempt, retry_if_exception_type

Expand All @@ -18,14 +19,17 @@

from browsergym.webarena import ALL_WEBARENA_TASK_IDS

rng = random.Random(1)
task_ids = rng.sample(ALL_WEBARENA_TASK_IDS, 25)


@retry(
stop=stop_after_attempt(5),
retry=retry_if_exception_type(TimeoutError),
reraise=True,
before_sleep=lambda _: logging.info("Retrying due to a TimeoutError..."),
)
@pytest.mark.parametrize("task_id", ALL_WEBARENA_TASK_IDS)
@pytest.mark.parametrize("task_id", task_ids)
@pytest.mark.slow
def test_env_generic(task_id):
env = gym.make(
Expand Down

0 comments on commit 62761de

Please sign in to comment.