The hud.taskset module provides the TaskSet class and functions for working with collections of Tasks.

Module Functions

load_taskset

async def load_taskset(
    taskset_id: str,
    api_key: str | None = None
) -> TaskSet:

Loads a TaskSet and its associated Task objects from the HUD platform by its ID.

Parameters:

  • taskset_id (str): The unique identifier of the TaskSet to load.
  • api_key (str | None, optional): HUD API key. If None, uses the key from hud.settings.

Returns:

  • TaskSet: The loaded TaskSet instance containing a list of Task objects.

load_from_inspect

def load_from_inspect(dataset: Dataset) -> TaskSet:

Creates a TaskSet instance from an inspect-ai dataset object.

(Note: Requires inspect-ai library to be installed).

Parameters:

  • dataset (inspect_ai.dataset.Dataset): An inspect-ai dataset instance.

Returns:

  • TaskSet: A new TaskSet instance populated with Task objects converted from the dataset’s samples.

Classes

TaskSet

class TaskSet(pydantic.BaseModel):
    id: str | None = None
    description: str | None = None
    tasks: list[Task] = []

    # Supports len() and indexing (taskset[index])
    def __len__(self) -> int: ...
    def __getitem__(self, index: int) -> Task: ...

Represents a collection of related Task objects. Primarily used as a container when loading predefined sets using hud.load_taskset().

See the Tasks and TaskSets Concepts page for more details and usage examples.

Attributes:

  • id (str | None): Optional unique identifier, usually populated when loaded via load_taskset.
  • description (str | None): Optional description of the taskset.
  • tasks (list[Task]): The list of Task objects belonging to this set.

Methods:

  • __len__(self): Returns the number of tasks in the tasks list. Allows using len(taskset).
  • __getitem__(self, index): Returns the Task at the specified index. Allows using taskset[index].