enum GuardrailAction
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.Bedrock.Alpha.GuardrailAction |
![]() | github.com/aws/aws-cdk-go/awsbedrockalpha/v2#GuardrailAction |
![]() | software.amazon.awscdk.services.bedrock.alpha.GuardrailAction |
![]() | aws_cdk.aws_bedrock_alpha.GuardrailAction |
![]() | @aws-cdk/aws-bedrock-alpha ยป GuardrailAction |
Guardrail action when a sensitive entity is detected.
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,
})
);
Members
Name | Description |
---|---|
BLOCK | If sensitive information is detected in the prompt or response, the guardrail blocks all the content and returns a message that you configure. |
ANONYMIZE | 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 | Do not take any action. |
BLOCK
If sensitive information is detected in the prompt or response, the guardrail blocks all the content and returns a message that you configure.
ANONYMIZE
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
Do not take any action.