Skip to content

Bedrock  >  Operations  >  update_guardrail

update_guardrail

Operation

update_guardrail async

update_guardrail(input: UpdateGuardrailInput, plugins: list[Plugin] | None = None) -> UpdateGuardrailOutput

Updates a guardrail with the values you specify.

  • Specify a name and optional description.

  • Specify messages for when the guardrail successfully blocks a prompt or a model response in the blockedInputMessaging and blockedOutputsMessaging fields.

  • Specify topics for the guardrail to deny in the topicPolicyConfig object. Each GuardrailTopicConfig object in the topicsConfig list pertains to one topic.

  • Give a name and description so that the guardrail can properly identify the topic.

  • Specify DENY in the type 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 the filtersConfig 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 the strength field of the GuardrailContentFilterConfig.

  • (Optional) For security, include the ARN of a KMS key in the kmsKeyId field.

Parameters:

Name Type Description Default
input UpdateGuardrailInput

An instance of UpdateGuardrailInput.

required
plugins list[Plugin] | None

A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations.

None

Returns:

Type Description
UpdateGuardrailOutput

An instance of UpdateGuardrailOutput.

Input

UpdateGuardrailInput dataclass

Dataclass for UpdateGuardrailInput structure.

Attributes

automated_reasoning_policy_config class-attribute instance-attribute
automated_reasoning_policy_config: GuardrailAutomatedReasoningPolicyConfig | None = None

Updated configuration for Automated Reasoning policies associated with the guardrail.

blocked_input_messaging class-attribute instance-attribute
blocked_input_messaging: str | None = field(repr=False, default=None)

The message to return when the guardrail blocks a prompt.

blocked_outputs_messaging class-attribute instance-attribute
blocked_outputs_messaging: str | None = field(repr=False, default=None)

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

content_policy_config class-attribute instance-attribute
content_policy_config: GuardrailContentPolicyConfig | None = None

The content policy to configure for the guardrail.

contextual_grounding_policy_config class-attribute instance-attribute
contextual_grounding_policy_config: GuardrailContextualGroundingPolicyConfig | None = None

The contextual grounding policy configuration used to update a guardrail.

cross_region_config class-attribute instance-attribute
cross_region_config: GuardrailCrossRegionConfig | None = None

The system-defined guardrail profile that you're using with your guardrail. Guardrail profiles define the destination Amazon Web Services Regions where guardrail inference requests can be automatically routed.

For more information, see the Amazon Bedrock User Guide.

description class-attribute instance-attribute
description: str | None = field(repr=False, default=None)

A description of the guardrail.

guardrail_identifier class-attribute instance-attribute
guardrail_identifier: str | None = None

The unique identifier of the guardrail. This can be an ID or the ARN.

kms_key_id class-attribute instance-attribute
kms_key_id: str | None = None

The ARN of the KMS key with which to encrypt the guardrail.

name class-attribute instance-attribute
name: str | None = field(repr=False, default=None)

A name for the guardrail.

sensitive_information_policy_config class-attribute instance-attribute
sensitive_information_policy_config: GuardrailSensitiveInformationPolicyConfig | None = None

The sensitive information policy to configure for the guardrail.

topic_policy_config class-attribute instance-attribute
topic_policy_config: GuardrailTopicPolicyConfig | None = None

The topic policy to configure for the guardrail.

word_policy_config class-attribute instance-attribute
word_policy_config: GuardrailWordPolicyConfig | None = None

The word policy to configure for the guardrail.

Output

UpdateGuardrailOutput dataclass

Dataclass for UpdateGuardrailOutput structure.

Attributes

guardrail_arn instance-attribute
guardrail_arn: str

The ARN of the guardrail.

guardrail_id instance-attribute
guardrail_id: str

The unique identifier of the guardrail

updated_at instance-attribute
updated_at: datetime

The date and time at which the guardrail was updated.

version instance-attribute
version: str

The version of the guardrail.