startAsyncInvoke method
Starts an asynchronous invocation.
This operation requires permission for the
bedrock:InvokeModel action.
May throw AccessDeniedException.
May throw ConflictException.
May throw InternalServerException.
May throw ResourceNotFoundException.
May throw ServiceQuotaExceededException.
May throw ServiceUnavailableException.
May throw ThrottlingException.
May throw ValidationException.
Parameter modelId :
The model to invoke.
Parameter modelInput :
Input to send to the model.
Parameter outputDataConfig :
Where to store the output.
Parameter clientRequestToken :
Specify idempotency token to ensure that requests are not duplicated.
Parameter tags :
Tags to apply to the invocation.
Implementation
Future<StartAsyncInvokeResponse> startAsyncInvoke({
required String modelId,
required Object modelInput,
required AsyncInvokeOutputDataConfig outputDataConfig,
String? clientRequestToken,
List<Tag>? tags,
}) async {
final $payload = <String, dynamic>{
'modelId': modelId,
'modelInput': modelInput,
'outputDataConfig': outputDataConfig,
'clientRequestToken': clientRequestToken ?? _s.generateIdempotencyToken(),
if (tags != null) 'tags': tags,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/async-invoke',
exceptionFnMap: _exceptionFns,
);
return StartAsyncInvokeResponse.fromJson(response);
}