langtest.transform.security.SecurityTestFactory#

class SecurityTestFactory(data_handler: List[Sample], tests: Dict | None = None, **kwargs)#

Bases: ITests

Factory class for the security tests

__init__(data_handler: List[Sample], tests: Dict | None = None, **kwargs) None#

Methods

__init__(data_handler[, tests])

available_tests()

Register the sub-classes of the BaseSecurity class

run(sample_list, model, **kwargs)

Runs the specified tests on the given data and returns a list of results.

transform()

Runs the test and returns the results.

Attributes

alias_name

classmethod available_tests() Dict[str, str]#

Register the sub-classes of the BaseSecurity class

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

Runs the specified tests on the given data and returns a list of results.

Parameters:
  • sample_list (Dict[str, List[Sample]]) – A dictionary mapping test scenario names to a list of Sample objects.

  • model (ModelAPI) – A ModelAPI object representing the model to be tested.

Returns:

A list of Sample objects with the test results.

Return type:

List[Sample]

transform() List[Sample]#

Runs the test and returns the results.

Returns:

A list of results from running the test.

Return type:

List[Results]