garak.generators.watsonx

Interface with IBM WatsonX models/systems.

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

Bases: Generator

This is a generator for watsonx.ai.

Make sure that you initialize the environment variables:

‘WATSONX_TOKEN’, ‘WATSONX_URL’, ‘WATSONX_PROJECTID’ OR ‘WATSONX_DEPLOYID’.

To use a model that is in the “project” stage initialize the WATSONX_PROJECTID variable with the Project ID of the model. To use a tuned model that is deployed, simply initialize the WATSONX_DEPLOYID variable with the Deployment ID of the model.

Configurable parameters:

DEFAULT_PARAMS contents:

  • max_tokens = 900

  • temperature = None

  • top_k = None

  • context_len = None

  • skip_seq_start = None

  • skip_seq_end = None

  • uri = None

  • version = '2023-05-29'

  • project_id = ''

  • deployment_id = ''

  • prompt_variable = 'input'

  • bearer_token = ''

Default values are listed

See also Configuring garak for how to set these values.

Other attributes:

DID_ENV_VAR = 'WATSONX_DEPLOYID'
ENV_VAR = 'WATSONX_TOKEN'
PID_ENV_VAR = 'WATSONX_PROJECTID'
URI_ENV_VAR = 'WATSONX_URL'
generator_family_name = 'watsonx'