predictQAResults method

Future<PredictQAResultsResponse> predictQAResults({
  1. required String awsAccountId,
  2. required String queryText,
  3. IncludeGeneratedAnswer? includeGeneratedAnswer,
  4. IncludeQuickSightQIndex? includeQuickSightQIndex,
  5. int? maxTopicsToConsider,
})

Predicts existing visuals or generates new visuals to answer a given query.

This API uses trusted identity propagation to ensure that an end user is authenticated and receives the embed URL that is specific to that user. The IAM Identity Center application that the user has logged into needs to have trusted Identity Propagation enabled for Quick with the scope value set to quicksight:read. Before you use this action, make sure that you have configured the relevant Quick resource and permissions.

We recommend enabling the QSearchStatus API to unlock the full potential of PredictQnA. When QSearchStatus is enabled, it first checks the specified dashboard for any existing visuals that match the question. If no matching visuals are found, PredictQnA uses generative Q&A to provide an answer. To update the QSearchStatus, see UpdateQuickSightQSearchConfiguration.

May throw AccessDeniedException. May throw InternalFailureException. May throw InvalidParameterValueException. May throw ThrottlingException.

Parameter awsAccountId : The ID of the Amazon Web Services account that the user wants to execute Predict QA results in.

Parameter queryText : The query text to be used to predict QA results.

Parameter includeGeneratedAnswer : Indicates whether generated answers are included or excluded.

Parameter includeQuickSightQIndex : Indicates whether Q indicies are included or excluded.

Parameter maxTopicsToConsider : The number of maximum topics to be considered to predict QA results.

Implementation

Future<PredictQAResultsResponse> predictQAResults({
  required String awsAccountId,
  required String queryText,
  IncludeGeneratedAnswer? includeGeneratedAnswer,
  IncludeQuickSightQIndex? includeQuickSightQIndex,
  int? maxTopicsToConsider,
}) async {
  _s.validateNumRange(
    'maxTopicsToConsider',
    maxTopicsToConsider,
    1,
    4,
  );
  final $payload = <String, dynamic>{
    'QueryText': queryText,
    if (includeGeneratedAnswer != null)
      'IncludeGeneratedAnswer': includeGeneratedAnswer.value,
    if (includeQuickSightQIndex != null)
      'IncludeQuickSightQIndex': includeQuickSightQIndex.value,
    if (maxTopicsToConsider != null)
      'MaxTopicsToConsider': maxTopicsToConsider,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/accounts/${Uri.encodeComponent(awsAccountId)}/qa/predict',
    exceptionFnMap: _exceptionFns,
  );
  return PredictQAResultsResponse.fromJson(response);
}