Skip to content

update_guardrail

Operation

update_guardrail

update_guardrail(request: UpdateGuardrailInput | UpdateGuardrailInputDict | None = None, /, *, plugins: list[Plugin] | None = None, **kwargs: Unpack[UpdateGuardrailInputDict]) -> 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
request UpdateGuardrailInput | UpdateGuardrailInputDict | None

The input as a model or dictionary. Pass this or keyword arguments, not both.

None
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
**kwargs Unpack[UpdateGuardrailInputDict]

The input fields as keyword arguments.

{}

Returns:

Type Description
UpdateGuardrailOutput

An instance of UpdateGuardrailOutput.

update_guardrail async

update_guardrail(request: UpdateGuardrailInput | UpdateGuardrailInputDict | None = None, /, *, plugins: list[Plugin] | None = None, **kwargs: Unpack[UpdateGuardrailInputDict]) -> 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
request UpdateGuardrailInput | UpdateGuardrailInputDict | None

The input as a model or dictionary. Pass this or keyword arguments, not both.

None
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
**kwargs Unpack[UpdateGuardrailInputDict]

The input fields as keyword arguments.

{}

Returns:

Type Description
UpdateGuardrailOutput

An instance of UpdateGuardrailOutput.

Input

Pass the input as keyword arguments, a positional dictionary, or a positional model object. Pass plugins separately as a keyword argument.

UpdateGuardrailInputDict

Bases: TypedDict

Dictionary form of UpdateGuardrailInput.

Attributes

automated_reasoning_policy_config instance-attribute

Updated configuration for Automated Reasoning policies associated with the guardrail.

blocked_input_messaging instance-attribute
blocked_input_messaging: Required[str]

The message to return when the guardrail blocks a prompt.

blocked_outputs_messaging instance-attribute
blocked_outputs_messaging: Required[str]

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

content_policy_config instance-attribute

The content policy to configure for the guardrail.

contextual_grounding_policy_config instance-attribute

The contextual grounding policy configuration used to update a guardrail.

cross_region_config instance-attribute

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 instance-attribute
description: str | None

A description of the guardrail.

guardrail_identifier instance-attribute
guardrail_identifier: Required[str]

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

kms_key_id instance-attribute
kms_key_id: str | None

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

name instance-attribute
name: Required[str]

A name for the guardrail.

sensitive_information_policy_config instance-attribute

The sensitive information policy to configure for the guardrail.

topic_policy_config instance-attribute

The topic policy to configure for the guardrail.

word_policy_config instance-attribute

The word policy to configure for the guardrail.

UpdateGuardrailInput dataclass

Bases: _SerdeShape

Dataclass for UpdateGuardrailInput structure.

Attributes

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

Updated configuration for Automated Reasoning policies associated with the guardrail.

blocked_input_messaging class-attribute instance-attribute
blocked_input_messaging: str | None = ...

The message to return when the guardrail blocks a prompt.

blocked_outputs_messaging class-attribute instance-attribute
blocked_outputs_messaging: str | None = ...

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

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

The content policy to configure for the guardrail.

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

The contextual grounding policy configuration used to update a guardrail.

cross_region_config class-attribute instance-attribute
cross_region_config: GuardrailCrossRegionConfig | 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 = ...

A description of the guardrail.

guardrail_identifier class-attribute instance-attribute
guardrail_identifier: str | 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 = ...

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

name class-attribute instance-attribute
name: str | None = ...

A name for the guardrail.

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

The sensitive information policy to configure for the guardrail.

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

The topic policy to configure for the guardrail.

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

The word policy to configure for the guardrail.

Output

UpdateGuardrailOutput dataclass

Bases: _SerdeShape

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

response_metadata class-attribute instance-attribute
response_metadata: ResponseMetadata = ...

Metadata about the response that produced this output. Use this to recover the request identifiers a service's support team needs in order to investigate a call. Members of the metadata are individually optional.

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.