createAutomatedReasoningPolicy method
Creates an Automated Reasoning policy for Amazon Bedrock Guardrails. Automated Reasoning policies use mathematical techniques to detect hallucinations, suggest corrections, and highlight unstated assumptions in the responses of your GenAI application.
To create a policy, you upload a source document that describes the rules that you're encoding. Automated Reasoning extracts important concepts from the source document that will become variables in the policy and infers policy rules.
May throw AccessDeniedException.
May throw ConflictException.
May throw InternalServerException.
May throw ResourceNotFoundException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
May throw TooManyTagsException.
May throw ValidationException.
Parameter name :
A unique name for the Automated Reasoning policy. The name must be between
1 and 63 characters and can contain letters, numbers, hyphens, and
underscores.
Parameter clientRequestToken :
A unique, case-sensitive identifier to ensure that the operation completes
no more than once. If this token matches a previous request, Amazon
Bedrock ignores the request but doesn't return an error.
Parameter description :
A description of the Automated Reasoning policy. Use this to provide
context about the policy's purpose and the types of validations it
performs.
Parameter kmsKeyId :
The identifier of the KMS key to use for encrypting the automated
reasoning policy and its associated artifacts. If you don't specify a KMS
key, Amazon Bedrock uses an KMS managed key for encryption. For enhanced
security and control, you can specify a customer managed KMS key.
Parameter policyDefinition :
The policy definition that contains the formal logic rules, variables, and
custom variable types used to validate foundation model responses in your
application.
Parameter tags :
A list of tags to associate with the Automated Reasoning policy. Tags help
you organize and manage your policies.
Implementation
Future<CreateAutomatedReasoningPolicyResponse>
createAutomatedReasoningPolicy({
required String name,
String? clientRequestToken,
String? description,
String? kmsKeyId,
AutomatedReasoningPolicyDefinition? policyDefinition,
List<Tag>? tags,
}) async {
final $payload = <String, dynamic>{
'name': name,
'clientRequestToken': clientRequestToken ?? _s.generateIdempotencyToken(),
if (description != null) 'description': description,
if (kmsKeyId != null) 'kmsKeyId': kmsKeyId,
if (policyDefinition != null) 'policyDefinition': policyDefinition,
if (tags != null) 'tags': tags,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/automated-reasoning-policies',
exceptionFnMap: _exceptionFns,
);
return CreateAutomatedReasoningPolicyResponse.fromJson(response);
}