garak.generators.guardrails
This is a generator for warpping a NeMo Guardrails configuration. Using this garak generator enables security testing of a Guardrails config.
The guardrails generator expects a path to a valid Guardrails configuration
to be passed as its name. For example,
garak -t guardrails -n sample_abc/config
This generator requires installation of the guardrails Python package.
When invoked, garak sends prompts in series to the Guardrails setup using
rails.generate, and waits for a response. The generator does not support
parallisation, so it’s recommended to run smaller probes, or set generations
to a low value, in order to reduce garak run time.
NeMo Guardrails generator.
- class NeMoGuardrails(name='', config_root=<module 'garak._config' from '/home/docs/checkouts/readthedocs.org/user_builds/garak/checkouts/stable/garak/_config.py'>)Source
Bases:
GeneratorGenerator wrapper for NeMo Guardrails.
- extra_dependency_names = ['nemoguardrails']
- generator_family_name = 'Guardrails'
- supports_multiple_generations = False
- class NeMoGuardrailsServer(name='', config_root=<module 'garak._config' from '/home/docs/checkouts/readthedocs.org/user_builds/garak/checkouts/stable/garak/_config.py'>)Source
Bases:
OpenAICompatibleGenerator for NeMo Guardrails Server
To select specific rails in a multi rail deployment set config_ids to match the rail configuration names as documented by the NeMo guardrails SDK.
Configurable parameters:
DEFAULT_PARAMScontents:max_tokens=150temperature=0.7top_k=Nonecontext_len=Noneskip_seq_start=Noneskip_seq_end=Nonetop_p=1.0uri='http://localhost:8000/v1/'frequency_penalty=0.0presence_penalty=0.0seed=Nonestop=['#', ';']suppressed_params=set()retry_json=Trueextra_params={}config_ids=set()
Default values are listed
See also Configuring garak for how to set these values.
Other attributes:
- ENV_VAR = None
- generator_family_name = 'Guardrails'
- supports_multiple_generations = False