updateSolution method

Future<UpdateSolutionResponse> updateSolution({
  1. required String solutionArn,
  2. bool? performAutoTraining,
  3. bool? performIncrementalUpdate,
  4. SolutionUpdateConfig? solutionUpdateConfig,
})

Updates an Amazon Personalize solution to use a different automatic training configuration. When you update a solution, you can change whether the solution uses automatic training, and you can change the training frequency. For more information about updating a solution, see Updating a solution.

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

CREATE PENDING > CREATE IN_PROGRESS > ACTIVE -or- CREATE FAILED

To get the status of a solution update, call the DescribeSolution API operation and find the status in the latestSolutionUpdate.

May throw InvalidInputException. May throw LimitExceededException. May throw ResourceInUseException. May throw ResourceNotFoundException.

Parameter solutionArn : The Amazon Resource Name (ARN) of the solution to update.

Parameter performAutoTraining : Whether the solution uses automatic training to create new solution versions (trained models). You can change the training frequency by specifying a schedulingExpression in the AutoTrainingConfig as part of solution configuration.

If you turn on automatic training, the first automatic training starts within one hour after the solution update completes. If you manually create a solution version within the hour, the solution skips the first automatic training. For more information about automatic training, see Configuring automatic training.

After training starts, you can get the solution version's Amazon Resource Name (ARN) with the ListSolutionVersions API operation. To get its status, use the DescribeSolutionVersion.

Parameter performIncrementalUpdate : Whether to perform incremental training updates on your model. When enabled, this allows the model to learn from new data more frequently without requiring full retraining, which enables near real-time personalization. This parameter is supported only for solutions that use the semantic-similarity recipe.

Parameter solutionUpdateConfig : The new configuration details of the solution.

Implementation

Future<UpdateSolutionResponse> updateSolution({
  required String solutionArn,
  bool? performAutoTraining,
  bool? performIncrementalUpdate,
  SolutionUpdateConfig? solutionUpdateConfig,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonPersonalize.UpdateSolution'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'solutionArn': solutionArn,
      if (performAutoTraining != null)
        'performAutoTraining': performAutoTraining,
      if (performIncrementalUpdate != null)
        'performIncrementalUpdate': performIncrementalUpdate,
      if (solutionUpdateConfig != null)
        'solutionUpdateConfig': solutionUpdateConfig,
    },
  );

  return UpdateSolutionResponse.fromJson(jsonResponse.body);
}