queryAssistant method

Future<QueryAssistantResponse> queryAssistant({
  1. required String assistantId,
  2. int? maxResults,
  3. String? nextToken,
  4. KnowledgeBaseSearchType? overrideKnowledgeBaseSearchType,
  5. List<QueryCondition>? queryCondition,
  6. QueryInputData? queryInputData,
  7. String? queryText,
  8. String? sessionId,
})
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 Amazon Q in Connect assistant. Can be either the ID or the ARN. URLs cannot contain the ARN.

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.

Parameter overrideKnowledgeBaseSearchType : The search type to be used against the Knowledge Base for this request. The values can be SEMANTIC which uses vector embeddings or HYBRID which use vector embeddings and raw text.

Parameter queryCondition : Information about how to query content.

Parameter queryInputData : Information about the query.

Parameter queryText : The text to search for.

Parameter sessionId : The identifier of the Amazon Q in Connect session. Can be either the ID or the ARN. URLs cannot contain the ARN.

Implementation

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