garak.generators.test

Test generators

These give simple system responses, intended for testing.

class Blank(name='', config_root=<module 'garak._config' from '/home/docs/checkouts/readthedocs.org/user_builds/garak/checkouts/stable/garak/_config.py'>)Source

Bases: Generator

This generator always returns the empty string.

generator_family_name = 'Test'
name = 'Blank'
supports_multiple_generations = True
class BlankVision(name='', config_root=<module 'garak._config' from '/home/docs/checkouts/readthedocs.org/user_builds/garak/checkouts/stable/garak/_config.py'>)Source

Bases: Generator

This text+image input generator always returns the empty string.

generator_family_name = 'Test'
modality: dict = {'in': {'image', 'text'}, 'out': {'text'}}
name = 'BlankVision'
supports_multiple_generations = True
class Lipsum(name='', config_root=<module 'garak._config' from '/home/docs/checkouts/readthedocs.org/user_builds/garak/checkouts/stable/garak/_config.py'>)Source

Bases: Generator

Lorem Ipsum generator, so we can get non-zero outputs that vary

Configurable parameters:
unit: str - content unit to generate per output.

Must be one of “sentence”, “paragraph”, or “text”.

count: int - How many of the specified unit to join per output.

Configurable parameters:

DEFAULT_PARAMS contents:

  • max_tokens = 150

  • temperature = None

  • top_k = None

  • context_len = None

  • skip_seq_start = None

  • skip_seq_end = None

  • unit = 'sentence'

  • count = 1

Default values are listed

See also Configuring garak for how to set these values.

Other attributes:

generator_family_name = 'Test'
name = 'Lorem Ipsum'
supports_multiple_generations = False
class Nones(name='', config_root=<module 'garak._config' from '/home/docs/checkouts/readthedocs.org/user_builds/garak/checkouts/stable/garak/_config.py'>)Source

Bases: Generator

This generator always returns a None for every generation.

generator_family_name = 'Test'
name = 'Nones'
supports_multiple_generations = True
class ReasoningLipsum(name='', config_root=<module 'garak._config' from '/home/docs/checkouts/readthedocs.org/user_builds/garak/checkouts/stable/garak/_config.py'>)Source

Bases: Lipsum

Lorem Ipsum generator with a simulated reasoning trace, for testing probe/detector behavior with long structured outputs.

Generates output in the format:

{skip_seq_start}{reasoning text}{skip_seq_end}{output text}

Configurable parameters:

skip_seq_start: str - Opening delimiter for the reasoning trace.

skip_seq_end: str - Closing delimiter for the reasoning trace.

reasoning_length: int - Target character count for the reasoning trace.

output_length: int - Target character count for the output text.

variance: float - Fraction (0.0–1.0) by which reasoning_length and

output_length may deviate from configured values. 0.1 means ±10%.

respect_max_tokens: bool - Cap the output text (not the

reasoning trace) to approximately max_tokens * 1.4 characters.

Configurable parameters:

DEFAULT_PARAMS contents:

  • max_tokens = 150

  • temperature = None

  • top_k = None

  • context_len = None

  • skip_seq_start = '<think>'

  • skip_seq_end = '</think>'

  • unit = 'sentence'

  • count = 1

  • reasoning_length = 2000

  • output_length = 500

  • variance = 0.1

  • respect_max_tokens = False

Default values are listed

See also Configuring garak for how to set these values.

Other attributes:

generator_family_name = 'Test'
name = 'Reasoning Lipsum'
supports_multiple_generations = False
class Repeat(name='', config_root=<module 'garak._config' from '/home/docs/checkouts/readthedocs.org/user_builds/garak/checkouts/stable/garak/_config.py'>)Source

Bases: Generator

This generator returns the last message from input that was posed to it.

generator_family_name = 'Test'
name = 'Repeat'
supports_multiple_generations = True
class Single(name='', config_root=<module 'garak._config' from '/home/docs/checkouts/readthedocs.org/user_builds/garak/checkouts/stable/garak/_config.py'>)Source

Bases: Generator

This generator returns the a fixed string and does not support multiple generations.

generator_family_name = 'Test'
name = 'Single'
supports_multiple_generations = False
test_generation_string = 'ELIM'