garak.generators.bedrock

AWS Bedrock generator

Supports foundation models available through AWS Bedrock using standard AWS authentication.

To get started with this generator:

  1. Visit https://docs.aws.amazon.com/bedrock/latest/userguide/models-supported.html to see available models

  2. Set up AWS credentials: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html or a Bedrock API Key

  3. Run garak with –target_type bedrock and –target_name <model-id>

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

Bases: Generator

Interface for AWS Bedrock foundation models using Converse API.

suppressed_params (set[str], default empty): garak attribute names to omit from the Bedrock Converse API inferenceConfig, regardless of whether the corresponding attribute is set. Useful for target models that reject specific combinations of inference parameters (for example, Anthropic Claude 4.x on Bedrock rejects requests that set both temperature and top_p). 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 (top_p, max_tokens, temperature, stop).

Example garak.site.yaml config to suppress top_p:

plugins:
  generators:
    bedrock:
      BedrockGenerator:
        suppressed_params:
          - top_p

Configurable parameters:

DEFAULT_PARAMS contents:

  • max_tokens = 150

  • temperature = 0.7

  • top_k = None

  • context_len = None

  • skip_seq_start = None

  • skip_seq_end = None

  • top_p = 1.0

  • stop = []

  • region = 'us-east-1'

  • suppressed_params = set()

Default values are listed

See also Configuring garak for how to set these values.

Other attributes:

active = True
extra_dependency_names = ['boto3', 'botocore']
generator_family_name = 'Bedrock'
supports_multiple_generations = False