Enum GuardrailAction

java.lang.Object
java.lang.Enum<GuardrailAction>
software.amazon.awscdk.services.bedrock.alpha.GuardrailAction
All Implemented Interfaces:
Serializable, Comparable<GuardrailAction>, java.lang.constant.Constable

@Generated(value="jsii-pacmak/1.113.0 (build fc68b25)", date="2025-09-02T11:25:42.807Z") @Stability(Experimental) public enum GuardrailAction extends Enum<GuardrailAction>
(experimental) Guardrail action when a sensitive entity is detected.

Example:

 Guardrail guardrail = Guardrail.Builder.create(this, "bedrockGuardrails")
         .guardrailName("my-BedrockGuardrails")
         // Configure tier for topic filters (optional)
         .topicsTierConfig(TierConfig.STANDARD)
         .build();
 // Use a predefined topic
 guardrail.addDeniedTopicFilter(Topic.FINANCIAL_ADVICE);
 // Create a custom topic with input/output actions
 guardrail.addDeniedTopicFilter(Topic.custom(CustomTopicProps.builder()
         .name("Legal_Advice")
         .definition("Offering guidance or suggestions on legal matters, legal actions, interpretation of laws, or legal rights and responsibilities.")
         .examples(List.of("Can I sue someone for this?", "What are my legal rights in this situation?", "Is this action against the law?", "What should I do to file a legal complaint?", "Can you explain this law to me?"))
         // props below are optional
         .inputAction(GuardrailAction.BLOCK)
         .inputEnabled(true)
         .outputAction(GuardrailAction.NONE)
         .outputEnabled(true)
         .build()));
 
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    (experimental) If sensitive information is detected in the model response, the guardrail masks it with an identifier, the sensitive information is masked and replaced with identifier tags (for example: [NAME-1], [NAME-2], [EMAIL-1], etc.).
    (experimental) If sensitive information is detected in the prompt or response, the guardrail blocks all the content and returns a message that you configure.
    (experimental) Do not take any action.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the enum constant of this type with the specified name.
    Returns an array containing the constants of this enum type, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • BLOCK

      @Stability(Experimental) public static final GuardrailAction BLOCK
      (experimental) If sensitive information is detected in the prompt or response, the guardrail blocks all the content and returns a message that you configure.
    • ANONYMIZE

      @Stability(Experimental) public static final GuardrailAction ANONYMIZE
      (experimental) If sensitive information is detected in the model response, the guardrail masks it with an identifier, the sensitive information is masked and replaced with identifier tags (for example: [NAME-1], [NAME-2], [EMAIL-1], etc.).
    • NONE

      @Stability(Experimental) public static final GuardrailAction NONE
      (experimental) Do not take any action.
  • Method Details

    • values

      public static GuardrailAction[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static GuardrailAction valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null