nat.eval.red_teaming_evaluator.filter_conditions#

Classes#

IntermediateStepsFilterCondition

Filter conditions for selecting intermediate steps from a trajectory.

Module Contents#

class IntermediateStepsFilterCondition(/, **data: Any)#

Bases: pydantic.BaseModel

Filter conditions for selecting intermediate steps from a trajectory.

This model encapsulates the filtering logic used to select specific intermediate steps for evaluation. Multiple filter conditions can be defined to evaluate different parts of a trajectory separately.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

name: str = None#
event_type: nat.data_models.intermediate_step.IntermediateStepType | str | None = None#
payload_name: str | None = None#
filter_trajectory(
trajectory: list[nat.data_models.intermediate_step.IntermediateStep],
) list[nat.data_models.intermediate_step.IntermediateStep]#

Filter a trajectory based on these conditions.

Args:

trajectory: List of intermediate steps to filter

Returns:

List of filtered intermediate steps matching the conditions

classmethod default() IntermediateStepsFilterCondition#