Interface CustomTopicProps
- All Superinterfaces:
software.amazon.jsii.JsiiSerializable
- All Known Implementing Classes:
CustomTopicProps.Jsii$Proxy
@Generated(value="jsii-pacmak/1.120.0 (build 192dc88)",
date="2025-12-05T22:26:49.460Z")
@Stability(Experimental)
public interface CustomTopicProps
extends software.amazon.jsii.JsiiSerializable
(experimental) Interface for creating a custom Topic.
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 ClassesModifier and TypeInterfaceDescriptionstatic final classA builder forCustomTopicPropsstatic final classAn implementation forCustomTopicProps -
Method Summary
Modifier and TypeMethodDescriptionstatic CustomTopicProps.Builderbuilder()(experimental) Provide a clear definition to detect and block user inputs and FM responses that fall into this topic.(experimental) Representative phrases that refer to the topic.default GuardrailAction(experimental) The action to take when a topic is detected in the input.default Boolean(experimental) Whether the topic filter is enabled for input.getName()(experimental) The name of the topic to deny.default GuardrailAction(experimental) The action to take when a topic is detected in the output.default Boolean(experimental) Whether the topic filter is enabled for output.Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Method Details
-
getDefinition
(experimental) Provide a clear definition to detect and block user inputs and FM responses that fall into this topic.Avoid starting with "don't".
Example:
"Investment advice refers to inquiries, guidance, or recommendations\nregarding the management or allocation of funds or assets with the goal of\ngenerating returns or achieving specific financial objectives.";
-
getExamples
(experimental) Representative phrases that refer to the topic.These phrases can represent a user input or a model response. Add between 1 and 100 phrases, up to 100 characters each.
Example:
"Where should I invest my money?";
-
getName
(experimental) The name of the topic to deny. -
getInputAction
(experimental) The action to take when a topic is detected in the input.Default: GuardrailAction.BLOCK
-
getInputEnabled
(experimental) Whether the topic filter is enabled for input.Default: true
-
getOutputAction
(experimental) The action to take when a topic is detected in the output.Default: GuardrailAction.BLOCK
-
getOutputEnabled
(experimental) Whether the topic filter is enabled for output.Default: true
-
builder
- Returns:
- a
CustomTopicProps.BuilderofCustomTopicProps
-