createModelInvocationJob method
- required ModelInvocationJobInputDataConfig inputDataConfig,
- required String jobName,
- required String modelId,
- required ModelInvocationJobOutputDataConfig outputDataConfig,
- required String roleArn,
- String? clientRequestToken,
- ModelInvocationType? modelInvocationType,
- List<
Tag> ? tags, - int? timeoutDurationInHours,
- VpcConfig? vpcConfig,
Creates a batch inference job to invoke a model on multiple prompts. Format your data according to Format your inference data and upload it to an Amazon S3 bucket. For more information, see Process multiple prompts with batch inference.
The response returns a jobArn that you can use to stop or get
details about the job.
May throw AccessDeniedException.
May throw ConflictException.
May throw InternalServerException.
May throw ResourceNotFoundException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
May throw ValidationException.
Parameter inputDataConfig :
Details about the location of the input to the batch inference job.
Parameter jobName :
A name to give the batch inference job.
Parameter modelId :
The unique identifier of the foundation model to use for the batch
inference job.
Parameter outputDataConfig :
Details about the location of the output of the batch inference job.
Parameter roleArn :
The Amazon Resource Name (ARN) of the service role with permissions to
carry out and manage batch inference. You can use the console to create a
default service role or follow the steps at Create
a service role for batch inference.
Parameter clientRequestToken :
A unique, case-sensitive identifier to ensure that the API request
completes no more than one time. If this token matches a previous request,
Amazon Bedrock ignores the request, but does not return an error. For more
information, see Ensuring
idempotency.
Parameter modelInvocationType :
The invocation endpoint for ModelInvocationJob
Parameter tags :
Any tags to associate with the batch inference job. For more information,
see Tagging
Amazon Bedrock resources.
Parameter timeoutDurationInHours :
The number of hours after which to force the batch inference job to time
out.
Parameter vpcConfig :
The configuration of the Virtual Private Cloud (VPC) for the data in the
batch inference job. For more information, see Protect
batch inference jobs using a VPC.
Implementation
Future<CreateModelInvocationJobResponse> createModelInvocationJob({
required ModelInvocationJobInputDataConfig inputDataConfig,
required String jobName,
required String modelId,
required ModelInvocationJobOutputDataConfig outputDataConfig,
required String roleArn,
String? clientRequestToken,
ModelInvocationType? modelInvocationType,
List<Tag>? tags,
int? timeoutDurationInHours,
VpcConfig? vpcConfig,
}) async {
_s.validateNumRange(
'timeoutDurationInHours',
timeoutDurationInHours,
24,
168,
);
final $payload = <String, dynamic>{
'inputDataConfig': inputDataConfig,
'jobName': jobName,
'modelId': modelId,
'outputDataConfig': outputDataConfig,
'roleArn': roleArn,
'clientRequestToken': clientRequestToken ?? _s.generateIdempotencyToken(),
if (modelInvocationType != null)
'modelInvocationType': modelInvocationType.value,
if (tags != null) 'tags': tags,
if (timeoutDurationInHours != null)
'timeoutDurationInHours': timeoutDurationInHours,
if (vpcConfig != null) 'vpcConfig': vpcConfig,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/model-invocation-job',
exceptionFnMap: _exceptionFns,
);
return CreateModelInvocationJobResponse.fromJson(response);
}