Class Guardrail.Builder
java.lang.Object
software.amazon.awscdk.services.bedrock.alpha.Guardrail.Builder
- All Implemented Interfaces:
software.amazon.jsii.Builder<Guardrail>
- Enclosing class:
Guardrail
@Stability(Experimental)
public static final class Guardrail.Builder
extends Object
implements software.amazon.jsii.Builder<Guardrail>
(experimental) A fluent builder for
Guardrail.-
Method Summary
Modifier and TypeMethodDescriptionblockedInputMessaging(String blockedInputMessaging) (experimental) The message to return when the guardrail blocks a prompt.blockedOutputsMessaging(String blockedOutputsMessaging) (experimental) The message to return when the guardrail blocks a model response.build()contentFilters(List<? extends ContentFilter> contentFilters) (experimental) The content filters to apply to the guardrail.contentFiltersTierConfig(TierConfig contentFiltersTierConfig) (experimental) The tier configuration to apply to the guardrail.contextualGroundingFilters(List<? extends ContextualGroundingFilter> contextualGroundingFilters) (experimental) The contextual grounding filters to apply to the guardrail.static Guardrail.BuildercrossRegionConfig(GuardrailCrossRegionConfigProperty crossRegionConfig) (experimental) The cross-region configuration for the guardrail.deniedTopics(List<? extends Topic> deniedTopics) (experimental) A list of policies related to topics that the guardrail should deny.description(String description) (experimental) The description of the guardrail.guardrailName(String guardrailName) (experimental) The name of the guardrail.(experimental) A custom KMS key to use for encrypting data.managedWordListFilters(List<? extends ManagedWordFilter> managedWordListFilters) (experimental) The managed word filters to apply to the guardrail.piiFilters(List<? extends PIIFilter> piiFilters) (experimental) The PII filters to apply to the guardrail.regexFilters(List<? extends RegexFilter> regexFilters) (experimental) The regular expression (regex) filters to apply to the guardrail.topicsTierConfig(TierConfig topicsTierConfig) (experimental) The tier configuration to apply to the guardrail.wordFilters(List<? extends WordFilter> wordFilters) (experimental) The word filters to apply to the guardrail.
-
Method Details
-
create
@Stability(Experimental) public static Guardrail.Builder create(software.constructs.Construct scope, String id) - Parameters:
scope- This parameter is required.id- This parameter is required.- Returns:
- a new instance of
Guardrail.Builder.
-
guardrailName
(experimental) The name of the guardrail.This will be used as the physical name of the guardrail.
- Parameters:
guardrailName- The name of the guardrail. This parameter is required.- Returns:
this
-
blockedInputMessaging
@Stability(Experimental) public Guardrail.Builder blockedInputMessaging(String blockedInputMessaging) (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."
- Parameters:
blockedInputMessaging- The message to return when the guardrail blocks a prompt. This parameter is required.- Returns:
this
-
blockedOutputsMessaging
@Stability(Experimental) public Guardrail.Builder blockedOutputsMessaging(String blockedOutputsMessaging) (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."
- Parameters:
blockedOutputsMessaging- The message to return when the guardrail blocks a model response. This parameter is required.- Returns:
this
-
contentFilters
@Stability(Experimental) public Guardrail.Builder contentFilters(List<? extends ContentFilter> contentFilters) (experimental) The content filters to apply to the guardrail.Default: []
- Parameters:
contentFilters- The content filters to apply to the guardrail. This parameter is required.- Returns:
this
-
contentFiltersTierConfig
@Stability(Experimental) public Guardrail.Builder contentFiltersTierConfig(TierConfig contentFiltersTierConfig) (experimental) The tier configuration to apply to the guardrail.Default: filters.TierConfig.CLASSIC
- Parameters:
contentFiltersTierConfig- The tier configuration to apply to the guardrail. This parameter is required.- Returns:
this
-
contextualGroundingFilters
@Stability(Experimental) public Guardrail.Builder contextualGroundingFilters(List<? extends ContextualGroundingFilter> contextualGroundingFilters) (experimental) The contextual grounding filters to apply to the guardrail.Default: []
- Parameters:
contextualGroundingFilters- The contextual grounding filters to apply to the guardrail. This parameter is required.- Returns:
this
-
crossRegionConfig
@Stability(Experimental) public Guardrail.Builder crossRegionConfig(GuardrailCrossRegionConfigProperty crossRegionConfig) (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
- Parameters:
crossRegionConfig- The cross-region configuration for the guardrail. This parameter is required.- Returns:
this
-
deniedTopics
(experimental) A list of policies related to topics that the guardrail should deny.Default: []
- Parameters:
deniedTopics- A list of policies related to topics that the guardrail should deny. This parameter is required.- Returns:
this
-
description
(experimental) The description of the guardrail.Default: - No description
- Parameters:
description- The description of the guardrail. This parameter is required.- Returns:
this
-
kmsKey
(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
- Parameters:
kmsKey- A custom KMS key to use for encrypting data. This parameter is required.- Returns:
this
-
managedWordListFilters
@Stability(Experimental) public Guardrail.Builder managedWordListFilters(List<? extends ManagedWordFilter> managedWordListFilters) (experimental) The managed word filters to apply to the guardrail.Default: []
- Parameters:
managedWordListFilters- The managed word filters to apply to the guardrail. This parameter is required.- Returns:
this
-
piiFilters
(experimental) The PII filters to apply to the guardrail.Default: []
- Parameters:
piiFilters- The PII filters to apply to the guardrail. This parameter is required.- Returns:
this
-
regexFilters
@Stability(Experimental) public Guardrail.Builder regexFilters(List<? extends RegexFilter> regexFilters) (experimental) The regular expression (regex) filters to apply to the guardrail.Default: []
- Parameters:
regexFilters- The regular expression (regex) filters to apply to the guardrail. This parameter is required.- Returns:
this
-
topicsTierConfig
(experimental) The tier configuration to apply to the guardrail.Default: filters.TierConfig.CLASSIC
- Parameters:
topicsTierConfig- The tier configuration to apply to the guardrail. This parameter is required.- Returns:
this
-
wordFilters
@Stability(Experimental) public Guardrail.Builder wordFilters(List<? extends WordFilter> wordFilters) (experimental) The word filters to apply to the guardrail.Default: []
- Parameters:
wordFilters- The word filters to apply to the guardrail. This parameter is required.- Returns:
this
-
build
-