Amazon Lex Model Building V2

2023/07/18 - Amazon Lex Model Building V2 - 7 new api methods

Changes  This release adds support for Lex Developers to view analytics for their bots.

ListUtteranceMetrics (new) Link ¶

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

  • metrics – A list of AnalyticsUtteranceMetric 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 . Currently, you can specify it in either field, but not in both.

See also: AWS API Documentation

Request Syntax

client.list_utterance_metrics(
    botId='string',
    startDateTime=datetime(2015, 1, 1),
    endDateTime=datetime(2015, 1, 1),
    metrics=[
        {
            'name': 'Count'|'Missed'|'Detected'|'UtteranceTimestamp',
            'statistic': 'Sum'|'Avg'|'Max',
            'order': 'Ascending'|'Descending'
        },
    ],
    binBy=[
        {
            'name': 'ConversationStartTime'|'UtteranceTimestamp',
            'interval': 'OneHour'|'OneDay',
            'order': 'Ascending'|'Descending'
        },
    ],
    groupBy=[
        {
            'name': 'UtteranceText'|'UtteranceState'
        },
    ],
    attributes=[
        {
            'name': 'LastUsedIntent'
        },
    ],
    filters=[
        {
            'name': 'BotAliasId'|'BotVersion'|'LocaleId'|'Modality'|'Channel'|'SessionId'|'OriginatingRequestId'|'UtteranceState'|'UtteranceText',
            'operator': 'EQ'|'GT'|'LT',
            'values': [
                'string',
            ]
        },
    ],
    maxResults=123,
    nextToken='string'
)
type botId

string

param botId

[REQUIRED]

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

type startDateTime

datetime

param startDateTime

[REQUIRED]

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

type endDateTime

datetime

param endDateTime

[REQUIRED]

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

type metrics

list

param metrics

[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 utterances across the user sessions with the bot.

    • name (string) -- [REQUIRED]

      The metric for which you want to get utterance summary statistics.

      • Count – The number of utterances.

      • Missed – The number of utterances that Amazon Lex failed to recognize.

      • Detected – The number of utterances that Amazon Lex managed to detect.

      • UtteranceTimestamp – The date and time of the utterance.

    • 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 utterances 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.

type binBy

list

param binBy

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.

type groupBy

list

param groupBy

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

  • UtteranceText – The transcription of the utterance.

  • UtteranceState – The state of the utterance. The possible states are detailed in Key definitions in the user guide.

  • (dict) --

    Contains the category by which to group the utterances.

    • name (string) -- [REQUIRED]

      Specifies whether to group the utterances by their text or their state.

type attributes

list

param attributes

A list containing attributes related to the utterance that you want the response to return. The following attributes are possible:

  • LastUsedIntent – The last used intent at the time of the utterance.

  • (dict) --

    An object that specifies the last used intent at the time of the utterance as an attribute to return.

    • name (string) -- [REQUIRED]

      An attribute to return. The only available attribute is the intent that the bot mapped the utterance to.

type filters

list

param filters

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 utterances. The expression may be understood as name operator values . For example:

    • LocaleId EQ Book – The locale is the string "en".

    • UtteranceText CO help – The text of the utterance contains the string "help".

    The operators that each filter supports are listed below:

    • BotAliasEQ .

    • BotVersionEQ .

    • LocaleIdEQ .

    • ModalityEQ .

    • ChannelEQ .

    • SessionIdEQ .

    • OriginatingRequestIdEQ .

    • UtteranceStateEQ .

    • UtteranceTextEQ , CO .

    • name (string) -- [REQUIRED]

      The category by which to filter the utterances. 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.

      • UtteranceState – The state of the utterance.

      • UtteranceText – The text in the utterance.

    • 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 .

      • UtteranceStateEQ .

      • UtteranceTextEQ , 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) --

type maxResults

integer

param maxResults

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.

type nextToken

string

param nextToken

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

rtype

dict

returns

Response Syntax

