langtest.transform.toxicity.BaseToxicity#

class BaseToxicity#

Bases: ABC

Abstract base class to extend for toxicity completion

__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)

Abstract method that implements samples transformations

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

abstract 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

abstract static transform(sample_list: List[Sample]) List[Sample]#

Abstract method that implements samples transformations

Parameters:

sample_list (List[Sample]) – list of samples to transform

Returns:

list of transformed samples

Return type:

List[Sample]