Skip to content

list_intent_metrics async

list_intent_metrics(
    bot_id: Id,
    start_date_time: Timestamp,
    end_date_time: Timestamp,
    metrics: AnalyticsIntentMetrics,
    *,
    config_overrides: Optional[AsyncLexModelsV2ClientConfig] = None,
    bin_by: Optional[AnalyticsBinByList] = None,
    group_by: Optional[AnalyticsIntentGroupByList] = None,
    filters: Optional[AnalyticsIntentFilters] = None,
    max_results: Optional[MaxResults] = None,
    next_token: Optional[NextToken] = None,
) -> ListIntentMetricsResponse

Retrieves summary metrics for the intents in your bot. The following fields are required:

  • metrics – A list of AnalyticsIntentMetric objects. In each object, use the name field to specify the metric to calculate, the statistic field to specify whether to calculate the Sum, Average, or Max number, and the order field to specify whether to sort the results in Ascending or Descending order.

  • startDateTime and endDateTime – Define a time range for which you want to retrieve results.

Of the optional fields, you can organize the results in the following ways:

  • Use the filters field to filter the results, the groupBy field to specify categories by which to group the results, and the binBy field to specify time intervals by which to group the results.

  • Use the maxResults field to limit the number of results to return in a single response and the nextToken field to return the next batch of results if the response does not return the full set of results.

Note that an order field exists in both binBy and metrics. You can specify only one order in a given request.

Parameters:

  • bot_id (Id) –

    The identifier for the bot for which you want to retrieve intent metrics.

  • start_date_time (Timestamp) –

    The timestamp that marks the beginning of the range of time for which you want to see intent metrics.

  • end_date_time (Timestamp) –

    The date and time that marks the end of the range of time for which you want to see intent metrics.

  • metrics (AnalyticsIntentMetrics) –

    A list of objects, each of which contains a metric you want to list, the statistic for the metric you want to return, and the order by which to organize the results.

  • bin_by (Optional[AnalyticsBinByList], default: None ) –

    A list of objects, each of which contains specifications for organizing the results by time.

  • group_by (Optional[AnalyticsIntentGroupByList], default: None ) –

    A list of objects, each of which specifies how to group the results. You can group by the following criteria:

    • IntentName – The name of the intent.

    • IntentEndState – The final state of the intent. The possible end states are detailed in Key definitions in the user guide.

  • filters (Optional[AnalyticsIntentFilters], default: None ) –

    A list of objects, each of which describes a condition by which you want to filter the results.

  • max_results (Optional[MaxResults], default: None ) –

    The maximum number of results to return in each page of results. If there are fewer results than the maximum page size, only the actual number of results are returned.

  • next_token (Optional[NextToken], default: None ) –

    If the response from the ListIntentMetrics operation contains more results than specified in the maxResults parameter, a token is returned in the response.

    Use the returned token in the nextToken parameter of a ListIntentMetrics request to return the next page of results. For a complete set of results, call the ListIntentMetrics operation until the nextToken returned in the response is null.

Raises:

