createSolutionVersion method

Future<CreateSolutionVersionResponse> createSolutionVersion({
  1. required String solutionArn,
  2. String? name,
  3. List<Tag>? tags,
  4. TrainingMode? trainingMode,
})

Trains or retrains an active solution in a Custom dataset group. A solution is created using the CreateSolution operation and must be in the ACTIVE state before calling CreateSolutionVersion. A new version of the solution is created every time you call this operation.

Status

A solution version can be in one of the following states:

  • CREATE PENDING
  • CREATE IN_PROGRESS
  • ACTIVE
  • CREATE FAILED
  • CREATE STOPPING
  • CREATE STOPPED
To get the status of the version, call DescribeSolutionVersion. Wait until the status shows as ACTIVE before calling CreateCampaign.

If the status shows as CREATE FAILED, the response includes a failureReason key, which describes why the job failed.

Related APIs

May throw InvalidInputException. May throw LimitExceededException. May throw ResourceAlreadyExistsException. May throw ResourceInUseException. May throw ResourceNotFoundException. May throw TooManyTagsException.

Parameter solutionArn : The Amazon Resource Name (ARN) of the solution containing the training configuration information.

Parameter name : The name of the solution version.

Parameter tags : A list of tags to apply to the solution version.

Parameter trainingMode : The scope of training to be performed when creating the solution version. The default is FULL. This creates a completely new model based on the entirety of the training data from the datasets in your dataset group.

If you use User-Personalization, you can specify a training mode of UPDATE. This updates the model to consider new items for recommendations. It is not a full retraining. You should still complete a full retraining weekly. If you specify UPDATE, Amazon Personalize will stop automatic updates for the solution version. To resume updates, create a new solution with training mode set to FULL and deploy it in a campaign. For more information about automatic updates, see Automatic updates.

The UPDATE option can only be used when you already have an active solution version created from the input solution using the FULL option and the input solution was trained with the User-Personalization recipe or the legacy HRNN-Coldstart recipe.

Implementation

Future<CreateSolutionVersionResponse> createSolutionVersion({
  required String solutionArn,
  String? name,
  List<Tag>? tags,
  TrainingMode? trainingMode,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonPersonalize.CreateSolutionVersion'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'solutionArn': solutionArn,
      if (name != null) 'name': name,
      if (tags != null) 'tags': tags,
      if (trainingMode != null) 'trainingMode': trainingMode.value,
    },
  );

  return CreateSolutionVersionResponse.fromJson(jsonResponse.body);
}