LexModelsV2 / Client / list_intent_stage_metrics

list_intent_stage_metrics#

LexModelsV2.Client.list_intent_stage_metrics(**kwargs)#

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

  • metrics – A list of AnalyticsIntentStageMetric 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 only specify one order in a given request.

See also: AWS API Documentation

Request Syntax

response = client.list_intent_stage_metrics(
    botId='string',
    startDateTime=datetime(2015, 1, 1),
    endDateTime=datetime(2015, 1, 1),
    metrics=[
        {
            'name': 'Count'|'Success'|'Failed'|'Dropped'|'Retry',
            'statistic': 'Sum'|'Avg'|'Max',
            'order': 'Ascending'|'Descending'
        },
    ],
    binBy=[
        {
            'name': 'ConversationStartTime'|'UtteranceTimestamp',
            'interval': 'OneHour'|'OneDay',
            'order': 'Ascending'|'Descending'
        },
    ],
    groupBy=[
        {
            'name': 'IntentStageName'|'SwitchedToIntent'
        },
    ],
    filters=[
        {
            'name': 'BotAliasId'|'BotVersion'|'LocaleId'|'Modality'|'Channel'|'SessionId'|'OriginatingRequestId'|'IntentName'|'IntentStageName',
            'operator': 'EQ'|'GT'|'LT',
            'values': [
                'string',
            ]
        },
    ],
    maxResults=123,
    nextToken='string'
)
Parameters:
  • botId (string) –

    [REQUIRED]

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

  • startDateTime (datetime) –

    [REQUIRED]

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

  • endDateTime (datetime) –

    [REQUIRED]

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

  • metrics (list) –

    [REQUIRED]

    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 method by which to organize the results.

    • (dict) –

      Contains the metric and the summary statistic you want to calculate, and the order in which to sort the results, for the intent stages across the user sessions with the bot.

      • name (string) – [REQUIRED]

        The metric for which you want to get intent stage summary statistics. See Key definitions for more details about these metrics.

        • Count – The number of times the intent stage occurred.

        • Success – The number of times the intent stage succeeded.

        • Failure – The number of times the intent stage failed.

        • Dropped – The number of times the user dropped the intent stage.

        • Retry – The number of times the bot tried to elicit a response from the user at this stage.

      • statistic (string) – [REQUIRED]

        The summary statistic to calculate.

        • Sum – The total count for the category you provide in name.

        • Average – The total count divided by the number of intent stages in the category you provide in name.

        • Max – The highest count in the category you provide in name.

      • order (string) –

        Specifies whether to sort the results in ascending or descending order of the summary statistic ( value in the response).

  • binBy (list) –

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

    • (dict) –

      Contains the time metric, interval, and method by which to bin the analytics data.

      • name (string) – [REQUIRED]

        Specifies the time metric by which to bin the analytics data.

      • interval (string) – [REQUIRED]

        Specifies the interval of time by which to bin the analytics data.

      • order (string) –

        Specifies whether to bin the analytics data in ascending or descending order. If this field is left blank, the default order is by the key of the bin in descending order.

  • groupBy (list) –

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

    • IntentStageName – The name of the intent stage.

    • SwitchedToIntent – The intent to which the conversation was switched (if any).

    • (dict) –

      Contains the category by which to group the intent stages.

      • name (string) – [REQUIRED]

        Specifies whether to group the intent stages by their name or the intent to which the session was switched.

  • filters (list) –

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

    • (dict) –

      Contains fields describing a condition by which to filter the intent stages. The expression may be understood as name operator values. For example:

      • IntentName CO Book – The intent name contains the string “Book.”

      • BotVersion EQ 2 – The bot version is equal to two.

      The operators that each filter supports are listed below:

      • BotAliasEQ.

      • BotVersionEQ.

      • LocaleIdEQ.

      • ModalityEQ.

      • ChannelEQ.

      • SessionIdEQ.

      • OriginatingRequestIdEQ.

      • IntentNameEQ, CO.

      • IntentStageNameEQ, CO.

      • name (string) – [REQUIRED]

        The category by which to filter the intent stages. The descriptions for each option are as follows:

        • BotAlias – The name of the bot alias.

        • BotVersion – The version of the bot.

        • LocaleId – The locale of the bot.

        • Modality – The modality of the session with the bot (audio, DTMF, or text).

        • Channel – The channel that the bot is integrated with.

        • SessionId – The identifier of the session with the bot.

        • OriginatingRequestId – The identifier of the first request in a session.

        • IntentName – The name of the intent.

        • IntentStageName – The stage in the intent.

      • operator (string) – [REQUIRED]

        The operation by which to filter the category. The following operations are possible:

        • CO – Contains

        • EQ – Equals

        • GT – Greater than

        • LT – Less than

        The operators that each filter supports are listed below:

        • BotAliasEQ.

        • BotVersionEQ.

        • LocaleIdEQ.

        • ModalityEQ.

        • ChannelEQ.

        • SessionIdEQ.

        • OriginatingRequestIdEQ.

        • IntentNameEQ, CO.

        • IntentStageNameEQ, CO.

      • values (list) – [REQUIRED]

        An array containing the values of the category by which to apply the operator to filter the results. You can provide multiple values if the operator is EQ or CO. If you provide multiple values, you filter for results that equal/contain any of the values. For example, if the name, operator, and values fields are Modality, EQ, and [Speech, Text], the operation filters for results where the modality was either Speech or Text.

        • (string) –

  • maxResults (integer) – 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.

  • nextToken (string) –

    If the response from the ListIntentStageMetrics 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 ListIntentStageMetrics request to return the next page of results. For a complete set of results, call the ListIntentStageMetrics operation until the nextToken returned in the response is null.

