Skip to content

get_session

get_session(
    bot_name: BotName,
    bot_alias: BotAlias,
    user_id: UserId,
    *,
    config_overrides: Optional[LexRuntimeServiceClientConfig] = None,
    checkpoint_label_filter: Optional[IntentSummaryCheckpointLabel] = None,
) -> GetSessionResponse

Returns session information for a specified bot, alias, and user ID.

Parameters:

  • bot_name (BotName) –

    The name of the bot that contains the session data.

  • bot_alias (BotAlias) –

    The alias in use for the bot that contains the session data.

  • user_id (UserId) –

    The ID of the client application user. Amazon Lex uses this to identify a user's conversation with your bot.

  • checkpoint_label_filter (Optional[IntentSummaryCheckpointLabel], default: None ) –

    A string used to filter the intents returned in the recentIntentSummaryView structure.

    When you specify a filter, only intents with their checkpointLabel field set to that string are returned.

Raises:

Source code in docs_src/capo_lex_runtime_service/_services/lex_runtime_service.py
def get_session(
    self,
    bot_name: "capo_lex_runtime_service.types.bot_name.BotName",
    bot_alias: "capo_lex_runtime_service.types.bot_alias.BotAlias",
    user_id: "capo_lex_runtime_service.types.user_id.UserId",
    *,
    config_overrides: Optional[LexRuntimeServiceClientConfig] = None,
    checkpoint_label_filter: Optional[
        "capo_lex_runtime_service.types.intent_summary_checkpoint_label.IntentSummaryCheckpointLabel"
    ] = None,
) -> "capo_lex_runtime_service.types.get_session_response.GetSessionResponse":
    """<p>Returns session information for a specified bot, alias, and user ID.</p>

    Args:
        bot_name: <p>The name of the bot that contains the session data.</p>
        bot_alias: <p>The alias in use for the bot that contains the session data.</p>
        user_id: <p>The ID of the client application user. Amazon Lex uses this to identify a user's conversation with your bot. </p>
        checkpoint_label_filter: <p>A string used to filter the intents returned in the <code>recentIntentSummaryView</code> structure. </p> <p>When you specify a filter, only intents with their <code>checkpointLabel</code> field set to that string are returned.</p>

    Raises:
        capo_lex_runtime_service.errors.bad_request_exception.BadRequestException: <p> Request validation failed, there is no usable message in the context, or the bot build failed, is still in progress, or contains unbuilt changes. </p>
        capo_lex_runtime_service.errors.internal_failure_exception.InternalFailureException: <p>Internal service error. Retry the call.</p>
        capo_lex_runtime_service.errors.limit_exceeded_exception.LimitExceededException: <p>Exceeded a limit.</p>
        capo_lex_runtime_service.errors.not_found_exception.NotFoundException: <p>The resource (such as the Amazon Lex bot or an alias) that is referred to is not found.</p>
        capo_lex_runtime_service.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_lex_runtime_service.types.get_session_request.GetSessionRequest]",
    ) -> OperationResponse[
        "capo_lex_runtime_service.types.get_session_response.GetSessionResponse"
    ]:
        import capo_lex_runtime_service._operations.aws_deep_sense_run_time_service.get_session

        output, http_response = (
            capo_lex_runtime_service._operations.aws_deep_sense_run_time_service.get_session.get_session(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_lex_runtime_service.types.get_session_response.GetSessionResponse",
    ) -> dict[str, Any]:
        import capo_lex_runtime_service.types.get_session_response

        return capo_lex_runtime_service.types.get_session_response.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("GetSession", redact_output=_redact_output),
    )
    input_: capo_lex_runtime_service.types.get_session_request.GetSessionRequest = {
        "bot_name": bot_name,
        "bot_alias": bot_alias,
        "user_id": user_id,
    }
    if checkpoint_label_filter is not None:
        input_["checkpoint_label_filter"] = checkpoint_label_filter

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