interface CustomTopicProps
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.Bedrock.Alpha.CustomTopicProps |
![]() | github.com/aws/aws-cdk-go/awsbedrockalpha/v2#CustomTopicProps |
![]() | software.amazon.awscdk.services.bedrock.alpha.CustomTopicProps |
![]() | aws_cdk.aws_bedrock_alpha.CustomTopicProps |
![]() | @aws-cdk/aws-bedrock-alpha ยป CustomTopicProps |
Interface for creating a custom Topic.
Example
const guardrail = new bedrock.Guardrail(this, 'bedrockGuardrails', {
guardrailName: 'my-BedrockGuardrails',
// Configure tier for topic filters (optional)
topicsTierConfig: bedrock.TierConfig.STANDARD,
});
// Use a predefined topic
guardrail.addDeniedTopicFilter(bedrock.Topic.FINANCIAL_ADVICE);
// Create a custom topic with input/output actions
guardrail.addDeniedTopicFilter(
bedrock.Topic.custom({
name: 'Legal_Advice',
definition: 'Offering guidance or suggestions on legal matters, legal actions, interpretation of laws, or legal rights and responsibilities.',
examples: [
'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: bedrock.GuardrailAction.BLOCK,
inputEnabled: true,
outputAction: bedrock.GuardrailAction.NONE,
outputEnabled: true,
})
);
Properties
Name | Type | Description |
---|---|---|
definition | string | Provide a clear definition to detect and block user inputs and FM responses that fall into this topic. |
examples | string[] | Representative phrases that refer to the topic. |
name | string | The name of the topic to deny. |
input | Guardrail | The action to take when a topic is detected in the input. |
input | boolean | Whether the topic filter is enabled for input. |
output | Guardrail | The action to take when a topic is detected in the output. |
output | boolean | Whether the topic filter is enabled for output. |
definition
Type:
string
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
regarding the management or allocation of funds or assets with the goal of
generating returns or achieving specific financial objectives.`
examples
Type:
string[]
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?"
name
Type:
string
The name of the topic to deny.
inputAction?
Type:
Guardrail
(optional, default: GuardrailAction.BLOCK)
The action to take when a topic is detected in the input.
inputEnabled?
Type:
boolean
(optional, default: true)
Whether the topic filter is enabled for input.
outputAction?
Type:
Guardrail
(optional, default: GuardrailAction.BLOCK)
The action to take when a topic is detected in the output.
outputEnabled?
Type:
boolean
(optional, default: true)
Whether the topic filter is enabled for output.