createInferenceComponent method

Future<CreateInferenceComponentOutput> createInferenceComponent({
  1. required String endpointName,
  2. required String inferenceComponentName,
  3. InferenceComponentRuntimeConfig? runtimeConfig,
  4. InferenceComponentSpecification? specification,
  5. List<InferenceComponentSpecification>? specifications,
  6. List<Tag>? tags,
  7. String? variantName,
})

Creates an inference component, which is a SageMaker AI hosting object that you can use to deploy a model to an endpoint. In the inference component settings, you specify the model, the endpoint, and how the model utilizes the resources that the endpoint hosts. You can optimize resource utilization by tailoring how the required CPU cores, accelerators, and memory are allocated. You can deploy multiple inference components to an endpoint, where each inference component contains one model and the resource utilization needs for that individual model. After you deploy an inference component, you can directly invoke the associated model when you use the InvokeEndpoint API action.

May throw ResourceLimitExceeded.

Parameter endpointName : The name of an existing endpoint where you host the inference component.

Parameter inferenceComponentName : A unique name to assign to the inference component.

Parameter runtimeConfig : Runtime settings for a model that is deployed with an inference component.

Parameter specification : Details about the resources to deploy with this inference component, including the model, container, and compute resources.

Parameter specifications : A list of specification objects for the inference component, one per instance type. Use this parameter when you want to deploy a different model or resource configuration for the inference component on each instance type. You can use either this parameter or the singular Specification parameter, but not both.

Parameter tags : A list of key-value pairs associated with the model. For more information, see Tagging Amazon Web Services resources in the Amazon Web Services General Reference.

Parameter variantName : The name of an existing production variant where you host the inference component.

Implementation

Future<CreateInferenceComponentOutput> createInferenceComponent({
  required String endpointName,
  required String inferenceComponentName,
  InferenceComponentRuntimeConfig? runtimeConfig,
  InferenceComponentSpecification? specification,
  List<InferenceComponentSpecification>? specifications,
  List<Tag>? tags,
  String? variantName,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'SageMaker.CreateInferenceComponent'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'EndpointName': endpointName,
      'InferenceComponentName': inferenceComponentName,
      if (runtimeConfig != null) 'RuntimeConfig': runtimeConfig,
      if (specification != null) 'Specification': specification,
      if (specifications != null) 'Specifications': specifications,
      if (tags != null) 'Tags': tags,
      if (variantName != null) 'VariantName': variantName,
    },
  );

  return CreateInferenceComponentOutput.fromJson(jsonResponse.body);
}