Skip to content

update_automated_reasoning_policy_test_case

update_automated_reasoning_policy_test_case(
    policy_arn: AutomatedReasoningPolicyArn,
    test_case_id: AutomatedReasoningPolicyTestCaseId,
    guard_content: AutomatedReasoningPolicyTestGuardContent,
    last_updated_at: Timestamp,
    expected_aggregated_findings_result: AutomatedReasoningCheckResult,
    *,
    config_overrides: Optional[BedrockClientConfig] = None,
    query_content: Optional[AutomatedReasoningPolicyTestQueryContent] = None,
    confidence_threshold: Optional[AutomatedReasoningCheckTranslationConfidence] = None,
    client_request_token: Optional[IdempotencyToken] = None,
) -> UpdateAutomatedReasoningPolicyTestCaseResponse

Updates an existing Automated Reasoning policy test. You can modify the content, query, expected result, and confidence threshold.

Parameters:

Raises:

  • AccessDeniedException –

    The request is denied because of missing access permissions.

  • ConflictException –

    Error occurred because of a conflict while performing an operation.

  • InternalServerException –

    An internal server error occurred. Retry your request.

  • ResourceInUseException –

    Thrown when attempting to delete or modify a resource that is currently being used by other resources or operations. For example, trying to delete an Automated Reasoning policy that is referenced by an active guardrail.

  • ResourceNotFoundException –

    The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.

  • ThrottlingException –

    The number of requests exceeds the limit. Resubmit your request later.

  • ValidationException –

    Input validation failed. Check your request parameters and retry the request.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_bedrock/_services/bedrock.py
def update_automated_reasoning_policy_test_case(
    self,
    policy_arn: "capo_bedrock.types.automated_reasoning_policy_arn.AutomatedReasoningPolicyArn",
    test_case_id: "capo_bedrock.types.automated_reasoning_policy_test_case_id.AutomatedReasoningPolicyTestCaseId",
    guard_content: "capo_bedrock.types.automated_reasoning_policy_test_guard_content.AutomatedReasoningPolicyTestGuardContent",
    last_updated_at: "capo_bedrock.types.timestamp.Timestamp",
    expected_aggregated_findings_result: "capo_bedrock.types.automated_reasoning_check_result.AutomatedReasoningCheckResult",
    *,
    config_overrides: Optional[BedrockClientConfig] = None,
    query_content: Optional[
        "capo_bedrock.types.automated_reasoning_policy_test_query_content.AutomatedReasoningPolicyTestQueryContent"
    ] = None,
    confidence_threshold: Optional[
        "capo_bedrock.types.automated_reasoning_check_translation_confidence.AutomatedReasoningCheckTranslationConfidence"
    ] = None,
    client_request_token: Optional[
        "capo_bedrock.types.idempotency_token.IdempotencyToken"
    ] = None,
) -> "capo_bedrock.types.update_automated_reasoning_policy_test_case_response.UpdateAutomatedReasoningPolicyTestCaseResponse":
    """<p>Updates an existing Automated Reasoning policy test. You can modify the content, query, expected result, and confidence threshold.</p>

    Args:
        policy_arn: <p>The Amazon Resource Name (ARN) of the Automated Reasoning policy that contains the test.</p>
        test_case_id: <p>The unique identifier of the test to update.</p>
        guard_content: <p>The updated content to be validated by the Automated Reasoning policy.</p>
        query_content: <p>The updated input query or prompt that generated the content.</p>
        last_updated_at: <p>The timestamp when the test was last updated. This is used as a concurrency token to prevent conflicting modifications.</p>
        expected_aggregated_findings_result: <p>The updated expected result of the Automated Reasoning check.</p>
        confidence_threshold: <p>The updated minimum confidence level for logic validation. If null is provided, the threshold will be removed.</p>
        client_request_token: <p>A unique, case-sensitive identifier to ensure that the operation completes no more than one time. If this token matches a previous request, Amazon Bedrock ignores the request, but does not return an error.</p>

    Raises:
        capo_bedrock.errors.access_denied_exception.AccessDeniedException: <p>The request is denied because of missing access permissions.</p>
        capo_bedrock.errors.conflict_exception.ConflictException: <p>Error occurred because of a conflict while performing an operation.</p>
        capo_bedrock.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred. Retry your request.</p>
        capo_bedrock.errors.resource_in_use_exception.ResourceInUseException: <p>Thrown when attempting to delete or modify a resource that is currently being used by other resources or operations. For example, trying to delete an Automated Reasoning policy that is referenced by an active guardrail.</p>
        capo_bedrock.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.</p>
        capo_bedrock.errors.throttling_exception.ThrottlingException: <p>The number of requests exceeds the limit. Resubmit your request later.</p>
        capo_bedrock.errors.validation_exception.ValidationException: <p>Input validation failed. Check your request parameters and retry the request.</p>
        capo_bedrock.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_bedrock.types.update_automated_reasoning_policy_test_case_request.UpdateAutomatedReasoningPolicyTestCaseRequest]",
    ) -> OperationResponse[
        "capo_bedrock.types.update_automated_reasoning_policy_test_case_response.UpdateAutomatedReasoningPolicyTestCaseResponse"
    ]:
        import capo_bedrock._operations.amazon_bedrock_control_plane_service.update_automated_reasoning_policy_test_case

        output, http_response = (
            capo_bedrock._operations.amazon_bedrock_control_plane_service.update_automated_reasoning_policy_test_case.update_automated_reasoning_policy_test_case(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_bedrock.types.update_automated_reasoning_policy_test_case_request.UpdateAutomatedReasoningPolicyTestCaseRequest",
    ) -> dict[str, Any]:
        import capo_bedrock.types.update_automated_reasoning_policy_test_case_request

        return capo_bedrock.types.update_automated_reasoning_policy_test_case_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "UpdateAutomatedReasoningPolicyTestCase", redact_input=_redact_input
        ),
    )
    input_: capo_bedrock.types.update_automated_reasoning_policy_test_case_request.UpdateAutomatedReasoningPolicyTestCaseRequest = {
        "policy_arn": policy_arn,
        "test_case_id": test_case_id,
        "guard_content": guard_content,
        "last_updated_at": last_updated_at,
        "expected_aggregated_findings_result": expected_aggregated_findings_result,
    }
    if query_content is not None:
        input_["query_content"] = query_content
    if confidence_threshold is not None:
        input_["confidence_threshold"] = confidence_threshold
    if client_request_token is None:
        client_request_token = str(uuid.uuid4())
    input_["client_request_token"] = client_request_token

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output