GuardrailProps
- class aws_cdk.aws_bedrock_alpha.GuardrailProps(*, guardrail_name, blocked_input_messaging=None, blocked_outputs_messaging=None, content_filters=None, content_filters_tier_config=None, contextual_grounding_filters=None, cross_region_config=None, denied_topics=None, description=None, kms_key=None, managed_word_list_filters=None, pii_filters=None, regex_filters=None, topics_tier_config=None, word_filters=None)
Bases:
object
(experimental) Properties for creating a Guardrail.
- Parameters:
guardrail_name (
str
) – (experimental) The name of the guardrail. This will be used as the physical name of the guardrail.blocked_input_messaging (
Optional
[str
]) – (experimental) The message to return when the guardrail blocks a prompt. Must be between 1 and 500 characters. Default: “Sorry, your query violates our usage policy.”blocked_outputs_messaging (
Optional
[str
]) – (experimental) The message to return when the guardrail blocks a model response. Must be between 1 and 500 characters. Default: “Sorry, I am unable to answer your question because of our usage policy.”content_filters (
Optional
[Sequence
[Union
[ContentFilter
,Dict
[str
,Any
]]]]) – (experimental) The content filters to apply to the guardrail. Default: []content_filters_tier_config (
Optional
[TierConfig
]) – (experimental) The tier configuration to apply to the guardrail. Default: filters.TierConfig.CLASSICcontextual_grounding_filters (
Optional
[Sequence
[Union
[ContextualGroundingFilter
,Dict
[str
,Any
]]]]) – (experimental) The contextual grounding filters to apply to the guardrail. Default: []cross_region_config (
Union
[GuardrailCrossRegionConfigProperty
,Dict
[str
,Any
],None
]) – (experimental) The cross-region configuration for the guardrail. This is optional and when provided, it should be of type GuardrailCrossRegionConfigProperty. Default: - No cross-region configurationdenied_topics (
Optional
[Sequence
[Topic
]]) – (experimental) A list of policies related to topics that the guardrail should deny. Default: []description (
Optional
[str
]) – (experimental) The description of the guardrail. Default: - No descriptionkms_key (
Optional
[IKey
]) – (experimental) A custom KMS key to use for encrypting data. Default: - Data is encrypted by default with a key that AWS owns and manages for youmanaged_word_list_filters (
Optional
[Sequence
[Union
[ManagedWordFilter
,Dict
[str
,Any
]]]]) – (experimental) The managed word filters to apply to the guardrail. Default: []pii_filters (
Optional
[Sequence
[Union
[PIIFilter
,Dict
[str
,Any
]]]]) – (experimental) The PII filters to apply to the guardrail. Default: []regex_filters (
Optional
[Sequence
[Union
[RegexFilter
,Dict
[str
,Any
]]]]) – (experimental) The regular expression (regex) filters to apply to the guardrail. Default: []topics_tier_config (
Optional
[TierConfig
]) – (experimental) The tier configuration to apply to the guardrail. Default: filters.TierConfig.CLASSICword_filters (
Optional
[Sequence
[Union
[WordFilter
,Dict
[str
,Any
]]]]) – (experimental) The word filters to apply to the guardrail. Default: []
- Stability:
experimental
- ExampleMetadata:
fixture=default infused
Example:
guardrail = bedrock.Guardrail(self, "bedrockGuardrails", guardrail_name="my-BedrockGuardrails" ) # Add regex filter with input/output actions guardrail.add_regex_filter( name="TestRegexFilter", pattern="test-pattern", action=bedrock.GuardrailAction.ANONYMIZE, # below props are optional description="This is a test regex filter", input_action=bedrock.GuardrailAction.BLOCK, input_enabled=True, output_action=bedrock.GuardrailAction.ANONYMIZE, output_enabled=True )
Attributes
- blocked_input_messaging
(experimental) The message to return when the guardrail blocks a prompt.
Must be between 1 and 500 characters.
- Default:
“Sorry, your query violates our usage policy.”
- Stability:
experimental
- blocked_outputs_messaging
(experimental) The message to return when the guardrail blocks a model response.
Must be between 1 and 500 characters.
- Default:
“Sorry, I am unable to answer your question because of our usage policy.”
- Stability:
experimental
- content_filters
(experimental) The content filters to apply to the guardrail.
- Default:
[]
- Stability:
experimental
- content_filters_tier_config
(experimental) The tier configuration to apply to the guardrail.
- Default:
filters.TierConfig.CLASSIC
- Stability:
experimental
- contextual_grounding_filters
(experimental) The contextual grounding filters to apply to the guardrail.
- Default:
[]
- Stability:
experimental
- cross_region_config
(experimental) The cross-region configuration for the guardrail.
This is optional and when provided, it should be of type GuardrailCrossRegionConfigProperty.
- Default:
No cross-region configuration
- Stability:
experimental
- denied_topics
(experimental) A list of policies related to topics that the guardrail should deny.
- Default:
[]
- Stability:
experimental
- description
(experimental) The description of the guardrail.
- Default:
No description
- Stability:
experimental
- guardrail_name
(experimental) The name of the guardrail.
This will be used as the physical name of the guardrail.
- Stability:
experimental
- kms_key
(experimental) A custom KMS key to use for encrypting data.
- Default:
Data is encrypted by default with a key that AWS owns and manages for you
- Stability:
experimental
- managed_word_list_filters
(experimental) The managed word filters to apply to the guardrail.
- Default:
[]
- Stability:
experimental
- pii_filters
(experimental) The PII filters to apply to the guardrail.
- Default:
[]
- Stability:
experimental
- regex_filters
(experimental) The regular expression (regex) filters to apply to the guardrail.
- Default:
[]
- Stability:
experimental
- topics_tier_config
(experimental) The tier configuration to apply to the guardrail.
- Default:
filters.TierConfig.CLASSIC
- Stability:
experimental
- word_filters
(experimental) The word filters to apply to the guardrail.
- Default:
[]
- Stability:
experimental