createAIRecommendationJob method

Future<CreateAIRecommendationJobResponse> createAIRecommendationJob({
  1. required String aIRecommendationJobName,
  2. required String aIWorkloadConfigIdentifier,
  3. required AIModelSource modelSource,
  4. required AIRecommendationOutputConfig outputConfig,
  5. required AIRecommendationPerformanceTarget performanceTarget,
  6. required String roleArn,
  7. AIRecommendationComputeSpec? computeSpec,
  8. AIRecommendationInferenceSpecification? inferenceSpecification,
  9. bool? optimizeModel,
  10. List<Tag>? tags,
})

Creates a recommendation job that generates intelligent optimization recommendations for generative AI inference deployments. The job analyzes your model, workload configuration, and performance targets to recommend optimal instance types, model optimization techniques (such as quantization and speculative decoding), and deployment configurations.

May throw ResourceInUse. May throw ResourceLimitExceeded. May throw ResourceNotFound.

Parameter aIRecommendationJobName : The name of the AI recommendation job. The name must be unique within your Amazon Web Services account in the current Amazon Web Services Region.

Parameter aIWorkloadConfigIdentifier : The name or Amazon Resource Name (ARN) of the AI workload configuration to use for this recommendation job.

Parameter modelSource : The source of the model to optimize. Specify the Amazon S3 location of the model artifacts.

Parameter outputConfig : The output configuration for the recommendation job, including the Amazon S3 location for results and an optional model package group where the optimized model is registered.

Parameter performanceTarget : The performance targets for the recommendation job. Specify constraints on metrics such as time to first token (ttft-ms), throughput, or cost.

Parameter roleArn : The Amazon Resource Name (ARN) of an IAM role that enables Amazon SageMaker AI to perform tasks on your behalf.

Parameter computeSpec : The compute resource specification for the recommendation job. You can specify up to 3 instance types to consider, and optionally provide capacity reservation configuration.

Parameter inferenceSpecification : The inference framework configuration. Specify the framework (such as LMI or vLLM) for the recommendation job.

Parameter optimizeModel : Whether to allow model optimization techniques such as quantization, speculative decoding, and kernel tuning. The default is true.

Parameter tags : The metadata that you apply to Amazon Web Services resources to help you categorize and organize them.

Implementation

Future<CreateAIRecommendationJobResponse> createAIRecommendationJob({
  required String aIRecommendationJobName,
  required String aIWorkloadConfigIdentifier,
  required AIModelSource modelSource,
  required AIRecommendationOutputConfig outputConfig,
  required AIRecommendationPerformanceTarget performanceTarget,
  required String roleArn,
  AIRecommendationComputeSpec? computeSpec,
  AIRecommendationInferenceSpecification? inferenceSpecification,
  bool? optimizeModel,
  List<Tag>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'SageMaker.CreateAIRecommendationJob'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'AIRecommendationJobName': aIRecommendationJobName,
      'AIWorkloadConfigIdentifier': aIWorkloadConfigIdentifier,
      'ModelSource': modelSource,
      'OutputConfig': outputConfig,
      'PerformanceTarget': performanceTarget,
      'RoleArn': roleArn,
      if (computeSpec != null) 'ComputeSpec': computeSpec,
      if (inferenceSpecification != null)
        'InferenceSpecification': inferenceSpecification,
      if (optimizeModel != null) 'OptimizeModel': optimizeModel,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateAIRecommendationJobResponse.fromJson(jsonResponse.body);
}