UpdateGuardrail
Updates a guardrail with the values you specify.
-
Specify a
name
and optionaldescription
. -
Specify messages for when the guardrail successfully blocks a prompt or a model response in the
blockedInputMessaging
andblockedOutputsMessaging
fields. -
Specify topics for the guardrail to deny in the
topicPolicyConfig
object. Each GuardrailTopicConfig object in thetopicsConfig
list pertains to one topic.-
Give a
name
anddescription
so that the guardrail can properly identify the topic. -
Specify
DENY
in thetype
field. -
(Optional) Provide up to five prompts that you would categorize as belonging to the topic in the
examples
list.
-
-
Specify filter strengths for the harmful categories defined in Amazon Bedrock in the
contentPolicyConfig
object. Each GuardrailContentFilterConfig object in thefiltersConfig
list pertains to a harmful category. For more information, see Content filters. For more information about the fields in a content filter, see GuardrailContentFilterConfig.-
Specify the category in the
type
field. -
Specify the strength of the filter for prompts in the
inputStrength
field and for model responses in thestrength
field of the GuardrailContentFilterConfig.
-
-
(Optional) For security, include the ARN of a AWS KMS key in the
kmsKeyId
field.
Request Syntax
PUT /guardrails/guardrailIdentifier
HTTP/1.1
Content-type: application/json
{
"blockedInputMessaging": "string
",
"blockedOutputsMessaging": "string
",
"contentPolicyConfig": {
"filtersConfig": [
{
"inputModalities": [ "string
" ],
"inputStrength": "string
",
"outputModalities": [ "string
" ],
"outputStrength": "string
",
"type": "string
"
}
]
},
"contextualGroundingPolicyConfig": {
"filtersConfig": [
{
"threshold": number
,
"type": "string
"
}
]
},
"description": "string
",
"kmsKeyId": "string
",
"name": "string
",
"sensitiveInformationPolicyConfig": {
"piiEntitiesConfig": [
{
"action": "string
",
"type": "string
"
}
],
"regexesConfig": [
{
"action": "string
",
"description": "string
",
"name": "string
",
"pattern": "string
"
}
]
},
"topicPolicyConfig": {
"topicsConfig": [
{
"definition": "string
",
"examples": [ "string
" ],
"name": "string
",
"type": "string
"
}
]
},
"wordPolicyConfig": {
"managedWordListsConfig": [
{
"type": "string
"
}
],
"wordsConfig": [
{
"text": "string
"
}
]
}
}
URI Request Parameters
The request uses the following URI parameters.
- guardrailIdentifier
-
The unique identifier of the guardrail. This can be an ID or the ARN.
Length Constraints: Minimum length of 0. Maximum length of 2048.
Pattern:
^(([a-z0-9]+)|(arn:aws(-[^:]+)?:bedrock:[a-z0-9-]{1,20}:[0-9]{12}:guardrail/[a-z0-9]+))$
Required: Yes
Request Body
The request accepts the following data in JSON format.
- blockedInputMessaging
-
The message to return when the guardrail blocks a prompt.
Type: String
Length Constraints: Minimum length of 1. Maximum length of 500.
Required: Yes
- blockedOutputsMessaging
-
The message to return when the guardrail blocks a model response.
Type: String
Length Constraints: Minimum length of 1. Maximum length of 500.
Required: Yes
- contentPolicyConfig
-
The content policy to configure for the guardrail.
Type: GuardrailContentPolicyConfig object
Required: No
- contextualGroundingPolicyConfig
-
The contextual grounding policy configuration used to update a guardrail.
Type: GuardrailContextualGroundingPolicyConfig object
Required: No
- description
-
A description of the guardrail.
Type: String
Length Constraints: Minimum length of 1. Maximum length of 200.
Required: No
- kmsKeyId
-
The ARN of the AWS KMS key with which to encrypt the guardrail.
Type: String
Length Constraints: Minimum length of 1. Maximum length of 2048.
Pattern:
^(arn:aws(-[^:]+)?:kms:[a-zA-Z0-9-]*:[0-9]{12}:((key/[a-zA-Z0-9-]{36})|(alias/[a-zA-Z0-9-_/]+)))|([a-zA-Z0-9-]{36})|(alias/[a-zA-Z0-9-_/]+)$
Required: No
- name
-
A name for the guardrail.
Type: String
Length Constraints: Minimum length of 1. Maximum length of 50.
Pattern:
^[0-9a-zA-Z-_]+$
Required: Yes
- sensitiveInformationPolicyConfig
-
The sensitive information policy to configure for the guardrail.
Type: GuardrailSensitiveInformationPolicyConfig object
Required: No
- topicPolicyConfig
-
The topic policy to configure for the guardrail.
Type: GuardrailTopicPolicyConfig object
Required: No
- wordPolicyConfig
-
The word policy to configure for the guardrail.
Type: GuardrailWordPolicyConfig object
Required: No
Response Syntax
HTTP/1.1 202
Content-type: application/json
{
"guardrailArn": "string",
"guardrailId": "string",
"updatedAt": "string",
"version": "string"
}
Response Elements
If the action is successful, the service sends back an HTTP 202 response.
The following data is returned in JSON format by the service.
- guardrailArn
-
The ARN of the guardrail.
Type: String
Length Constraints: Minimum length of 0. Maximum length of 2048.
Pattern:
^arn:aws(-[^:]+)?:bedrock:[a-z0-9-]{1,20}:[0-9]{12}:guardrail/[a-z0-9]+$
- guardrailId
-
The unique identifier of the guardrail
Type: String
Length Constraints: Minimum length of 0. Maximum length of 64.
Pattern:
^[a-z0-9]+$
- updatedAt
-
The date and time at which the guardrail was updated.
Type: Timestamp
- version
-
The version of the guardrail.
Type: String
Length Constraints: Fixed length of 5.
Pattern:
^DRAFT$
Errors
For information about the errors that are common to all actions, see Common Errors.
- AccessDeniedException
-
The request is denied because of missing access permissions.
HTTP Status Code: 403
- ConflictException
-
Error occurred because of a conflict while performing an operation.
HTTP Status Code: 400
- InternalServerException
-
An internal server error occurred. Retry your request.
HTTP Status Code: 500
- ResourceNotFoundException
-
The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.
HTTP Status Code: 404
- ServiceQuotaExceededException
-
The number of requests exceeds the service quota. Resubmit your request later.
HTTP Status Code: 400
- ThrottlingException
-
The number of requests exceeds the limit. Resubmit your request later.
HTTP Status Code: 429
- ValidationException
-
Input validation failed. Check your request parameters and retry the request.
HTTP Status Code: 400
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: