Interface GuardrailProps

All Superinterfaces:
software.amazon.jsii.JsiiSerializable
All Known Implementing Classes:
GuardrailProps.Jsii$Proxy

@Generated(value="jsii-pacmak/1.113.0 (build fc68b25)", date="2025-09-02T11:25:42.810Z") @Stability(Experimental) public interface GuardrailProps extends software.amazon.jsii.JsiiSerializable
(experimental) Properties for creating a Guardrail.

Example:

 Guardrail guardrail = Guardrail.Builder.create(this, "bedrockGuardrails")
         .guardrailName("my-BedrockGuardrails")
         .build();
 // Add regex filter with input/output actions
 guardrail.addRegexFilter(RegexFilter.builder()
         .name("TestRegexFilter")
         .pattern("test-pattern")
         .action(GuardrailAction.ANONYMIZE)
         // below props are optional
         .description("This is a test regex filter")
         .inputAction(GuardrailAction.BLOCK)
         .inputEnabled(true)
         .outputAction(GuardrailAction.ANONYMIZE)
         .outputEnabled(true)
         .build());
 
  • Method Details

    • getGuardrailName

      @Stability(Experimental) @NotNull String getGuardrailName()
      (experimental) The name of the guardrail.

      This will be used as the physical name of the guardrail.

    • getBlockedInputMessaging

      @Stability(Experimental) @Nullable default String getBlockedInputMessaging()
      (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."

    • getBlockedOutputsMessaging

      @Stability(Experimental) @Nullable default String getBlockedOutputsMessaging()
      (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."

    • getContentFilters

      @Stability(Experimental) @Nullable default List<ContentFilter> getContentFilters()
      (experimental) The content filters to apply to the guardrail.

      Default: []

    • getContentFiltersTierConfig

      @Stability(Experimental) @Nullable default TierConfig getContentFiltersTierConfig()
      (experimental) The tier configuration to apply to the guardrail.

      Default: filters.TierConfig.CLASSIC

    • getContextualGroundingFilters

      @Stability(Experimental) @Nullable default List<ContextualGroundingFilter> getContextualGroundingFilters()
      (experimental) The contextual grounding filters to apply to the guardrail.

      Default: []

    • getCrossRegionConfig

      @Stability(Experimental) @Nullable default GuardrailCrossRegionConfigProperty getCrossRegionConfig()
      (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

    • getDeniedTopics

      @Stability(Experimental) @Nullable default List<Topic> getDeniedTopics()
      (experimental) A list of policies related to topics that the guardrail should deny.

      Default: []

    • getDescription

      @Stability(Experimental) @Nullable default String getDescription()
      (experimental) The description of the guardrail.

      Default: - No description

    • getKmsKey

      @Stability(Experimental) @Nullable default IKey getKmsKey()
      (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

    • getManagedWordListFilters

      @Stability(Experimental) @Nullable default List<ManagedWordFilter> getManagedWordListFilters()
      (experimental) The managed word filters to apply to the guardrail.

      Default: []

    • getPiiFilters

      @Stability(Experimental) @Nullable default List<PIIFilter> getPiiFilters()
      (experimental) The PII filters to apply to the guardrail.

      Default: []

    • getRegexFilters

      @Stability(Experimental) @Nullable default List<RegexFilter> getRegexFilters()
      (experimental) The regular expression (regex) filters to apply to the guardrail.

      Default: []

    • getTopicsTierConfig

      @Stability(Experimental) @Nullable default TierConfig getTopicsTierConfig()
      (experimental) The tier configuration to apply to the guardrail.

      Default: filters.TierConfig.CLASSIC

    • getWordFilters

      @Stability(Experimental) @Nullable default List<WordFilter> getWordFilters()
      (experimental) The word filters to apply to the guardrail.

      Default: []

    • builder

      @Stability(Experimental) static GuardrailProps.Builder builder()
      Returns:
      a GuardrailProps.Builder of GuardrailProps