rerank method
Reranks the relevance of sources based on queries. For more information, see Improve the relevance of query responses with a reranker model.
May throw AccessDeniedException.
May throw BadGatewayException.
May throw ConflictException.
May throw DependencyFailedException.
May throw InternalServerException.
May throw ResourceNotFoundException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
May throw ValidationException.
Parameter queries :
An array of objects, each of which contains information about a query to
submit to the reranker model.
Parameter rerankingConfiguration :
Contains configurations for reranking.
Parameter sources :
An array of objects, each of which contains information about the sources
to rerank.
Parameter nextToken :
If the total number of results was greater than could fit in a response, a
token is returned in the nextToken field. You can enter that
token in this field to return the next batch of results.
Implementation
Future<RerankResponse> rerank({
required List<RerankQuery> queries,
required RerankingConfiguration rerankingConfiguration,
required List<RerankSource> sources,
String? nextToken,
}) async {
final $payload = <String, dynamic>{
'queries': queries,
'rerankingConfiguration': rerankingConfiguration,
'sources': sources,
if (nextToken != null) 'nextToken': nextToken,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/rerank',
exceptionFnMap: _exceptionFns,
);
return RerankResponse.fromJson(response);
}