langtest.transform.disinformation.DisinformationTestFactory#

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

Bases: ITests

Factory class for disinformation test

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

Methods

__init__(data_handler[, tests])

async_run(model, *args, **kwargs)

available_tests()

Returns a list of available test scenarios for the test 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

supported_tasks

class TestConfig#

Bases: dict

clear() None.  Remove all items from D.#
copy() a shallow copy of D#
fromkeys(value=None, /)#

Create a new dictionary with keys from iterable and values set to value.

get(key, default=None, /)#

Return the value for key if key is in the dictionary, else default.

items() a set-like object providing a view on D's items#
keys() a set-like object providing a view on D's keys#
pop(k[, d]) v, remove specified key and return the corresponding value.#

If the key is not found, return the default if given; otherwise, raise a KeyError.

popitem()#

Remove and return a (key, value) pair as a 2-tuple.

Pairs are returned in LIFO (last-in, first-out) order. Raises KeyError if the dict is empty.

setdefault(key, default=None, /)#

Insert key with a value of default if key is not in the dictionary.

Return the value for key if key is in the dictionary, else default.

update([E, ]**F) None.  Update D from dict/iterable E and F.#

If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values() an object providing a view on D's values#
classmethod available_tests() Dict[str, str]#

Returns a list of available test scenarios for the test class.

Returns:

A list of available test scenarios for the test class.

Return type:

List[str]

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]