class CfnGuardrailPropsMixin
| Language | Type name |
|---|---|
.NET | Amazon.CDK.Mixins.Preview.AWS.Bedrock.Mixins.CfnGuardrailPropsMixin |
Go | github.com/aws/aws-cdk-go/awscdkmixinspreview/v2/awsbedrock/mixins#CfnGuardrailPropsMixin |
Java | software.amazon.awscdk.mixins.preview.services.bedrock.mixins.CfnGuardrailPropsMixin |
Python | aws_cdk.mixins_preview.aws_bedrock.mixins.CfnGuardrailPropsMixin |
TypeScript | @aws-cdk/mixins-preview » aws_bedrock » mixins » CfnGuardrailPropsMixin |
Implements
IMixin
Extends
Mixin
Creates a guardrail to detect and filter harmful content in your generative AI application.
Amazon Bedrock Guardrails provides the following safeguards (also known as policies) to detect and filter harmful content:
- Content filters - Detect and filter harmful text or image content in input prompts or model responses. Filtering is done based on detection of certain predefined harmful content categories: Hate, Insults, Sexual, Violence, Misconduct and Prompt Attack. You also can adjust the filter strength for each of these categories.
- Denied topics - Define a set of topics that are undesirable in the context of your application. The filter will help block them if detected in user queries or model responses.
- Word filters - Configure filters to help block undesirable words, phrases, and profanity (exact match). Such words can include offensive terms, competitor names, etc.
- Sensitive information filters - Configure filters to help block or mask sensitive information, such as personally identifiable information (PII), or custom regex in user inputs and model responses. Blocking or masking is done based on probabilistic detection of sensitive information in standard formats in entities such as SSN number, Date of Birth, address, etc. This also allows configuring regular expression based detection of patterns for identifiers.
- Contextual grounding check - Help detect and filter hallucinations in model responses based on grounding in a source and relevance to the user query.
For more information, see How Amazon Bedrock Guardrails works .
See also: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-bedrock-guardrail.html
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { mixins } from '@aws-cdk/mixins-preview';
import { mixins as bedrock_mixins } from '@aws-cdk/mixins-preview/aws-bedrock';
const cfnGuardrailPropsMixin = new bedrock_mixins.CfnGuardrailPropsMixin({
automatedReasoningPolicyConfig: {
confidenceThreshold: 123,
policies: ['policies'],
},
blockedInputMessaging: 'blockedInputMessaging',
blockedOutputsMessaging: 'blockedOutputsMessaging',
contentPolicyConfig: {
contentFiltersTierConfig: {
tierName: 'tierName',
},
filtersConfig: [{
inputAction: 'inputAction',
inputEnabled: false,
inputModalities: ['inputModalities'],
inputStrength: 'inputStrength',
outputAction: 'outputAction',
outputEnabled: false,
outputModalities: ['outputModalities'],
outputStrength: 'outputStrength',
type: 'type',
}],
},
contextualGroundingPolicyConfig: {
filtersConfig: [{
action: 'action',
enabled: false,
threshold: 123,
type: 'type',
}],
},
crossRegionConfig: {
guardrailProfileArn: 'guardrailProfileArn',
},
description: 'description',
kmsKeyArn: 'kmsKeyArn',
name: 'name',
sensitiveInformationPolicyConfig: {
piiEntitiesConfig: [{
action: 'action',
inputAction: 'inputAction',
inputEnabled: false,
outputAction: 'outputAction',
outputEnabled: false,
type: 'type',
}],
regexesConfig: [{
action: 'action',
description: 'description',
inputAction: 'inputAction',
inputEnabled: false,
name: 'name',
outputAction: 'outputAction',
outputEnabled: false,
pattern: 'pattern',
}],
},
tags: [{
key: 'key',
value: 'value',
}],
topicPolicyConfig: {
topicsConfig: [{
definition: 'definition',
examples: ['examples'],
inputAction: 'inputAction',
inputEnabled: false,
name: 'name',
outputAction: 'outputAction',
outputEnabled: false,
type: 'type',
}],
topicsTierConfig: {
tierName: 'tierName',
},
},
wordPolicyConfig: {
managedWordListsConfig: [{
inputAction: 'inputAction',
inputEnabled: false,
outputAction: 'outputAction',
outputEnabled: false,
type: 'type',
}],
wordsConfig: [{
inputAction: 'inputAction',
inputEnabled: false,
outputAction: 'outputAction',
outputEnabled: false,
text: 'text',
}],
},
}, /* all optional props */ {
strategy: mixins.PropertyMergeStrategy.OVERRIDE,
});
Initializer
new CfnGuardrailPropsMixin(props: CfnGuardrailMixinProps, options?: CfnPropertyMixinOptions)
Parameters
- props
Cfn— L1 properties to apply.Guardrail Mixin Props - options
Cfn— Mixin options.Property Mixin Options
Create a mixin to apply properties to AWS::Bedrock::Guardrail.
Properties
| Name | Type | Description |
|---|---|---|
| props | Cfn | |
| strategy | Property | |
| static CFN_PROPERTY_KEYS | string[] |
props
Type:
Cfn
strategy
Type:
Property
static CFN_PROPERTY_KEYS
Type:
string[]
Methods
| Name | Description |
|---|---|
| apply | Apply the mixin properties to the construct. |
| supports(construct) | Check if this mixin supports the given construct. |
applyTo(construct)
public applyTo(construct: IConstruct): IConstruct
Parameters
- construct
IConstruct
Returns
Apply the mixin properties to the construct.
supports(construct)
public supports(construct: IConstruct): boolean
Parameters
- construct
IConstruct
Returns
boolean
Check if this mixin supports the given construct.

.NET
Go
Java
Python
TypeScript