langtest.transform.toxicity.ToxicityTypes#

class ToxicityTypes#

Bases: BaseToxicity

Class for toxicity types

__init__()#

Methods

__init__()

async_run(sample_list, model, *args, **kwargs)

Computes the toxicity completion on the samples in async mode.

run(sample_list, model, *args, **kwargs)

Computes the toxicity completion on the samples

transform(sample_list, test_name)

Method that implements prompt toxicity transformations on the given samples

Attributes

alias_name

supported_tasks

test_types

async classmethod async_run(sample_list: List[Sample], model: ModelAPI, *args, **kwargs)#

Computes the toxicity completion on the samples in async mode.

Parameters:
  • sample_list (List[Sample]) – list of samples to compute toxicity on

  • model (ModelAPI) – model to use for toxicity completion

async static run(sample_list: List[Sample], model: ModelAPI, *args, **kwargs) List[Sample]#

Computes the toxicity completion on the samples

Parameters:
  • sample_list (List[Sample]) – list of samples to compute toxicity on

  • model (ModelAPI) – model to use for toxicity completion

static transform(sample_list: List[Sample], test_name) List[Sample]#

Method that implements prompt toxicity transformations on the given samples

Parameters:

sample_list (List[Sample]) – list of samples to compute toxicity prompt on

Returns:

list of transformed samples

Return type:

List[Sample]