Skip to content

/AWS1/CL_BDK=>CREATEGUARDRAIL()

About CreateGuardrail

Creates a guardrail to block topics and to implement safeguards for your generative AI applications.

You can configure the following policies in a guardrail to avoid undesirable and harmful content, filter out denied topics and words, and remove sensitive information for privacy protection.

  • Content filters - Adjust filter strengths to block input prompts or model responses containing harmful content.

  • Denied topics - Define a set of topics that are undesirable in the context of your application. These topics will be blocked if detected in user queries or model responses.

  • Word filters - Configure filters to block undesirable words, phrases, and profanity. Such words can include offensive terms, competitor names etc.

  • Sensitive information filters - Block or mask sensitive information such as personally identifiable information (PII) or custom regex in user inputs and model responses.

In addition to the above policies, you can also configure the messages to be returned to the user if a user input or model response is in violation of the policies defined in the guardrail.

For more information, see Guardrails for Amazon Bedrock in the Amazon Bedrock User Guide.

Method Signature

IMPORTING

Required arguments:

IV_NAME TYPE /AWS1/BDKGUARDRAILNAME /AWS1/BDKGUARDRAILNAME

The name to give the guardrail.

IV_BLOCKEDINPUTMESSAGING TYPE /AWS1/BDKGUARDRAILBLKEDMESSA00 /AWS1/BDKGUARDRAILBLKEDMESSA00

The message to return when the guardrail blocks a prompt.

IV_BLOCKEDOUTPUTSMESSAGING TYPE /AWS1/BDKGUARDRAILBLKEDMESSA00 /AWS1/BDKGUARDRAILBLKEDMESSA00

The message to return when the guardrail blocks a model response.

Optional arguments:

IV_DESCRIPTION TYPE /AWS1/BDKGUARDRAILDESCRIPTION /AWS1/BDKGUARDRAILDESCRIPTION

A description of the guardrail.

IO_TOPICPOLICYCONFIG TYPE REF TO /AWS1/CL_BDKGUARDRAILTPCPLYCFG /AWS1/CL_BDKGUARDRAILTPCPLYCFG

The topic policies to configure for the guardrail.

IO_CONTENTPOLICYCONFIG TYPE REF TO /AWS1/CL_BDKGUARDRAILCONTPLY00 /AWS1/CL_BDKGUARDRAILCONTPLY00

The content filter policies to configure for the guardrail.

IO_WORDPOLICYCONFIG TYPE REF TO /AWS1/CL_BDKGUARDRAILWORDPLY00 /AWS1/CL_BDKGUARDRAILWORDPLY00

The word policy you configure for the guardrail.

IO_SENSITIVEINFMTIONPLYCFG TYPE REF TO /AWS1/CL_BDKGUARDRAILSENSITI00 /AWS1/CL_BDKGUARDRAILSENSITI00

The sensitive information policy to configure for the guardrail.

IO_CTXUALGROUNDINGPLYCONFIG TYPE REF TO /AWS1/CL_BDKGUARDRAILCTXUALG00 /AWS1/CL_BDKGUARDRAILCTXUALG00

The contextual grounding policy configuration used to create a guardrail.

IV_KMSKEYID TYPE /AWS1/BDKKMSKEYID /AWS1/BDKKMSKEYID

The ARN of the KMS key that you use to encrypt the guardrail.

IT_TAGS TYPE /AWS1/CL_BDKTAG=>TT_TAGLIST TT_TAGLIST

The tags that you want to attach to the guardrail.

IV_CLIENTREQUESTTOKEN TYPE /AWS1/BDKIDEMPOTENCYTOKEN /AWS1/BDKIDEMPOTENCYTOKEN

A unique, case-sensitive identifier to ensure that the API request completes no more than once. If this token matches a previous request, Amazon Bedrock ignores the request, but does not return an error. For more information, see Ensuring idempotency in the Amazon S3 User Guide.

RETURNING

OO_OUTPUT TYPE REF TO /AWS1/CL_BDKCREATEGUARDRAILRSP /AWS1/CL_BDKCREATEGUARDRAILRSP