Create Guardrail
bedrock_create_guardrail | R Documentation |
Creates a guardrail to block topics and to implement safeguards for your generative AI applications¶
Description¶
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.
Usage¶
bedrock_create_guardrail(name, description, topicPolicyConfig,
contentPolicyConfig, wordPolicyConfig, sensitiveInformationPolicyConfig,
contextualGroundingPolicyConfig, blockedInputMessaging,
blockedOutputsMessaging, kmsKeyId, tags, clientRequestToken)
Arguments¶
name
[required] The name to give the guardrail.
description
A description of the guardrail.
topicPolicyConfig
The topic policies to configure for the guardrail.
contentPolicyConfig
The content filter policies to configure for the guardrail.
wordPolicyConfig
The word policy you configure for the guardrail.
sensitiveInformationPolicyConfig
The sensitive information policy to configure for the guardrail.
contextualGroundingPolicyConfig
The contextual grounding policy configuration used to create a guardrail.
blockedInputMessaging
[required] The message to return when the guardrail blocks a prompt.
blockedOutputsMessaging
[required] The message to return when the guardrail blocks a model response.
kmsKeyId
The ARN of the KMS key that you use to encrypt the guardrail.
tags
The tags that you want to attach to the guardrail.
clientRequestToken
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.
Value¶
A list with the following syntax:
list(
guardrailId = "string",
guardrailArn = "string",
version = "string",
createdAt = as.POSIXct(
"2015-01-01"
)
)
Request syntax¶
svc$create_guardrail(
name = "string",
description = "string",
topicPolicyConfig = list(
topicsConfig = list(
list(
name = "string",
definition = "string",
examples = list(
"string"
),
type = "DENY"
)
)
),
contentPolicyConfig = list(
filtersConfig = list(
list(
type = "SEXUAL"|"VIOLENCE"|"HATE"|"INSULTS"|"MISCONDUCT"|"PROMPT_ATTACK",
inputStrength = "NONE"|"LOW"|"MEDIUM"|"HIGH",
outputStrength = "NONE"|"LOW"|"MEDIUM"|"HIGH"
)
)
),
wordPolicyConfig = list(
wordsConfig = list(
list(
text = "string"
)
),
managedWordListsConfig = list(
list(
type = "PROFANITY"
)
)
),
sensitiveInformationPolicyConfig = list(
piiEntitiesConfig = list(
list(
type = "ADDRESS"|"AGE"|"AWS_ACCESS_KEY"|"AWS_SECRET_KEY"|"CA_HEALTH_NUMBER"|"CA_SOCIAL_INSURANCE_NUMBER"|"CREDIT_DEBIT_CARD_CVV"|"CREDIT_DEBIT_CARD_EXPIRY"|"CREDIT_DEBIT_CARD_NUMBER"|"DRIVER_ID"|"EMAIL"|"INTERNATIONAL_BANK_ACCOUNT_NUMBER"|"IP_ADDRESS"|"LICENSE_PLATE"|"MAC_ADDRESS"|"NAME"|"PASSWORD"|"PHONE"|"PIN"|"SWIFT_CODE"|"UK_NATIONAL_HEALTH_SERVICE_NUMBER"|"UK_NATIONAL_INSURANCE_NUMBER"|"UK_UNIQUE_TAXPAYER_REFERENCE_NUMBER"|"URL"|"USERNAME"|"US_BANK_ACCOUNT_NUMBER"|"US_BANK_ROUTING_NUMBER"|"US_INDIVIDUAL_TAX_IDENTIFICATION_NUMBER"|"US_PASSPORT_NUMBER"|"US_SOCIAL_SECURITY_NUMBER"|"VEHICLE_IDENTIFICATION_NUMBER",
action = "BLOCK"|"ANONYMIZE"
)
),
regexesConfig = list(
list(
name = "string",
description = "string",
pattern = "string",
action = "BLOCK"|"ANONYMIZE"
)
)
),
contextualGroundingPolicyConfig = list(
filtersConfig = list(
list(
type = "GROUNDING"|"RELEVANCE",
threshold = 123.0
)
)
),
blockedInputMessaging = "string",
blockedOutputsMessaging = "string",
kmsKeyId = "string",
tags = list(
list(
key = "string",
value = "string"
)
),
clientRequestToken = "string"
)