createRescoreExecutionPlan method

Future<CreateRescoreExecutionPlanResponse> createRescoreExecutionPlan({
  1. required String name,
  2. CapacityUnitsConfiguration? capacityUnits,
  3. String? clientToken,
  4. String? description,
  5. List<Tag>? tags,
})

Creates a rescore execution plan. A rescore execution plan is an Amazon Kendra Intelligent Ranking resource used for provisioning the Rescore API. You set the number of capacity units that you require for Amazon Kendra Intelligent Ranking to rescore or re-rank a search service's results.

For an example of using the CreateRescoreExecutionPlan API, including using the Python and Java SDKs, see Semantically ranking a search service's results.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter name : A name for the rescore execution plan.

Parameter capacityUnits : You can set additional capacity units to meet the needs of your rescore execution plan. You are given a single capacity unit by default. If you want to use the default capacity, you don't set additional capacity units. For more information on the default capacity and additional capacity units, see Adjusting capacity.

Parameter clientToken : A token that you provide to identify the request to create a rescore execution plan. Multiple calls to the CreateRescoreExecutionPlanRequest API with the same client token will create only one rescore execution plan.

Parameter description : A description for the rescore execution plan.

Parameter tags : A list of key-value pairs that identify or categorize your rescore execution plan. You can also use tags to help control access to the rescore execution plan. Tag keys and values can consist of Unicode letters, digits, white space, and any of the following symbols: _ . : / =

    • @.

Implementation

Future<CreateRescoreExecutionPlanResponse> createRescoreExecutionPlan({
  required String name,
  CapacityUnitsConfiguration? capacityUnits,
  String? clientToken,
  String? description,
  List<Tag>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target':
        'AWSKendraRerankingFrontendService.CreateRescoreExecutionPlan'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Name': name,
      if (capacityUnits != null) 'CapacityUnits': capacityUnits,
      'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
      if (description != null) 'Description': description,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateRescoreExecutionPlanResponse.fromJson(jsonResponse.body);
}