Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HighLevelActionSetArgs default value #191

Merged
merged 3 commits into from
Oct 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion browsergym/experiments/src/bgym/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from browsergym.core.action.highlevel import HighLevelActionSet
from browsergym.core.action.python import PythonActionSet
from browsergym.experiments.agent import Agent, AgentInfo
from browsergym.experiments.benchmark import Benchmark, HighLevelActionSetArgs
from browsergym.experiments.benchmark import Benchmark, HighLevelActionSetArgs, BENCHMARKS
from browsergym.experiments.loop import (
AbstractAgentArgs,
EnvArgs,
Expand Down
20 changes: 15 additions & 5 deletions browsergym/experiments/src/browsergym/experiments/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,22 @@

@dataclass
class HighLevelActionSetArgs(DataClassJsonMixin):
subsets: list[HighLevelActionSet.ActionSubset]
subsets: tuple[HighLevelActionSet.ActionSubset] = field(
metadata=config(
encoder=lambda x: list(x),
decoder=lambda x: tuple(x),
),
)
# custom_actions: list[callable] | None # non-serializable argument, not supported
multiaction: bool
strict: bool
retry_with_force: bool
demo_mode: Literal["off", "default", "all_blue", "only_visible_elements"]
multiaction: bool = False
strict: bool = False
retry_with_force: bool = False
demo_mode: Optional[Literal["off", "default", "all_blue", "only_visible_elements"]] = None

def __post_init__(self):
if isinstance(self.subsets, list):
"""Needs to be hashable for AgentLab when uniquely identifying agents."""
self.subsets = tuple(self.subsets)

def make_action_set(self):
return HighLevelActionSet(
Expand Down