Skip to content

predict_qa_results

predict_qa_results(
    aws_account_id: AwsAccountId,
    query_text: QAQueryText,
    *,
    config_overrides: Optional[QuickSightClientConfig] = None,
    include_quick_sight_q_index: Optional[IncludeQuickSightQIndex] = None,
    include_generated_answer: Optional[IncludeGeneratedAnswer] = None,
    max_topics_to_consider: Optional[MaxTopicsToConsider] = None,
) -> PredictQAResultsResponse

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.

Parameters:

  • aws_account_id (AwsAccountId) –

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

  • query_text (QAQueryText) –

    The query text to be used to predict QA results.

  • include_quick_sight_q_index (Optional[IncludeQuickSightQIndex], default: None ) –

    Indicates whether Q indicies are included or excluded.

  • include_generated_answer (Optional[IncludeGeneratedAnswer], default: None ) –

    Indicates whether generated answers are included or excluded.

  • max_topics_to_consider (Optional[MaxTopicsToConsider], default: None ) –

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

Raises:

  • AccessDeniedException –

    You don't have access to this item. The provided credentials couldn't be validated. You might not be authorized to carry out the request. Make sure that your account is authorized to use the Amazon Quick Sight service, that your policies have the correct permissions, and that you are using the correct credentials.

  • InternalFailureException –

    An internal failure occurred.

  • InvalidParameterValueException –

    One or more parameters has a value that isn't valid.

  • ThrottlingException –

    Access is throttled.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_quicksight/_services/quick_sight.py
def predict_qa_results(
    self,
    aws_account_id: "capo_quicksight.types.aws_account_id.AwsAccountId",
    query_text: "capo_quicksight.types.qa_query_text.QAQueryText",
    *,
    config_overrides: Optional[QuickSightClientConfig] = None,
    include_quick_sight_q_index: Optional[
        "capo_quicksight.types.include_quick_sight_q_index.IncludeQuickSightQIndex"
    ] = None,
    include_generated_answer: Optional[
        "capo_quicksight.types.include_generated_answer.IncludeGeneratedAnswer"
    ] = None,
    max_topics_to_consider: Optional[
        "capo_quicksight.types.max_topics_to_consider.MaxTopicsToConsider"
    ] = None,
) -> "capo_quicksight.types.predict_qa_results_response.PredictQAResultsResponse":
    """<p>Predicts existing visuals or generates new visuals to answer a given query.</p> <p>This API uses <a href="https://docs.aws.amazon.com/singlesignon/latest/userguide/trustedidentitypropagation.html">trusted identity propagation</a> 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 <a href="https://docs.aws.amazon.com/singlesignon/latest/userguide/trustedidentitypropagation-using-customermanagedapps-specify-trusted-apps.html">trusted Identity Propagation enabled for Quick</a> with the scope value set to <code>quicksight:read</code>. Before you use this action, make sure that you have configured the relevant Quick resource and permissions.</p> <p>We recommend enabling the <code>QSearchStatus</code> API to unlock the full potential of <code>PredictQnA</code>. When <code>QSearchStatus</code> is enabled, it first checks the specified dashboard for any existing visuals that match the question. If no matching visuals are found, <code>PredictQnA</code> uses generative Q&A to provide an answer. To update the <code>QSearchStatus</code>, see <a href="https://docs.aws.amazon.com/quicksight/latest/APIReference/API_UpdateQuickSightQSearchConfiguration.html">UpdateQuickSightQSearchConfiguration</a>.</p>

    Args:
        aws_account_id: <p>The ID of the Amazon Web Services account that the user wants to execute Predict QA results in.</p>
        query_text: <p>The query text to be used to predict QA results.</p>
        include_quick_sight_q_index: <p>Indicates whether Q indicies are included or excluded.</p>
        include_generated_answer: <p>Indicates whether generated answers are included or excluded.</p>
        max_topics_to_consider: <p>The number of maximum topics to be considered to predict QA results.</p>

    Raises:
        capo_quicksight.errors.access_denied_exception.AccessDeniedException: <p>You don't have access to this item. The provided credentials couldn't be validated. You might not be authorized to carry out the request. Make sure that your account is authorized to use the Amazon Quick Sight service, that your policies have the correct permissions, and that you are using the correct credentials.</p>
        capo_quicksight.errors.internal_failure_exception.InternalFailureException: <p>An internal failure occurred.</p>
        capo_quicksight.errors.invalid_parameter_value_exception.InvalidParameterValueException: <p>One or more parameters has a value that isn't valid.</p>
        capo_quicksight.errors.throttling_exception.ThrottlingException: <p>Access is throttled.</p>
        capo_quicksight.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_quicksight.types.predict_qa_results_request.PredictQAResultsRequest]",
    ) -> OperationResponse[
        "capo_quicksight.types.predict_qa_results_response.PredictQAResultsResponse"
    ]:
        import capo_quicksight._operations.quick_sight_20180401.predict_qa_results

        output, http_response = (
            capo_quicksight._operations.quick_sight_20180401.predict_qa_results.predict_qa_results(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_quicksight.types.predict_qa_results_request.PredictQAResultsRequest",
    ) -> dict[str, Any]:
        import capo_quicksight.types.predict_qa_results_request

        return capo_quicksight.types.predict_qa_results_request.redact_sensitive(
            input_
        )

    def _redact_output(
        output: "capo_quicksight.types.predict_qa_results_response.PredictQAResultsResponse",
    ) -> dict[str, Any]:
        import capo_quicksight.types.predict_qa_results_response

        return capo_quicksight.types.predict_qa_results_response.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "PredictQAResults",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_quicksight.types.predict_qa_results_request.PredictQAResultsRequest = {
        "aws_account_id": aws_account_id,
        "query_text": query_text,
    }
    if include_quick_sight_q_index is not None:
        input_["include_quick_sight_q_index"] = include_quick_sight_q_index
    if include_generated_answer is not None:
        input_["include_generated_answer"] = include_generated_answer
    if max_topics_to_consider is not None:
        input_["max_topics_to_consider"] = max_topics_to_consider

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output