iclbench.environments.textworld package

Submodules

iclbench.environments.textworld.base module

class iclbench.environments.textworld.base.AlwaysTrue[source]

Bases: object

class iclbench.environments.textworld.base.TextWorldFactory(**kwargs)[source]

Bases: object

A factory class for creating TextWorld environments.

This class manages the creation of TextWorld environments for different tasks, cycling through available games for each task or allowing specific game selection.

get_textworld_env(task, seed=None, **kwargs)[source]

Create and return a TextWorld environment for the specified task.

Parameters:
  • task (str) – The name of the task for which to create an environment.

  • seed (int, optional) – If provided, creates the environment for the specific game index. If None, cycles through available games.

Returns:

A TextWorld gym environment.

Return type:

gym.Env

Raises:

KeyError – If the specified task is not found in the available tasks.

initialize(textworld_games_path, tasks, max_episode_steps=40, **kwargs)[source]
class iclbench.environments.textworld.base.TextWorldWrapper(env: Env, max_steps=40)[source]

Bases: Wrapper

__init__(env: Env, max_steps=40)[source]

Wraps an environment to allow a modular transformation of the step() and reset() methods.

Parameters:

env – The environment to wrap

property default_action
filter_objective(obs, info)[source]
get_stats()[source]
get_text_action(action)[source]
reset()[source]

Resets the environment with kwargs.

step(action)[source]

Steps through the environment with action.

textworld_process_obsv(textworld_obsv)[source]

Module contents

iclbench.environments.textworld.get_instruction_prompt(env, task=None)[source]
iclbench.environments.textworld.global_textworld_context(**kwargs) TextWorldFactory[source]