Return type:

dict

Returns:

Response Syntax

{
    'botId': 'string',
    'results': [
        {
            'binKeys': [
                {
                    'name': 'ConversationStartTime'|'UtteranceTimestamp',
                    'value': 123
                },
            ],
            'groupByKeys': [
                {
                    'name': 'IntentStageName'|'SwitchedToIntent',
                    'value': 'string'
                },
            ],
            'metricsResults': [
                {
                    'name': 'Count'|'Success'|'Failed'|'Dropped'|'Retry',
                    'statistic': 'Sum'|'Avg'|'Max',
                    'value': 123.0
                },
            ]
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) –

    • botId (string) –

      The identifier for the bot for which you retrieved intent stage metrics.

    • results (list) –

      The results for the intent stage metrics.

      • (dict) –

        An object containing the results for the intent stage metrics you requested and the bin and/or group they refer to, if applicable.

        • binKeys (list) –

          A list of objects containing the criteria you requested for binning results and the values of the bins.

          • (dict) –

            An object containing the criterion by which to bin the results and the value that defines that bin.

            • name (string) –

              The criterion by which to bin the results.

            • value (integer) –

              The value of the criterion that defines the bin.

        • groupByKeys (list) –

          A list of objects containing the criteria you requested for grouping results and the values of the bins.

          • (dict) –

            Contains the category by which the intent stage analytics and the values for that category were grouped.

            • name (string) –

              A category by which the intent stage analytics were grouped.

            • value (string) –

              A member of the category by which the intent stage analytics were grouped.

        • metricsResults (list) –

          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 method by which to organize the results.

          • (dict) –

            An object containing the results for an intent stage metric you requested.

            • name (string) –

              The metric that you requested.

              • Count – The number of times the intent stage occurred.

              • Success – The number of times the intent stage succeeded.

              • Failure – The number of times the intent stage failed.

              • Dropped – The number of times the user dropped the intent stage.

              • Retry – The number of times the bot tried to elicit a response from the user at this stage.

            • statistic (string) –

              The summary statistic that you requested to calculate.

              • Sum – The total count for the category you provide in name.

              • Average – The total count divided by the number of intent stages in the category you provide in name.

              • Max – The highest count in the category you provide in name.

            • value (float) –

              The value of the summary statistic for the metric that you requested.

    • nextToken (string) –

      If the response from the ListIntentStageMetrics 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 ListIntentStageMetrics request to return the next page of results. For a complete set of results, call the ListIntentStageMetrics operation until the nextToken returned in the response is null.

Exceptions

  • LexModelsV2.Client.exceptions.ThrottlingException

  • LexModelsV2.Client.exceptions.ValidationException

  • LexModelsV2.Client.exceptions.PreconditionFailedException

  • LexModelsV2.Client.exceptions.ServiceQuotaExceededException

  • LexModelsV2.Client.exceptions.InternalServerException