invokeGuardrailChecks method

Future<InvokeGuardrailChecksResponse> invokeGuardrailChecks({
  1. required GuardrailChecksConfig checks,
  2. required List<GuardrailChecksMessage> messages,
})

Evaluates messages against inline guardrail checks. You specify the check configurations directly in the request, and Amazon Bedrock returns per-check results with severity or confidence scores.

May throw AccessDeniedException. May throw InternalServerException. May throw ServiceUnavailableException. May throw ThrottlingException. May throw ValidationException.

Parameter checks : The inline check configurations that specify which guardrail checks to run against the messages.

Parameter messages : The messages to evaluate against the specified guardrail checks. Each message includes a role and one or more content blocks.

Implementation

Future<InvokeGuardrailChecksResponse> invokeGuardrailChecks({
  required GuardrailChecksConfig checks,
  required List<GuardrailChecksMessage> messages,
}) async {
  final $payload = <String, dynamic>{
    'checks': checks,
    'messages': messages,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/guardrail-checks/invoke',
    exceptionFnMap: _exceptionFns,
  );
  return InvokeGuardrailChecksResponse.fromJson(response);
}