interface GuardrailProps
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.Bedrock.Alpha.GuardrailProps |
![]() | github.com/aws/aws-cdk-go/awsbedrockalpha/v2#GuardrailProps |
![]() | software.amazon.awscdk.services.bedrock.alpha.GuardrailProps |
![]() | aws_cdk.aws_bedrock_alpha.GuardrailProps |
![]() | @aws-cdk/aws-bedrock-alpha ยป GuardrailProps |
Properties for creating a Guardrail.
Example
const guardrail = new bedrock.Guardrail(this, 'bedrockGuardrails', {
guardrailName: 'my-BedrockGuardrails',
});
// Add regex filter with input/output actions
guardrail.addRegexFilter({
name: 'TestRegexFilter',
pattern: 'test-pattern',
action: bedrock.GuardrailAction.ANONYMIZE,
// below props are optional
description: 'This is a test regex filter',
inputAction: bedrock.GuardrailAction.BLOCK,
inputEnabled: true,
outputAction: bedrock.GuardrailAction.ANONYMIZE,
outputEnabled: true,
});
Properties
Name | Type | Description |
---|---|---|
guardrail | string | The name of the guardrail. |
blocked | string | The message to return when the guardrail blocks a prompt. |
blocked | string | The message to return when the guardrail blocks a model response. |
content | Content [] | The content filters to apply to the guardrail. |
content | Tier | The tier configuration to apply to the guardrail. |
contextual | Contextual [] | The contextual grounding filters to apply to the guardrail. |
cross | Guardrail | The cross-region configuration for the guardrail. |
denied | Topic [] | A list of policies related to topics that the guardrail should deny. |
description? | string | The description of the guardrail. |
kms | IKey | A custom KMS key to use for encrypting data. |
managed | Managed [] | The managed word filters to apply to the guardrail. |
pii | PIIFilter [] | The PII filters to apply to the guardrail. |
regex | Regex [] | The regular expression (regex) filters to apply to the guardrail. |
topics | Tier | The tier configuration to apply to the guardrail. |
word | Word [] | The word filters to apply to the guardrail. |
guardrailName
Type:
string
The name of the guardrail.
This will be used as the physical name of the guardrail.
blockedInputMessaging?
Type:
string
(optional, default: "Sorry, your query violates our usage policy.")
The message to return when the guardrail blocks a prompt.
Must be between 1 and 500 characters.
blockedOutputsMessaging?
Type:
string
(optional, default: "Sorry, I am unable to answer your question because of our usage policy.")
The message to return when the guardrail blocks a model response.
Must be between 1 and 500 characters.
contentFilters?
Type:
Content
[]
(optional, default: [])
The content filters to apply to the guardrail.
contentFiltersTierConfig?
Type:
Tier
(optional, default: filters.TierConfig.CLASSIC)
The tier configuration to apply to the guardrail.
contextualGroundingFilters?
Type:
Contextual
[]
(optional, default: [])
The contextual grounding filters to apply to the guardrail.
crossRegionConfig?
Type:
Guardrail
(optional, default: No cross-region configuration)
The cross-region configuration for the guardrail.
This is optional and when provided, it should be of type GuardrailCrossRegionConfigProperty.
deniedTopics?
Type:
Topic
[]
(optional, default: [])
A list of policies related to topics that the guardrail should deny.
description?
Type:
string
(optional, default: No description)
The description of the guardrail.
kmsKey?
Type:
IKey
(optional, default: Data is encrypted by default with a key that AWS owns and manages for you)
A custom KMS key to use for encrypting data.
managedWordListFilters?
Type:
Managed
[]
(optional, default: [])
The managed word filters to apply to the guardrail.
piiFilters?
Type:
PIIFilter
[]
(optional, default: [])
The PII filters to apply to the guardrail.
regexFilters?
Type:
Regex
[]
(optional, default: [])
The regular expression (regex) filters to apply to the guardrail.
topicsTierConfig?
Type:
Tier
(optional, default: filters.TierConfig.CLASSIC)
The tier configuration to apply to the guardrail.
wordFilters?
Type:
Word
[]
(optional, default: [])
The word filters to apply to the guardrail.