langtest.transform.toxicity.GeneralToxicity#

class GeneralToxicity#

Bases: BaseToxicity

Class for general toxicity

__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 general toxicity on the samples

transform(sample_list, **kwargs)

Method that implements general 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 general toxicity on the samples

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

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

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

Method that implements general toxicity transformations on the given samples

Parameters:

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

Returns:

list of transformed samples

Return type:

List[Sample]