createInferenceProfile method
Creates an application inference profile to track metrics and costs when invoking a model. To create an application inference profile for a foundation model in one region, specify the ARN of the model in that region. To create an application inference profile for a foundation model across multiple regions, specify the ARN of the system-defined inference profile that contains the regions that you want to route requests to. For more information, see Increase throughput and resilience with cross-region inference in Amazon Bedrock. in the Amazon Bedrock User Guide.
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 inferenceProfileName :
A name for the inference profile.
Parameter modelSource :
The foundation model or system-defined inference profile that the
inference profile will track metrics and costs for.
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 description :
A description for the inference profile.
Parameter tags :
An array of objects, each of which contains a tag and its value. For more
information, see Tagging
resources in the Amazon
Bedrock User Guide.
Implementation
Future<CreateInferenceProfileResponse> createInferenceProfile({
required String inferenceProfileName,
required InferenceProfileModelSource modelSource,
String? clientRequestToken,
String? description,
List<Tag>? tags,
}) async {
final $payload = <String, dynamic>{
'inferenceProfileName': inferenceProfileName,
'modelSource': modelSource,
'clientRequestToken': clientRequestToken ?? _s.generateIdempotencyToken(),
if (description != null) 'description': description,
if (tags != null) 'tags': tags,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/inference-profiles',
exceptionFnMap: _exceptionFns,
);
return CreateInferenceProfileResponse.fromJson(response);
}