{
    'botId': 'string',
    'results': [
        {
            'binKeys': [
                {
                    'name': 'ConversationStartTime'|'UtteranceTimestamp',
                    'value': 123
                },
            ],
            'groupByKeys': [
                {
                    'name': 'UtteranceText'|'UtteranceState',
                    'value': 'string'
                },
            ],
            'metricsResults': [
                {
                    'name': 'Count'|'Missed'|'Detected'|'UtteranceTimestamp',
                    'statistic': 'Sum'|'Avg'|'Max',
                    'value': 123.0
                },
            ],
            'attributeResults': [
                {
                    'lastUsedIntent': 'string'
                },
            ]
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • botId (string) --

      The identifier for the bot for which you retrieved utterance metrics.

    • results (list) --

      The results for the utterance metrics.

      • (dict) --

        An object containing the results for the utterance metrics you requested and the bin and/or group(s) 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 utterance analytics were grouped and the values for that category.

            • name (string) --

              The category by which the utterance analytics were grouped.

            • value (string) --

              A member of the category by which the utterance 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 the utterance metric you requested.

            • name (string) --

              The metric that you requested.

              • Count – The number of utterances.

              • Missed – The number of utterances that Amazon Lex failed to recognize.

              • Detected – The number of utterances that Amazon Lex managed to detect.

              • UtteranceTimeStamp – The date and time of the utterance.

            • 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 utterances 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.

        • attributeResults (list) --

          A list of objects containing information about the last used intent at the time of an utterance.

          • (dict) --

            An object containing the intent that the bot mapped the utterance to.

            • lastUsedIntent (string) --

              The intent that the bot mapped the utterance to.

    • nextToken (string) --

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

ListSessionAnalyticsData (new) Link ¶

Retrieves a list of metadata for individual user sessions with your bot. The startDateTime and endDateTime fields are required. These fields 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 and the sortBy field to specify the values by which to sort 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.

See also: AWS API Documentation

Request Syntax

client.list_session_analytics_data(
    botId='string',
    startDateTime=datetime(2015, 1, 1),
    endDateTime=datetime(2015, 1, 1),
    sortBy={
        'name': 'ConversationStartTime'|'NumberOfTurns'|'Duration',
        'order': 'Ascending'|'Descending'
    },
    filters=[
        {
            'name': 'BotAliasId'|'BotVersion'|'LocaleId'|'Modality'|'Channel'|'Duration'|'ConversationEndState'|'SessionId'|'OriginatingRequestId'|'IntentPath',
            'operator': 'EQ'|'GT'|'LT',
            'values': [
                'string',
            ]
        },
    ],
    maxResults=123,
    nextToken='string'
)
type botId

string

param botId

[REQUIRED]

The identifier for the bot for which you want to retrieve session analytics.

type startDateTime

datetime

param startDateTime

[REQUIRED]

The date and time that marks the beginning of the range of time for which you want to see session analytics.

type endDateTime

datetime

param endDateTime

[REQUIRED]

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

type sortBy

dict

param sortBy

An object specifying the measure and method by which to sort the session analytics data.

  • name (string) -- [REQUIRED]

    The measure by which to sort the session analytics data.

    • conversationStartTime – The date and time when the conversation began. A conversation is defined as a unique combination of a sessionId and an originatingRequestId .

    • numberOfTurns – The number of turns that the session took.

    • conversationDurationSeconds – The duration of the conversation in seconds.

  • order (string) -- [REQUIRED]

    Specifies whether to sort the results in ascending or descending order.

type filters

list

param filters

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 sessions. The expression may be understood as name operator values . For example:

    • LocaleId EQ en – The locale is "en".

    • Duration GT 200 – The duration is greater than 200 seconds.

    The operators that each filter supports are listed below:

    • BotAliasEQ .

    • BotVersionEQ .

    • LocaleIdEQ .

    • ModalityEQ .

    • ChannelEQ .

    • DurationEQ , GT , LT .

    • conversationEndStateEQ , CO .

    • SessionIdEQ .

    • OriginatingRequestIdEQ .

    • IntentPathEQ .

    • name (string) -- [REQUIRED]

      The category by which to filter the sessions. 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.

      • Duration – The duration of the session.

      • conversationEndState – The final state of the session.

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

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

      • IntentPath – The order of intents taken in a session.

    • 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 .

      • DurationEQ , GT , LT .

      • conversationEndStateEQ , CO .

      • SessionIdEQ .

      • OriginatingRequestIdEQ .

      • IntentPathEQ .

    • 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) --

type maxResults

integer

param maxResults

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.

type nextToken

string

param nextToken

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

rtype

dict

returns

Response Syntax

{
    'botId': 'string',
    'nextToken': 'string',
    'sessions': [
        {
            'botAliasId': 'string',
            'botVersion': 'string',
            'localeId': 'string',
            'channel': 'Facebook'|'Slack'|'TwilioSms',
            'sessionId': 'string',
            'conversationStartTime': datetime(2015, 1, 1),
            'conversationEndTime': datetime(2015, 1, 1),
            'conversationDurationSeconds': 123,
            'conversationEndState': 'Success'|'Failure'|'Dropped',
            'mode': 'Speech'|'Text'|'DTMF'|'MultiMode',
            'numberOfTurns': 123,
            'invokedIntentSamples': [
                {
                    'intentName': 'string'
                },
            ],
            'originatingRequestId': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • botId (string) --

      The unique identifier of the bot that the sessions belong to.

    • nextToken (string) --

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

    • sessions (list) --

      A list of objects, each of which contains information about a session with the bot.

      • (dict) --

        An object containing information about a specific session.

        • botAliasId (string) --

          The identifier of the alias of the bot that the session was held with.

        • botVersion (string) --

          The version of the bot that the session was held with.

        • localeId (string) --

          The locale of the bot that the session was held with.

        • channel (string) --

          The channel that is integrated with the bot that the session was held with.

        • sessionId (string) --

          The identifier of the session.

        • conversationStartTime (datetime) --

          The date and time when the conversation began. A conversation is defined as a unique combination of a sessionId and an originatingRequestId .

        • conversationEndTime (datetime) --

          The date and time when the conversation ended. A conversation is defined as a unique combination of a sessionId and an originatingRequestId .

        • conversationDurationSeconds (integer) --

          The duration of the conversation in seconds. A conversation is defined as a unique combination of a sessionId and an originatingRequestId .

        • conversationEndState (string) --

          The final state of the conversation. A conversation is defined as a unique combination of a sessionId and an originatingRequestId .

        • mode (string) --

          The mode of the session. The possible values are as follows:

          • Speech – The session was spoken.

          • Text – The session was written.

          • DTMF – The session used a touch-tone keypad (Dual Tone Multi-Frequency).

          • MultiMode – The session used multiple modes.

        • numberOfTurns (integer) --

          The number of turns that the session took.

        • invokedIntentSamples (list) --

          A list of objects containing the name of an intent that was invoked.

          • (dict) --

            An object containing the name of an intent that was invoked.

            • intentName (string) --

              The name of an intent that was invoked.

        • originatingRequestId (string) --

          The identifier of the first request in a session.

ListSessionMetrics (new) Link ¶

Retrieves summary metrics for the user sessions with your bot. The following fields are required:

  • metrics – A list of AnalyticsSessionMetric 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 . Currently, you can specify it in either field, but not in both.

See also: AWS API Documentation

Request Syntax

client.list_session_metrics(
    botId='string',
    startDateTime=datetime(2015, 1, 1),
    endDateTime=datetime(2015, 1, 1),
    metrics=[
        {
            'name': 'Count'|'Success'|'Failure'|'Dropped'|'Duration'|'TurnsPerConversation'|'Concurrency',
            'statistic': 'Sum'|'Avg'|'Max',
            'order': 'Ascending'|'Descending'
        },
    ],
    binBy=[
        {
            'name': 'ConversationStartTime'|'UtteranceTimestamp',
            'interval': 'OneHour'|'OneDay',
            'order': 'Ascending'|'Descending'
        },
    ],
    groupBy=[
        {
            'name': 'ConversationEndState'|'LocaleId'
        },
    ],
    filters=[
        {
            'name': 'BotAliasId'|'BotVersion'|'LocaleId'|'Modality'|'Channel'|'Duration'|'ConversationEndState'|'SessionId'|'OriginatingRequestId'|'IntentPath',
            'operator': 'EQ'|'GT'|'LT',
            'values': [
                'string',
            ]
        },
    ],
    maxResults=123,
    nextToken='string'
)
type botId

string

param botId

[REQUIRED]

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

type startDateTime

datetime

param startDateTime

[REQUIRED]

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

type endDateTime

datetime

param endDateTime

[REQUIRED]

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

type metrics

list

param metrics

[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 user sessions with the bot.

    • name (string) -- [REQUIRED]

      The metric for which you want to get session summary statistics.

      • Count – The number of sessions.

      • Success – The number of sessions that succeeded.

      • Failure – The number of sessions that failed.

      • Dropped – The number of sessions that the user dropped.

      • Duration – The duration of sessions.

      • TurnsPerSession – The number of turns in the sessions.

      • Concurrency – The number of sessions occurring in the same period of time.

    • 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 sessions 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.

type binBy

list

param binBy

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.

type groupBy

list

param groupBy

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

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

  • LocaleId – The unique identifier of the bot locale.

  • (dict) --

    Contains the category by which to group the sessions.

    • name (string) -- [REQUIRED]

      Specifies whether to group the session by their end state or their locale.

type filters

list

param filters

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 sessions. The expression may be understood as name operator values . For example:

    • LocaleId EQ en – The locale is "en".

    • Duration GT 200 – The duration is greater than 200 seconds.

    The operators that each filter supports are listed below:

    • BotAliasEQ .

    • BotVersionEQ .

    • LocaleIdEQ .

    • ModalityEQ .

    • ChannelEQ .

    • DurationEQ , GT , LT .

    • conversationEndStateEQ , CO .

    • SessionIdEQ .

    • OriginatingRequestIdEQ .

    • IntentPathEQ .

    • name (string) -- [REQUIRED]

      The category by which to filter the sessions. 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.

      • Duration – The duration of the session.

      • conversationEndState – The final state of the session.

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

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

      • IntentPath – The order of intents taken in a session.

    • 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 .

      • DurationEQ , GT , LT .

      • conversationEndStateEQ , CO .

      • SessionIdEQ .

      • OriginatingRequestIdEQ .

      • IntentPathEQ .

    • 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) --

type maxResults

integer

param maxResults

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.

type nextToken

string

param nextToken

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

rtype

dict

returns

Response Syntax

{
    'botId': 'string',
    'results': [
        {
            'binKeys': [
                {
                    'name': 'ConversationStartTime'|'UtteranceTimestamp',
                    'value': 123
                },
            ],
            'groupByKeys': [
                {
                    'name': 'ConversationEndState'|'LocaleId',
                    'value': 'string'
                },
            ],
            'metricsResults': [
                {
                    'name': 'Count'|'Success'|'Failure'|'Dropped'|'Duration'|'TurnsPerConversation'|'Concurrency',
                    'statistic': 'Sum'|'Avg'|'Max',
                    'value': 123.0
                },
            ]
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • botId (string) --

      The identifier for the bot for which you retrieved session metrics.

    • results (list) --

      The results for the session metrics.

      • (dict) --

        An object containing the results for the session metrics you requested and the bin and/or group(s) 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 session analytics were grouped and a member of that category.

            • name (string) --

              The category by which the session analytics were grouped.

            • value (string) --

              A member of the category by which the session 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 a session metric you requested.

            • name (string) --

              The metric that you requested.

              • Count – The number of sessions.

              • Success – The number of sessions that succeeded.

              • Failure – The number of sessions that failed.

              • Dropped – The number of sessions that the user dropped.

              • Duration – The duration of sessions.

              • TurnPersession – The number of turns in the sessions.

              • Concurrency – The number of sessions occurring in the same period of time.

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

ListIntentMetrics (new) Link ¶

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.

See also: AWS API Documentation

Request Syntax

client.list_intent_metrics(
    botId='string',
    startDateTime=datetime(2015, 1, 1),
    endDateTime=datetime(2015, 1, 1),
    metrics=[
        {
            'name': 'Count'|'Success'|'Failure'|'Switched'|'Dropped',
            'statistic': 'Sum'|'Avg'|'Max',
            'order': 'Ascending'|'Descending'
        },
    ],
    binBy=[
        {
            'name': 'ConversationStartTime'|'UtteranceTimestamp',
            'interval': 'OneHour'|'OneDay',
            'order': 'Ascending'|'Descending'
        },
    ],
    groupBy=[
        {
            'name': 'IntentName'|'IntentEndState'|'IntentLevel'
        },
    ],
    filters=[
        {
            'name': 'BotAliasId'|'BotVersion'|'LocaleId'|'Modality'|'Channel'|'SessionId'|'OriginatingRequestId'|'IntentName'|'IntentEndState',
            'operator': 'EQ'|'GT'|'LT',
            'values': [
                'string',
            ]
        },
    ],
    maxResults=123,
    nextToken='string'
)
type botId

string

param botId

[REQUIRED]

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

type startDateTime

datetime

param startDateTime

[REQUIRED]

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

type endDateTime

datetime

param endDateTime

[REQUIRED]

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

type metrics

list

param metrics

[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 order 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 intents in the bot.

    • name (string) -- [REQUIRED]

      The metric for which you want to get intent summary statistics.

      • Count – The number of times the intent was invoked.

      • Success – The number of times the intent succeeded.

      • Failure – The number of times the intent failed.

      • Switched – The number of times there was a switch to a different intent.

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

    • 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 intents 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.

type binBy

list

param binBy

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.

type groupBy

list

param groupBy

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.

  • (dict) --

    Contains the category by which to group the intents.

    • name (string) -- [REQUIRED]

      Specifies whether to group the intent stages by their name or their end state.

type filters

list

param filters

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 intents. 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 .

    • IntentEndStateEQ , CO .

    • name (string) -- [REQUIRED]

      The category by which to filter the intents. 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.

      • IntentEndState – The final state of 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 .

      • IntentEndStateEQ , 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) --

type maxResults

integer

param maxResults

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.

type nextToken

string

param nextToken

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.

rtype

dict

returns

Response Syntax

{
    'botId': 'string',
    'results': [
        {
            'binKeys': [
                {
                    'name': 'ConversationStartTime'|'UtteranceTimestamp',
                    'value': 123
                },
            ],
            'groupByKeys': [
                {
                    'name': 'IntentName'|'IntentEndState'|'IntentLevel',
                    'value': 'string'
                },
            ],
            'metricsResults': [
                {
                    'name': 'Count'|'Success'|'Failure'|'Switched'|'Dropped',
                    'statistic': 'Sum'|'Avg'|'Max',
                    'value': 123.0
                },
            ]
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • botId (string) --

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

    • results (list) --

      The results for the intent metrics.

      • (dict) --

        An object containing the results for the intent metrics you requested and the bin and/or group(s) 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 groups.

          • (dict) --

            Contains the category by which the intent analytics were grouped and a member of that category.

            • name (string) --

              A category by which the intent analytics were grouped.

            • value (string) --

              A member of the category by which the intent 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 the intent metric you requested.

            • name (string) --

              The metric that you requested. See Key definitions for more details about these metrics.

              • Count – The number of times the intent was invoked.

              • Success – The number of times the intent succeeded.

              • Failure – The number of times the intent failed.

              • Switched – The number of times there was a switch to a different intent.

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

            • statistic (string) --

              The 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 intents 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 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.

ListUtteranceAnalyticsData (new) Link ¶

Retrieves a list of metadata for individual user utterances to your bot. The startDateTime and endDateTime fields are required. These fields 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 and the sortBy field to specify the values by which to sort 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.

See also: AWS API Documentation

Request Syntax

client.list_utterance_analytics_data(
    botId='string',
    startDateTime=datetime(2015, 1, 1),
    endDateTime=datetime(2015, 1, 1),
    sortBy={
        'name': 'UtteranceTimestamp',
        'order': 'Ascending'|'Descending'
    },
    filters=[
        {
            'name': 'BotAliasId'|'BotVersion'|'LocaleId'|'Modality'|'Channel'|'SessionId'|'OriginatingRequestId'|'UtteranceState'|'UtteranceText',
            'operator': 'EQ'|'GT'|'LT',
            'values': [
                'string',
            ]
        },
    ],
    maxResults=123,
    nextToken='string'
)
type botId

string

param botId

[REQUIRED]

The identifier for the bot for which you want to retrieve utterance analytics.

type startDateTime

datetime

param startDateTime

[REQUIRED]

The date and time that marks the beginning of the range of time for which you want to see utterance analytics.

type endDateTime

datetime

param endDateTime

[REQUIRED]

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

type sortBy

dict

param sortBy

An object specifying the measure and method by which to sort the utterance analytics data.

  • name (string) -- [REQUIRED]

    The measure by which to sort the utterance analytics data.

    • Count – The number of utterances.

    • UtteranceTimeStamp – The date and time of the utterance.

  • order (string) -- [REQUIRED]

    Specifies whether to sort the results in ascending or descending order.

type filters

list

param filters

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 utterances. The expression may be understood as name operator values . For example:

    • LocaleId EQ Book – The locale is the string "en".

    • UtteranceText CO help – The text of the utterance contains the string "help".

    The operators that each filter supports are listed below:

    • BotAliasEQ .

    • BotVersionEQ .

    • LocaleIdEQ .

    • ModalityEQ .

    • ChannelEQ .

    • SessionIdEQ .

    • OriginatingRequestIdEQ .

    • UtteranceStateEQ .

    • UtteranceTextEQ , CO .

    • name (string) -- [REQUIRED]

      The category by which to filter the utterances. 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.

      • UtteranceState – The state of the utterance.

      • UtteranceText – The text in the utterance.

    • 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 .

      • UtteranceStateEQ .

      • UtteranceTextEQ , 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) --

type maxResults

integer

param maxResults

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.

type nextToken

string

param nextToken

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

rtype

dict

returns

Response Syntax

{
    'botId': 'string',
    'nextToken': 'string',
    'utterances': [
        {
            'botAliasId': 'string',
            'botVersion': 'string',
            'localeId': 'string',
            'sessionId': 'string',
            'channel': 'Facebook'|'Slack'|'TwilioSms',
            'mode': 'Speech'|'Text'|'DTMF'|'MultiMode',
            'conversationStartTime': datetime(2015, 1, 1),
            'conversationEndTime': datetime(2015, 1, 1),
            'utterance': 'string',
            'utteranceTimestamp': datetime(2015, 1, 1),
            'audioVoiceDurationMillis': 123,
            'utteranceUnderstood': True|False,
            'inputType': 'string',
            'outputType': 'string',
            'associatedIntentName': 'string',
            'associatedSlotName': 'string',
            'intentState': 'Failed'|'Fulfilled'|'InProgress'|'ReadyForFulfillment'|'Waiting'|'FulfillmentInProgress',
            'dialogActionType': 'string',
            'botResponseAudioVoiceId': 'string',
            'slotsFilledInSession': 'string',
            'utteranceRequestId': 'string',
            'botResponses': [
                {
                    'content': 'string',
                    'contentType': 'PlainText'|'CustomPayload'|'SSML'|'ImageResponseCard',
                    'imageResponseCard': {
                        'title': 'string',
                        'subtitle': 'string',
                        'imageUrl': 'string',
                        'buttons': [
                            {
                                'text': 'string',
                                'value': 'string'
                            },
                        ]
                    }
                },
            ]
        },
    ]
}

Response Structure

  • (dict) --

    • botId (string) --

      The unique identifier of the bot that the utterances belong to.

    • nextToken (string) --

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

    • utterances (list) --

      A list of objects, each of which contains information about an utterance in a user session with your bot.

      • (dict) --

        An object containing information about a specific utterance.

        • botAliasId (string) --

          The identifier of the alias of the bot that the utterance was made to.

        • botVersion (string) --

          The version of the bot that the utterance was made to.

        • localeId (string) --

          The locale of the bot that the utterance was made to.

        • sessionId (string) --

          The identifier of the session that the utterance was made in.

        • channel (string) --

          The channel that is integrated with the bot that the utterance was made to.

        • mode (string) --

          The mode of the session. The possible values are as follows:

          • Speech – The session consisted of spoken dialogue.

          • Text – The session consisted of written dialogue.

          • DTMF – The session consisted of touch-tone keypad (Dual Tone Multi-Frequency) key presses.

          • MultiMode – The session consisted of multiple modes.

        • conversationStartTime (datetime) --

          The date and time when the conversation in which the utterance took place began. A conversation is defined as a unique combination of a sessionId and an originatingRequestId .

        • conversationEndTime (datetime) --

          The date and time when the conversation in which the utterance took place ended. A conversation is defined as a unique combination of a sessionId and an originatingRequestId .

        • utterance (string) --

          The text of the utterance.

        • utteranceTimestamp (datetime) --

          The date and time when the utterance took place.

        • audioVoiceDurationMillis (integer) --

          The duration in milliseconds of the audio associated with the utterance.

        • utteranceUnderstood (boolean) --

          Specifies whether the bot understood the utterance or not.

        • inputType (string) --

          The input type of the utterance. The possible values are as follows:

          • PCM format: audio data must be in little-endian byte order.

            • audio/l16; rate=16000; channels=1

            • audio/x-l16; sample-rate=16000; channel-count=1

            • audio/lpcm; sample-rate=8000; sample-size-bits=16; channel-count=1; is-big-endian=false

          • Opus format

            • audio/x-cbr-opus-with-preamble;preamble-size=0;bit-rate=256000;frame-size-milliseconds=4

          • Text format

            • text/plain; charset=utf-8

        • outputType (string) --

          The output type of the utterance. The possible values are as follows:

          • audio/mpeg

          • audio/ogg

          • audio/pcm (16 KHz)

          • audio/ (defaults to mpeg )

          • text/plain; charset=utf-8

        • associatedIntentName (string) --

          The name of the intent that the utterance is associated to.

        • associatedSlotName (string) --

          The name of the slot that the utterance is associated to.

        • intentState (string) --

          The state of the intent that the utterance is associated to.

        • dialogActionType (string) --

          The type of dialog action that the utterance is associated to. See the type field in DialogAction for more information.

        • botResponseAudioVoiceId (string) --

          The identifier for the audio of the bot response.

        • slotsFilledInSession (string) --

          The slots that have been filled in the session by the time of the utterance.

        • utteranceRequestId (string) --

          The identifier of the request associated with the utterance.

        • botResponses (list) --

          A list of objects containing information about the bot response to the utterance.

          • (dict) --

            An object that contains a response to the utterance from the bot.

            • content (string) --

              The text of the response to the utterance from the bot.

            • contentType (string) --

              The type of the response. The following values are possible:

              • PlainText – A plain text string.

              • CustomPayload – A response string that you can customize to include data or metadata for your application.

              • SSML – A string that includes Speech Synthesis Markup Language to customize the audio response.

              • ImageResponseCard – An image with buttons that the customer can select. See ImageResponseCard for more information.

            • imageResponseCard (dict) --

              A card that is shown to the user by a messaging platform. You define the contents of the card, the card is displayed by the platform.

              When you use a response card, the response from the user is constrained to the text associated with a button on the card.

              • title (string) --

                The title to display on the response card. The format of the title is determined by the platform displaying the response card.

              • subtitle (string) --

                The subtitle to display on the response card. The format of the subtitle is determined by the platform displaying the response card.

              • imageUrl (string) --

                The URL of an image to display on the response card. The image URL must be publicly available so that the platform displaying the response card has access to the image.

              • buttons (list) --

                A list of buttons that should be displayed on the response card. The arrangement of the buttons is determined by the platform that displays the button.

                • (dict) --

                  Describes a button to use on a response card used to gather slot values from a user.

                  • text (string) --

                    The text that appears on the button. Use this to tell the user what value is returned when they choose this button.

                  • value (string) --

                    The value returned to Amazon Lex when the user chooses this button. This must be one of the slot values configured for the slot.

ListIntentPaths (new) Link ¶

Retrieves summary statistics for a path of intents that users take over sessions with your bot. The following fields are required:

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

  • intentPath – Define an order of intents for which you want to retrieve metrics. Separate intents in the path with a forward slash. For example, populate the intentPath field with /BookCar/BookHotel to see details about how many times users invoked the BookCar and BookHotel intents in that order.

Use the optional filters field to filter the results.

See also: AWS API Documentation

Request Syntax

client.list_intent_paths(
    botId='string',
    startDateTime=datetime(2015, 1, 1),
    endDateTime=datetime(2015, 1, 1),
    intentPath='string',
    filters=[
        {
            'name': 'BotAliasId'|'BotVersion'|'LocaleId'|'Modality'|'Channel',
            'operator': 'EQ'|'GT'|'LT',
            'values': [
                'string',
            ]
        },
    ]
)
type botId

string

param botId

[REQUIRED]

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

type startDateTime

datetime

param startDateTime

[REQUIRED]

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

type endDateTime

datetime

param endDateTime

[REQUIRED]

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

type intentPath

string

param intentPath

[REQUIRED]

The intent path for which you want to retrieve metrics. Use a forward slash to separate intents in the path. For example:

  • /BookCar

  • /BookCar/BookHotel

  • /BookHotel/BookCar

type filters

list

param filters

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

  • (dict) --

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

    • LocaleId EQ en – The locale is "en".

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

    The operators that each filter supports are listed below:

    • BotAliasEQ .

    • BotVersionEQ .

    • LocaleIdEQ .

    • ModalityEQ .

    • ChannelEQ .

    • name (string) -- [REQUIRED]

      The category by which to filter the intent paths. 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.

    • 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 .

    • 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) --

rtype

dict

returns

Response Syntax

{
    'nodeSummaries': [
        {
            'intentName': 'string',
            'intentPath': 'string',
            'intentCount': 123,
            'intentLevel': 123,
            'nodeType': 'Inner'|'Exit'
        },
    ]
}

Response Structure

  • (dict) --

    • nodeSummaries (list) --

      A list of objects, each of which contains information about a node in the intent path for which you requested metrics.

      • (dict) --

        An object containing information about the requested path.

        • intentName (string) --

          The name of the intent at the end of the requested path.

        • intentPath (string) --

          The path.

        • intentCount (integer) --

          The total number of sessions that follow the given path to the given intent.

        • intentLevel (integer) --

          The number of intents up to and including the requested path.

        • nodeType (string) --

          Specifies whether the node is the end of a path ( Exit ) or not ( Inner ).

ListIntentStageMetrics (new) Link ¶

Retrieves summary metrics for the intent stages 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

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'
)
type botId

string

param botId

[REQUIRED]

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

type startDateTime

datetime

param startDateTime

[REQUIRED]

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

type endDateTime

datetime

param endDateTime

[REQUIRED]

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

type metrics

list

param metrics

[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).

type binBy

list

param binBy

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.

type groupBy

list

param groupBy

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.

type filters

list

param filters

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) --

type maxResults

integer

param maxResults

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.

type nextToken

string

param nextToken

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.

rtype

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.