Environment Modules¶
Env Builder¶
This file implements the web navigation gym env.
Bases:
GMiniWoBWebEnvironment
The gym environment for web navigation tasks.
- Attributes:
data_dir (str): Directory path where the data is stored. num_websites (int): Number of websites. difficulty (Optional[int]): Difficulty level of the environment. designs (Optional[list[dict[str, Any]]]): List of website designs. global_vocabulary: Global vocabulary for the environment. use_legacy_reset (bool): Whether to use legacy reset method. use_legacy_step (bool): Whether to use legacy step method. render_mode (str): Rendering mode. raw_state (bool): Whether to return raw state. browser_kwargs: Browser arguments.
- Methods:
step(action): Take a step in the environment. reset(seed, options): Reset the environment. _design_environment(env_design): Design the environment based on the environment design. _load_designs(difficulty): Load the designs for the corresponding difficulty level. _sample_design(): Sample a design from the design space.
Reset the environment.
- Args:
seed (int, optional): The seed for random number generation. Defaults to None. options (dict[str, Any], optional): Options for resetting the environment. Defaults to None.
- Returns:
tuple: Observation and info.
Take a step in the environment.
- Args:
action: The action to take. The action should be passed as a scalar. Two types of actions are possible. Firstly, abstract navigation allows to directly refer to an element, and the profile is irrelevant. In this case, the action is converted to a tuple. If abstract navigation is desired, we have to pass use_conceptual=True when initializing the environment. Secondly, the action can refer to a pair of elements and profile fields. The agent will then enter the value of the profile key corresponding to the selected DOM element.
- Returns:
tuple: Observation, reward, termination status, truncation status, info.