updateAutomatedReasoningPolicyTestCase method

Future<UpdateAutomatedReasoningPolicyTestCaseResponse> updateAutomatedReasoningPolicyTestCase({
  1. required AutomatedReasoningCheckResult expectedAggregatedFindingsResult,
  2. required String guardContent,
  3. required DateTime lastUpdatedAt,
  4. required String policyArn,
  5. required String testCaseId,
  6. String? clientRequestToken,
  7. double? confidenceThreshold,
  8. String? queryContent,
})

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

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceInUseException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

Parameter expectedAggregatedFindingsResult : The updated expected result of the Automated Reasoning check.

Parameter guardContent : The updated content to be validated by the Automated Reasoning policy.

Parameter lastUpdatedAt : The timestamp when the test was last updated. This is used as a concurrency token to prevent conflicting modifications.

Parameter policyArn : The Amazon Resource Name (ARN) of the Automated Reasoning policy that contains the test.

Parameter testCaseId : The unique identifier of the test to update.

Parameter clientRequestToken : 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.

Parameter confidenceThreshold : The updated minimum confidence level for logic validation. If null is provided, the threshold will be removed.

Parameter queryContent : The updated input query or prompt that generated the content.

Implementation

Future<UpdateAutomatedReasoningPolicyTestCaseResponse>
    updateAutomatedReasoningPolicyTestCase({
  required AutomatedReasoningCheckResult expectedAggregatedFindingsResult,
  required String guardContent,
  required DateTime lastUpdatedAt,
  required String policyArn,
  required String testCaseId,
  String? clientRequestToken,
  double? confidenceThreshold,
  String? queryContent,
}) async {
  _s.validateNumRange(
    'confidenceThreshold',
    confidenceThreshold,
    0,
    1,
  );
  final $payload = <String, dynamic>{
    'expectedAggregatedFindingsResult':
        expectedAggregatedFindingsResult.value,
    'guardContent': guardContent,
    'lastUpdatedAt': iso8601ToJson(lastUpdatedAt),
    'clientRequestToken': clientRequestToken ?? _s.generateIdempotencyToken(),
    if (confidenceThreshold != null)
      'confidenceThreshold': confidenceThreshold,
    if (queryContent != null) 'queryContent': queryContent,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PATCH',
    requestUri:
        '/automated-reasoning-policies/${Uri.encodeComponent(policyArn)}/test-cases/${Uri.encodeComponent(testCaseId)}',
    exceptionFnMap: _exceptionFns,
  );
  return UpdateAutomatedReasoningPolicyTestCaseResponse.fromJson(response);
}