queryAssistant method

Future<QueryAssistantResponse> queryAssistant({
  1. required String assistantId,
  2. required String queryText,
  3. int? maxResults,
  4. String? nextToken,
})

Performs a manual search against the specified assistant. To retrieve recommendations for an assistant, use GetRecommendations.

May throw AccessDeniedException. May throw RequestTimeoutException. May throw ResourceNotFoundException. May throw ValidationException.

Parameter assistantId : The identifier of the Wisdom assistant. Can be either the ID or the ARN. URLs cannot contain the ARN.

Parameter queryText : The text to search for.

Parameter maxResults : The maximum number of results to return per page.

Parameter nextToken : The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.

Implementation

Future<QueryAssistantResponse> queryAssistant({
  required String assistantId,
  required String queryText,
  int? maxResults,
  String? nextToken,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  final $payload = <String, dynamic>{
    'queryText': queryText,
    if (maxResults != null) 'maxResults': maxResults,
    if (nextToken != null) 'nextToken': nextToken,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/assistants/${Uri.encodeComponent(assistantId)}/query',
    exceptionFnMap: _exceptionFns,
  );
  return QueryAssistantResponse.fromJson(response);
}