java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.bedrock.alpha.Topic
All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable

@Generated(value="jsii-pacmak/1.113.0 (build fc68b25)", date="2025-09-02T11:25:42.857Z") @Stability(Experimental) public class Topic extends software.amazon.jsii.JsiiObject
(experimental) Represents predefined topics that can be used to filter content.

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 software.amazon.jsii.JsiiObject

    software.amazon.jsii.JsiiObject.InitializationMode
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Topic
    (experimental) Filter for financial advice and investment recommendations.
    static final Topic
    (experimental) Filter for inappropriate or explicit content.
    static final Topic
    (experimental) Filter for legal advice and recommendations.
    static final Topic
    (experimental) Filter for medical advice and health recommendations.
    static final Topic
    (experimental) Filter for political advice and recommendations.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
     
    protected
    Topic(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
     
    protected
    Topic(software.amazon.jsii.JsiiObjectRef objRef)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static Topic
    (experimental) Create a custom topic filter.
    (experimental) Definition of the topic.
    (experimental) Representative phrases that refer to the topic.
    (experimental) The action to take when a topic is detected in the input.
    (experimental) Whether the topic filter is enabled for input.
    (experimental) The name of the topic to deny.
    (experimental) The action to take when a topic is detected in the output.
    (experimental) Whether the topic filter is enabled for output.

    Methods inherited from class software.amazon.jsii.JsiiObject

    jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface software.amazon.jsii.JsiiSerializable

    $jsii$toJson
  • Field Details

    • FINANCIAL_ADVICE

      @Stability(Experimental) public static final Topic FINANCIAL_ADVICE
      (experimental) Filter for financial advice and investment recommendations.
    • INAPPROPRIATE_CONTENT

      @Stability(Experimental) public static final Topic INAPPROPRIATE_CONTENT
      (experimental) Filter for inappropriate or explicit content.
    • MEDICAL_ADVICE

      @Stability(Experimental) public static final Topic MEDICAL_ADVICE
      (experimental) Filter for medical advice and health recommendations.
    • POLITICAL_ADVICE

      @Stability(Experimental) public static final Topic POLITICAL_ADVICE
      (experimental) Filter for political advice and recommendations.
  • Constructor Details

    • Topic

      protected Topic(software.amazon.jsii.JsiiObjectRef objRef)
    • Topic

      protected Topic(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • Topic

      @Stability(Experimental) protected Topic(@NotNull CustomTopicProps props)
      Parameters:
      props - This parameter is required.
  • Method Details

    • custom

      @Stability(Experimental) @NotNull public static Topic custom(@NotNull CustomTopicProps props)
      (experimental) Create a custom topic filter.

      Parameters:
      props - Properties for the custom topic filter. This parameter is required.
    • getDefinition

      @Stability(Experimental) @NotNull public String getDefinition()
      (experimental) Definition of the topic.
    • getName

      @Stability(Experimental) @NotNull public String getName()
      (experimental) The name of the topic to deny.
    • getExamples

      @Stability(Experimental) @Nullable public List<String> getExamples()
      (experimental) Representative phrases that refer to the topic.
    • getInputAction

      @Stability(Experimental) @Nullable public GuardrailAction getInputAction()
      (experimental) The action to take when a topic is detected in the input.

      Default: GuardrailAction.BLOCK

    • getInputEnabled

      @Stability(Experimental) @Nullable public Boolean getInputEnabled()
      (experimental) Whether the topic filter is enabled for input.

      Default: true

    • getOutputAction

      @Stability(Experimental) @Nullable public GuardrailAction getOutputAction()
      (experimental) The action to take when a topic is detected in the output.

      Default: GuardrailAction.BLOCK

    • getOutputEnabled

      @Stability(Experimental) @Nullable public Boolean getOutputEnabled()
      (experimental) Whether the topic filter is enabled for output.

      Default: true