nemo_rl.environments.nemo_gym_task#

Access task inputs from Gym’s materialized task rows and flat rows.

Module Contents#

Functions#

is_nemo_gym_task

Match Gym’s materialized-task routing discriminator.

get_nemo_gym_attribution_key

Return a taskset for materialized tasks or the resolved agent for flat rows.

get_nemo_gym_task_input

Return mutable input from a materialized task row or the entire flat row.

API#

nemo_rl.environments.nemo_gym_task.is_nemo_gym_task(
row: collections.abc.Mapping[str, Any],
) → bool[source]#

Match Gym’s materialized-task routing discriminator.

Flat rows may also contain a task_id field. A structured identity together with task_input selects the episode protocol, even when the identity is invalid. Full protocol validation remains Gym’s responsibility.

nemo_rl.environments.nemo_gym_task.get_nemo_gym_attribution_key(
row: collections.abc.Mapping[str, Any],
) → str | None[source]#

Return a taskset for materialized tasks or the resolved agent for flat rows.

Processed rollout results retain this identity in attribution_key when the original task envelope is no longer present.

nemo_rl.environments.nemo_gym_task.get_nemo_gym_task_input(
row: dict[str, Any],
) → dict[str, Any][source]#

Return mutable input from a materialized task row or the entire flat row.

Callers can update Responses parameters in place while retaining materialized task identity, opaque task data, and RL metadata in the original envelope.

Raises:

TypeError – If a materialized task’s task_input is not a dictionary.