Class CfnGuardrailPropsMixin
java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.mixins.preview.core.Mixin
software.amazon.awscdk.mixins.preview.services.bedrock.mixins.CfnGuardrailPropsMixin
- All Implemented Interfaces:
IMixin,software.amazon.jsii.JsiiSerializable
@Generated(value="jsii-pacmak/1.121.0 (build d7af9b9)",
date="2025-12-18T18:20:23.400Z")
@Stability(Stable)
public class CfnGuardrailPropsMixin
extends Mixin
implements IMixin
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 .
Example:
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.mixins.preview.mixins.*;
import software.amazon.awscdk.mixins.preview.services.bedrock.mixins.*;
CfnGuardrailPropsMixin cfnGuardrailPropsMixin = CfnGuardrailPropsMixin.Builder.create(CfnGuardrailMixinProps.builder()
.automatedReasoningPolicyConfig(AutomatedReasoningPolicyConfigProperty.builder()
.confidenceThreshold(123)
.policies(List.of("policies"))
.build())
.blockedInputMessaging("blockedInputMessaging")
.blockedOutputsMessaging("blockedOutputsMessaging")
.contentPolicyConfig(ContentPolicyConfigProperty.builder()
.contentFiltersTierConfig(ContentFiltersTierConfigProperty.builder()
.tierName("tierName")
.build())
.filtersConfig(List.of(ContentFilterConfigProperty.builder()
.inputAction("inputAction")
.inputEnabled(false)
.inputModalities(List.of("inputModalities"))
.inputStrength("inputStrength")
.outputAction("outputAction")
.outputEnabled(false)
.outputModalities(List.of("outputModalities"))
.outputStrength("outputStrength")
.type("type")
.build()))
.build())
.contextualGroundingPolicyConfig(ContextualGroundingPolicyConfigProperty.builder()
.filtersConfig(List.of(ContextualGroundingFilterConfigProperty.builder()
.action("action")
.enabled(false)
.threshold(123)
.type("type")
.build()))
.build())
.crossRegionConfig(GuardrailCrossRegionConfigProperty.builder()
.guardrailProfileArn("guardrailProfileArn")
.build())
.description("description")
.kmsKeyArn("kmsKeyArn")
.name("name")
.sensitiveInformationPolicyConfig(SensitiveInformationPolicyConfigProperty.builder()
.piiEntitiesConfig(List.of(PiiEntityConfigProperty.builder()
.action("action")
.inputAction("inputAction")
.inputEnabled(false)
.outputAction("outputAction")
.outputEnabled(false)
.type("type")
.build()))
.regexesConfig(List.of(RegexConfigProperty.builder()
.action("action")
.description("description")
.inputAction("inputAction")
.inputEnabled(false)
.name("name")
.outputAction("outputAction")
.outputEnabled(false)
.pattern("pattern")
.build()))
.build())
.tags(List.of(CfnTag.builder()
.key("key")
.value("value")
.build()))
.topicPolicyConfig(TopicPolicyConfigProperty.builder()
.topicsConfig(List.of(TopicConfigProperty.builder()
.definition("definition")
.examples(List.of("examples"))
.inputAction("inputAction")
.inputEnabled(false)
.name("name")
.outputAction("outputAction")
.outputEnabled(false)
.type("type")
.build()))
.topicsTierConfig(TopicsTierConfigProperty.builder()
.tierName("tierName")
.build())
.build())
.wordPolicyConfig(WordPolicyConfigProperty.builder()
.managedWordListsConfig(List.of(ManagedWordsConfigProperty.builder()
.inputAction("inputAction")
.inputEnabled(false)
.outputAction("outputAction")
.outputEnabled(false)
.type("type")
.build()))
.wordsConfig(List.of(WordConfigProperty.builder()
.inputAction("inputAction")
.inputEnabled(false)
.outputAction("outputAction")
.outputEnabled(false)
.text("text")
.build()))
.build())
.build())
.strategy(PropertyMergeStrategy.OVERRIDE)
.build();
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceConfiguration settings for integrating Automated Reasoning policies with Amazon Bedrock Guardrails.static final classA fluent builder forCfnGuardrailPropsMixin.static interfaceContains filter strengths for harmful content.static interfaceThe tier that your guardrail uses for content filters.static interfaceContains details about how to handle harmful content.static interfaceThe filter configuration details for the guardrails contextual grounding filter.static interfaceThe policy configuration details for the guardrails contextual grounding policy.static interfaceThe system-defined guardrail profile that you're using with your guardrail.static interfaceThe managed word list to configure for the guardrail.static interfaceThe PII entity to configure for the guardrail.static interfaceThe regular expression to configure for the guardrail.static interfaceContains details about PII entities and regular expressions to configure for the guardrail.static interfaceDetails about topics for the guardrail to identify and deny.static interfaceContains details about topics that the guardrail should identify and deny.static interfaceThe tier that your guardrail uses for denied topic filters.static interfaceA word to configure for the guardrail.static interfaceContains details about the word policy to configured for the guardrail.Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.amazon.awscdk.mixins.preview.core.IMixin
IMixin.Jsii$Default, IMixin.Jsii$Proxy -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionCreate a mixin to apply properties toAWS::Bedrock::Guardrail.CfnGuardrailPropsMixin(CfnGuardrailMixinProps props, CfnPropertyMixinOptions options) Create a mixin to apply properties toAWS::Bedrock::Guardrail.protectedCfnGuardrailPropsMixin(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedCfnGuardrailPropsMixin(software.amazon.jsii.JsiiObjectRef objRef) -
Method Summary
Modifier and TypeMethodDescriptionsoftware.constructs.IConstructapplyTo(software.constructs.IConstruct construct) Apply the mixin properties to the construct.protected CfnGuardrailMixinPropsgetProps()protected PropertyMergeStrategysupports(software.constructs.IConstruct construct) Check if this mixin supports the given construct.Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
CFN_PROPERTY_KEYS
-
-
Constructor Details
-
CfnGuardrailPropsMixin
protected CfnGuardrailPropsMixin(software.amazon.jsii.JsiiObjectRef objRef) -
CfnGuardrailPropsMixin
protected CfnGuardrailPropsMixin(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
CfnGuardrailPropsMixin
@Stability(Stable) public CfnGuardrailPropsMixin(@NotNull CfnGuardrailMixinProps props, @Nullable CfnPropertyMixinOptions options) Create a mixin to apply properties toAWS::Bedrock::Guardrail.- Parameters:
props- L1 properties to apply. This parameter is required.options- Mixin options.
-
CfnGuardrailPropsMixin
Create a mixin to apply properties toAWS::Bedrock::Guardrail.- Parameters:
props- L1 properties to apply. This parameter is required.
-
-
Method Details
-
applyTo
@Stability(Stable) @NotNull public software.constructs.IConstruct applyTo(@NotNull software.constructs.IConstruct construct) Apply the mixin properties to the construct. -
supports
@Stability(Stable) @NotNull public Boolean supports(@NotNull software.constructs.IConstruct construct) Check if this mixin supports the given construct. -
getProps
-
getStrategy
-