garak.generators.ollama
Ollama interface
- class OllamaGenerator(name='', config_root=<module 'garak._config' from '/home/docs/checkouts/readthedocs.org/user_builds/garak/checkouts/latest/garak/_config.py'>)Source
Bases:
GeneratorInterface for Ollama endpoints
Model names can be passed in short form like “llama2” or specific versions or sizes like “gemma:7b” or “llama2:latest”
suppressed_params (set[str], default empty): garak attribute names to omit from the Ollama request options dict, regardless of whether the corresponding attribute is set. Suppression is applied at request-assembly time, so it overrides per-probe parameter mutation (such as promptinject’s _generator_precall_hook). Use garak attribute names (max_tokens, temperature, top_k).
Example garak.site.yaml config to suppress top_k:
plugins: generators: ollama: OllamaGenerator: suppressed_params: - top_k
Configurable parameters:
DEFAULT_PARAMScontents:max_tokens=150temperature=Nonetop_k=Nonecontext_len=Noneskip_seq_start=Noneskip_seq_end=Nonetimeout=30host='127.0.0.1:11434'verify_ssl=Noneextra_params=Nonesuppressed_params=set()
Default values are listed
See also Configuring garak for how to set these values.
Other attributes:
- ENV_VAR = 'OLLAMA_API_KEY'
- active = True
- extra_dependency_names = ['ollama']
- generator_family_name = 'Ollama'
- parallel_capable = False
- class OllamaGeneratorChat(name='', config_root=<module 'garak._config' from '/home/docs/checkouts/readthedocs.org/user_builds/garak/checkouts/latest/garak/_config.py'>)Source
Bases:
OllamaGeneratorInterface for Ollama endpoints, using the chat functionality
Model names can be passed in short form like “llama2” or specific versions or sizes like “gemma:7b” or “llama2:latest”