ManagedWordFilter

class aws_cdk.aws_bedrock_alpha.ManagedWordFilter(*, input_action=None, input_enabled=None, output_action=None, output_enabled=None, type=None)

Bases: object

(experimental) Interface for managed word list filters.

Parameters:
  • input_action (Optional[GuardrailAction]) – (experimental) The action to take when a managed word is detected in the input. Default: GuardrailAction.BLOCK

  • input_enabled (Optional[bool]) – (experimental) Whether the managed word filter is enabled for input. Default: true

  • output_action (Optional[GuardrailAction]) – (experimental) The action to take when a managed word is detected in the output. Default: GuardrailAction.BLOCK

  • output_enabled (Optional[bool]) – (experimental) Whether the managed word filter is enabled for output. Default: true

  • type (Optional[ManagedWordFilterType]) – (experimental) The type of managed word filter. Default: ManagedWordFilterType.PROFANITY

Stability:

experimental

ExampleMetadata:

fixture=default infused

Example:

guardrail = bedrock.Guardrail(self, "bedrockGuardrails",
    guardrail_name="my-BedrockGuardrails"
)

# Add managed word list with input/output actions
guardrail.add_managed_word_list_filter(
    type=bedrock.ManagedWordFilterType.PROFANITY,
    input_action=bedrock.GuardrailAction.BLOCK,
    input_enabled=True,
    output_action=bedrock.GuardrailAction.NONE,
    output_enabled=True
)

# Add individual words
guardrail.add_word_filter(text="drugs")
guardrail.add_word_filter(text="competitor")

# Add words from a file
guardrail.add_word_filter_from_file("./scripts/wordsPolicy.csv")

Attributes

input_action

(experimental) The action to take when a managed word is detected in the input.

Default:

GuardrailAction.BLOCK

Stability:

experimental

input_enabled

(experimental) Whether the managed word filter is enabled for input.

Default:

true

Stability:

experimental

output_action

(experimental) The action to take when a managed word is detected in the output.

Default:

GuardrailAction.BLOCK

Stability:

experimental

output_enabled

(experimental) Whether the managed word filter is enabled for output.

Default:

true

Stability:

experimental

type

(experimental) The type of managed word filter.

Default:

ManagedWordFilterType.PROFANITY

Stability:

experimental