Skip to content

list_aggregated_utterances async

list_aggregated_utterances(
    bot_id: Id,
    locale_id: LocaleId,
    aggregation_duration: UtteranceAggregationDuration,
    *,
    config_overrides: Optional[AsyncLexModelsV2ClientConfig] = None,
    bot_alias_id: Optional[BotAliasId] = None,
    bot_version: Optional[BotVersion] = None,
    sort_by: Optional[AggregatedUtterancesSortBy] = None,
    filters: Optional[AggregatedUtterancesFilters] = None,
    max_results: Optional[MaxResults] = None,
    next_token: Optional[NextToken] = None,
) -> ListAggregatedUtterancesResponse

Provides a list of utterances that users have sent to the bot.

Utterances are aggregated by the text of the utterance. For example, all instances where customers used the phrase "I want to order pizza" are aggregated into the same line in the response.

You can see both detected utterances and missed utterances. A detected utterance is where the bot properly recognized the utterance and activated the associated intent. A missed utterance was not recognized by the bot and didn't activate an intent.

Utterances can be aggregated for a bot alias or for a bot version, but not both at the same time.

Utterances statistics are not generated under the following conditions:

  • The childDirected field was set to true when the bot was created.

  • You are using slot obfuscation with one or more slots.

  • You opted out of participating in improving Amazon Lex.

Parameters:

  • bot_id (Id) –

    The unique identifier of the bot associated with this request.

  • bot_alias_id (Optional[BotAliasId], default: None ) –

    The identifier of the bot alias associated with this request. If you specify the bot alias, you can't specify the bot version.

  • bot_version (Optional[BotVersion], default: None ) –

    The identifier of the bot version associated with this request. If you specify the bot version, you can't specify the bot alias.

  • locale_id (LocaleId) –

    The identifier of the language and locale where the utterances were collected. For more information, see Supported languages.

  • aggregation_duration (UtteranceAggregationDuration) –

    The time window for aggregating the utterance information. You can specify a time between one hour and two weeks.

  • sort_by (Optional[AggregatedUtterancesSortBy], default: None ) –

    Specifies sorting parameters for the list of utterances. You can sort by the hit count, the missed count, or the number of distinct sessions the utterance appeared in.

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

    Provides the specification of a filter used to limit the utterances in the response to only those that match the filter specification. You can only specify one filter and one string to filter on.

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

    The maximum number of utterances 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. If you don't specify the maxResults parameter, 1,000 results are returned.

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

    If the response from the ListAggregatedUtterances operation contains more results that specified in the maxResults parameter, a token is returned in the response. Use that token in the nextToken parameter to return the next page of results.

Raises:

  • InternalServerException –

    The service encountered an unexpected condition. Try your request again.

  • PreconditionFailedException –

    Your request couldn't be completed because one or more request fields aren't valid. Check the fields in your request and try again.

  • ThrottlingException –

    Your request rate is too high. Reduce the frequency of requests.

  • ValidationException –

    One of the input parameters in your request isn't valid. Check the parameters and try your request again.

  • UnknownServiceError –

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

Source code in docs_src/capo_lex_models_v2/_services/async_lex_models_v2.py
async def list_aggregated_utterances(
    self,
    bot_id: "capo_lex_models_v2.types.id.Id",
    locale_id: "capo_lex_models_v2.types.locale_id.LocaleId",
    aggregation_duration: "capo_lex_models_v2.types.utterance_aggregation_duration.UtteranceAggregationDuration",
    *,
    config_overrides: Optional[AsyncLexModelsV2ClientConfig] = None,
    bot_alias_id: Optional[
        "capo_lex_models_v2.types.bot_alias_id.BotAliasId"
    ] = None,
    bot_version: Optional["capo_lex_models_v2.types.bot_version.BotVersion"] = None,
    sort_by: Optional[
        "capo_lex_models_v2.types.aggregated_utterances_sort_by.AggregatedUtterancesSortBy"
    ] = None,
    filters: Optional[
        "capo_lex_models_v2.types.aggregated_utterances_filters.AggregatedUtterancesFilters"
    ] = 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_aggregated_utterances_response.ListAggregatedUtterancesResponse":
    """<p>Provides a list of utterances that users have sent to the bot.</p> <p>Utterances are aggregated by the text of the utterance. For example, all instances where customers used the phrase "I want to order pizza" are aggregated into the same line in the response.</p> <p>You can see both detected utterances and missed utterances. A detected utterance is where the bot properly recognized the utterance and activated the associated intent. A missed utterance was not recognized by the bot and didn't activate an intent.</p> <p>Utterances can be aggregated for a bot alias or for a bot version, but not both at the same time.</p> <p>Utterances statistics are not generated under the following conditions:</p> <ul> <li> <p>The <code>childDirected</code> field was set to true when the bot was created.</p> </li> <li> <p>You are using slot obfuscation with one or more slots.</p> </li> <li> <p>You opted out of participating in improving Amazon Lex.</p> </li> </ul>

    Args:
        bot_id: <p>The unique identifier of the bot associated with this request.</p>
        bot_alias_id: <p>The identifier of the bot alias associated with this request. If you specify the bot alias, you can't specify the bot version.</p>
        bot_version: <p>The identifier of the bot version associated with this request. If you specify the bot version, you can't specify the bot alias.</p>
        locale_id: <p>The identifier of the language and locale where the utterances were collected. For more information, see <a href="https://docs.aws.amazon.com/lexv2/latest/dg/how-languages.html">Supported languages</a>.</p>
        aggregation_duration: <p>The time window for aggregating the utterance information. You can specify a time between one hour and two weeks.</p>
        sort_by: <p>Specifies sorting parameters for the list of utterances. You can sort by the hit count, the missed count, or the number of distinct sessions the utterance appeared in.</p>
        filters: <p>Provides the specification of a filter used to limit the utterances in the response to only those that match the filter specification. You can only specify one filter and one string to filter on.</p>
        max_results: <p>The maximum number of utterances 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. If you don't specify the <code>maxResults</code> parameter, 1,000 results are returned.</p>
        next_token: <p>If the response from the <code>ListAggregatedUtterances</code> operation contains more results that specified in the <code>maxResults</code> parameter, a token is returned in the response. Use that token in the <code>nextToken</code> parameter to return the next page of results.</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.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_aggregated_utterances_request.ListAggregatedUtterancesRequest]",
    ) -> AsyncOperationResponse[
        "capo_lex_models_v2.types.list_aggregated_utterances_response.ListAggregatedUtterancesResponse"
    ]:
        import capo_lex_models_v2._operations.lex_model_building_service_v2.list_aggregated_utterances

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListAggregatedUtterances")
    )
    input_: capo_lex_models_v2.types.list_aggregated_utterances_request.ListAggregatedUtterancesRequest = {
        "bot_id": bot_id,
        "locale_id": locale_id,
        "aggregation_duration": aggregation_duration,
    }
    if bot_alias_id is not None:
        input_["bot_alias_id"] = bot_alias_id
    if bot_version is not None:
        input_["bot_version"] = bot_version
    if sort_by is not None:
        input_["sort_by"] = sort_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