Source code in docs_src/capo_lex_models_v2/_services/async_lex_models_v2.py
async def list_intent_metrics(
    self,
    bot_id: "capo_lex_models_v2.types.id.Id",
    start_date_time: "capo_lex_models_v2.types.timestamp.Timestamp",
    end_date_time: "capo_lex_models_v2.types.timestamp.Timestamp",
    metrics: "capo_lex_models_v2.types.analytics_intent_metrics.AnalyticsIntentMetrics",
    *,
    config_overrides: Optional[AsyncLexModelsV2ClientConfig] = None,
    bin_by: Optional[
        "capo_lex_models_v2.types.analytics_bin_by_list.AnalyticsBinByList"
    ] = None,
    group_by: Optional[
        "capo_lex_models_v2.types.analytics_intent_group_by_list.AnalyticsIntentGroupByList"
    ] = None,
    filters: Optional[
        "capo_lex_models_v2.types.analytics_intent_filters.AnalyticsIntentFilters"
    ] = None,
    max_results: Optional["capo_lex_models_v2.types.max_results.MaxResults"] = None,
    next_token: Optional["capo_lex_models_v2.types.next_token.NextToken"] = None,
) -> "capo_lex_models_v2.types.list_intent_metrics_response.ListIntentMetricsResponse":
    """<p>Retrieves summary metrics for the intents in your bot. The following fields are required:</p> <ul> <li> <p> <code>metrics</code> – A list of <a href="https://docs.aws.amazon.com/lexv2/latest/APIReference/API_AnalyticsIntentMetric.html">AnalyticsIntentMetric</a> objects. In each object, use the <code>name</code> field to specify the metric to calculate, the <code>statistic</code> field to specify whether to calculate the <code>Sum</code>, <code>Average</code>, or <code>Max</code> number, and the <code>order</code> field to specify whether to sort the results in <code>Ascending</code> or <code>Descending</code> order.</p> </li> <li> <p> <code>startDateTime</code> and <code>endDateTime</code> – Define a time range for which you want to retrieve results.</p> </li> </ul> <p>Of the optional fields, you can organize the results in the following ways:</p> <ul> <li> <p>Use the <code>filters</code> field to filter the results, the <code>groupBy</code> field to specify categories by which to group the results, and the <code>binBy</code> field to specify time intervals by which to group the results.</p> </li> <li> <p>Use the <code>maxResults</code> field to limit the number of results to return in a single response and the <code>nextToken</code> field to return the next batch of results if the response does not return the full set of results.</p> </li> </ul> <p>Note that an <code>order</code> field exists in both <code>binBy</code> and <code>metrics</code>. You can specify only one <code>order</code> in a given request.</p>

    Args:
        bot_id: <p>The identifier for the bot for which you want to retrieve intent metrics.</p>
        start_date_time: <p>The timestamp that marks the beginning of the range of time for which you want to see intent metrics.</p>
        end_date_time: <p>The date and time that marks the end of the range of time for which you want to see intent metrics.</p>
        metrics: <p>A list of objects, each of which contains a metric you want to list, the statistic for the metric you want to return, and the order by which to organize the results.</p>
        bin_by: <p>A list of objects, each of which contains specifications for organizing the results by time.</p>
        group_by: <p>A list of objects, each of which specifies how to group the results. You can group by the following criteria:</p> <ul> <li> <p> <code>IntentName</code> – The name of the intent.</p> </li> <li> <p> <code>IntentEndState</code> – The final state of the intent. The possible end states are detailed in <a href="https://docs.aws.amazon.com/analytics-key-definitions-intents">Key definitions</a> in the user guide.</p> </li> </ul>
        filters: <p>A list of objects, each of which describes a condition by which you want to filter the results.</p>
        max_results: <p>The maximum number of results to return in each page of results. If there are fewer results than the maximum page size, only the actual number of results are returned.</p>
        next_token: <p>If the response from the ListIntentMetrics operation contains more results than specified in the maxResults parameter, a token is returned in the response.</p> <p>Use the returned token in the nextToken parameter of a ListIntentMetrics request to return the next page of results. For a complete set of results, call the ListIntentMetrics operation until the nextToken returned in the response is null.</p>

    Raises:
        capo_lex_models_v2.errors.internal_server_exception.InternalServerException: <p>The service encountered an unexpected condition. Try your request again.</p>
        capo_lex_models_v2.errors.precondition_failed_exception.PreconditionFailedException: <p>Your request couldn't be completed because one or more request fields aren't valid. Check the fields in your request and try again.</p>
        capo_lex_models_v2.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>You have reached a quota for your bot. </p>
        capo_lex_models_v2.errors.throttling_exception.ThrottlingException: <p>Your request rate is too high. Reduce the frequency of requests.</p>
        capo_lex_models_v2.errors.validation_exception.ValidationException: <p>One of the input parameters in your request isn't valid. Check the parameters and try your request again.</p>
        capo_lex_models_v2.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_lex_models_v2.types.list_intent_metrics_request.ListIntentMetricsRequest]",
    ) -> AsyncOperationResponse[
        "capo_lex_models_v2.types.list_intent_metrics_response.ListIntentMetricsResponse"
    ]:
        import capo_lex_models_v2._operations.lex_model_building_service_v2.list_intent_metrics

        (
            output,
            http_response,
        ) = await capo_lex_models_v2._operations.lex_model_building_service_v2.list_intent_metrics.async_list_intent_metrics(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListIntentMetrics")
    )
    input_: capo_lex_models_v2.types.list_intent_metrics_request.ListIntentMetricsRequest = {
        "bot_id": bot_id,
        "start_date_time": start_date_time,
        "end_date_time": end_date_time,
        "metrics": metrics,
    }
    if bin_by is not None:
        input_["bin_by"] = bin_by
    if group_by is not None:
        input_["group_by"] = group_by
    if filters is not None:
        input_["filters"] = filters
    if max_results is not None:
        input_["max_results"] = max_results
    if next_token is not None:
        input_["next_token"] = next_token

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output