garak.generators.llm
Wraps Simon Willison’s llm library, which provides a unified interface
to many LLM providers (OpenAI, Claude, Gemini, Ollama, etc.) via plugins.
API keys and provider setup are managed by llm directly. Install the
base package and any provider plugins you need:
pip install llm llm-claude-3
Then invoke garak with the llm model id:
garak --model_type llm --model_name gpt-4o-mini
LLM generator support
Wraps Simon Willison’s llm library (https://pypi.org/project/llm/),
which provides a unified interface to many LLM providers via plugins.
API keys and provider configuration are managed by llm itself
(e.g. llm keys set openai). Pass the llm model id or alias
as --target_name:
pip install llm llm-claude-3 # install llm + any provider plugins
garak --target_type llm --target_name gpt-4o-mini
- class LLMGenerator(name='', config_root=<module 'garak._config' from '/home/docs/checkouts/readthedocs.org/user_builds/garak/checkouts/latest/garak/_config.py'>)Source
Bases:
GeneratorInterface for llm-managed models.
Supports any model accessible through
llmand its provider plugins, including OpenAI, Claude, Gemini, and Ollama models. Provider setup, authentication, and model-specific options are handled byllm.Configurable parameters:
DEFAULT_PARAMScontents:max_tokens=150temperature=Nonetop_k=Nonecontext_len=Noneskip_seq_start=Noneskip_seq_end=Nonetop_p=Nonestop=[]suppressed_params=set()extra_params={}
Default values are listed
See also Configuring garak for how to set these values.
Other attributes:
- active = True
- extra_dependency_names = ['llm']
- generator_family_name = 'llm'
- parallel_capable = False