Skip to content

aws.lexv2_runtime.get_session

Example SQL Queries

SELECT * FROM
aws.lexv2_runtime.get_session
WHERE
"bot_id" = 'VALUE'
AND "bot_alias_id" = 'VALUE'
AND "locale_id" = 'VALUE'
AND "session_id" = 'VALUE';

Description

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

For example, you can use this operation to retrieve session information for a user that has left a long-running session in use.

If the bot, alias, or session identifier doesn't exist, Amazon Lex V2 returns a BadRequestException. If the locale doesn't exist or is not enabled for the alias, you receive a BadRequestException.

Table Definition

Column NameColumn Data Type
bot_alias_id Required Input Column

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

VARCHAR
bot_id Required Input Column

The identifier of the bot that contains the session data.

VARCHAR
locale_id Required Input Column

The locale where the session is in use.

VARCHAR
session_id Required Input Column

The identifier of the returned session.

VARCHAR
_aws_profile Input Column

The AWS profile defines the AWS identity used. It can be defined via credentials or by assuming a IAM role.

STRUCT(
"type" VARCHAR,
"name" VARCHAR,
"account_id" VARCHAR,
"via_profile_name" VARCHAR,
"assumed_role_arn" VARCHAR,
"organization" STRUCT(
"account_name" VARCHAR,
"id" VARCHAR,
"tags" STRUCT(
"key" VARCHAR,
"value" VARCHAR
)[],
"master_account" STRUCT(
"id" VARCHAR,
"email" VARCHAR
),
"parents" STRUCT(
"type" VARCHAR,
"id" VARCHAR,
"name" VARCHAR,
"tags" STRUCT(
"key" VARCHAR,
"value" VARCHAR
)[]
)[]
)
)
Show child fields
_aws_profile.account_id

The AWS account id

_aws_profile.assumed_role_arn

The ARN of the assumed role

_aws_profile.name

The unique name of the profile.

_aws_profile.organization

Information about this profile's membership in the AWS organization.

Show child fields
_aws_profile.organization.account_name

The name of account speciifed by the organization

_aws_profile.organization.id

The organization id

_aws_profile.organization.master_account
Show child fields
_aws_profile.organization.master_account.email

The organization master account email address

_aws_profile.organization.master_account.id

The organization master account id

_aws_profile.organization.parents[]
Show child fields
_aws_profile.organization.parents[].id

The id of the parent

_aws_profile.organization.parents[].name

The name of the parent

_aws_profile.organization.parents[].tags[]
Show child fields
_aws_profile.organization.parents[].tags[].key
_aws_profile.organization.parents[].tags[].value
_aws_profile.organization.parents[].type

The type of parent can be an organization unit or a root

_aws_profile.organization.tags[]
Show child fields
_aws_profile.organization.tags[].key
_aws_profile.organization.tags[].value
_aws_profile.type

The type of profile, either 'credentials' or 'assumed_role'

_aws_profile.via_profile_name

This IAM role for this profile is assumed by first utilizing another profile with this name to obtain credentials.

interpretations

A list of intents that Amazon Lex V2 determined might satisfy the user's utterance.

Each interpretation includes the intent, a score that indicates how confident Amazon Lex V2 is that the interpretation is the correct one, and an optional sentiment response that indicates the sentiment expressed in the utterance.

STRUCT(
"nlu_confidence" STRUCT(
"score" DOUBLE
),
"sentiment_response" STRUCT(
"sentiment" VARCHAR,
"sentiment_score" STRUCT(
"positive" DOUBLE,
"negative" DOUBLE,
"neutral" DOUBLE,
"mixed" DOUBLE
)
),
"intent" STRUCT(
"name" VARCHAR,
"slots" MAP(VARCHAR, STRUCT(
"value" STRUCT(
"original_value" VARCHAR,
"interpreted_value" VARCHAR,
"resolved_values" VARCHAR[]
),
"shape" VARCHAR
)),
"state" VARCHAR,
"confirmation_state" VARCHAR
),
"interpretation_source" VARCHAR
)[]
Show child fields
interpretations[]
Show child fields
interpretations[].intent

A list of intents that might satisfy the user's utterance. The intents are ordered by the confidence score.

Show child fields
interpretations[].intent.confirmation_state

Indicates whether the intent has been Confirmed, Denied, or None if the confirmation stage has not yet been reached.

interpretations[].intent.name

The name of the intent.

interpretations[].intent.slots

A map of all of the slots for the intent. The name of the slot maps to the value of the slot. If a slot has not been filled, the value is null.

interpretations[].intent.state

Indicates the fulfillment state for the intent. The meanings of each value are as follows:

  • Failed – The bot failed to fulfill the intent.

  • Fulfilled – The bot has completed fulfillment of the intent.

  • FulfillmentInProgress – The bot is in the middle of fulfilling the intent.

  • InProgress – The bot is in the middle of eliciting the slot values that are necessary to fulfill the intent.

  • ReadyForFulfillment – The bot has elicited all the slot values for the intent and is ready to fulfill the intent.

  • Waiting – The bot is waiting for a response from the user (limited to streaming conversations).

interpretations[].interpretation_source

Specifies the service that interpreted the input.

interpretations[].nlu_confidence

Determines the threshold where Amazon Lex V2 will insert the AMAZON.FallbackIntent, AMAZON.KendraSearchIntent, or both when returning alternative intents in a response. AMAZON.FallbackIntent and AMAZON.KendraSearchIntent are only inserted if they are configured for the bot.

Show child fields
interpretations[].nlu_confidence.score

A score that indicates how confident Amazon Lex V2 is that an intent satisfies the user's intent. Ranges between 0.00 and 1.00. Higher scores indicate higher confidence.

interpretations[].sentiment_response

The sentiment expressed in an utterance.

When the bot is configured to send utterances to Amazon Comprehend for sentiment analysis, this field contains the result of the analysis.

Show child fields
interpretations[].sentiment_response.sentiment

The overall sentiment expressed in the user's response. This is the sentiment most likely expressed by the user based on the analysis by Amazon Comprehend.

interpretations[].sentiment_response.sentiment_score

The individual sentiment responses for the utterance.

Show child fields
interpretations[].sentiment_response.sentiment_score.mixed

The level of confidence that Amazon Comprehend has in the accuracy of its detection of the MIXED sentiment.

interpretations[].sentiment_response.sentiment_score.negative

The level of confidence that Amazon Comprehend has in the accuracy of its detection of the NEGATIVE sentiment.

interpretations[].sentiment_response.sentiment_score.neutral

The level of confidence that Amazon Comprehend has in the accuracy of its detection of the NEUTRAL sentiment.

interpretations[].sentiment_response.sentiment_score.positive

The level of confidence that Amazon Comprehend has in the accuracy of its detection of the POSITIVE sentiment.

messages

A list of messages that were last sent to the user. The messages are ordered based on the order that your returned the messages from your Lambda function or the order that messages are defined in the bot.

STRUCT(
"content" VARCHAR,
"content_type" VARCHAR,
"image_response_card" STRUCT(
"title" VARCHAR,
"subtitle" VARCHAR,
"image_url" VARCHAR,
"buttons" STRUCT(
"text" VARCHAR,
"value" VARCHAR
)[]
)
)[]
Show child fields
messages[]
Show child fields
messages[].content

The text of the message.

messages[].content_type

Indicates the type of response.

messages[].image_response_card

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.

Show child fields
messages[].image_response_card.buttons[]
Show child fields
messages[].image_response_card.buttons[].text

The text that is displayed on the button.

messages[].image_response_card.buttons[].value

The value returned to Amazon Lex V2 when a user chooses the button.

messages[].image_response_card.image_url

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.

messages[].image_response_card.subtitle

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

messages[].image_response_card.title

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

session_state

Represents the current state of the dialog between the user and the bot.

You can use this to determine the progress of the conversation and what the next action might be.

STRUCT(
"dialog_action" STRUCT(
"type" VARCHAR,
"slot_to_elicit" VARCHAR,
"slot_elicitation_style" VARCHAR,
"sub_slot_to_elicit" STRUCT(
"name" VARCHAR
)
),
"intent" STRUCT(
"name" VARCHAR,
"slots" MAP(VARCHAR, STRUCT(
"value" STRUCT(
"original_value" VARCHAR,
"interpreted_value" VARCHAR,
"resolved_values" VARCHAR[]
),
"shape" VARCHAR
)),
"state" VARCHAR,
"confirmation_state" VARCHAR
),
"active_contexts" STRUCT(
"name" VARCHAR,
"time_to_live" STRUCT(
"time_to_live_in_seconds" BIGINT,
"turns_to_live" BIGINT
),
"context_attributes" MAP(VARCHAR, VARCHAR)
)[],
"session_attributes" MAP(VARCHAR, VARCHAR),
"originating_request_id" VARCHAR,
"runtime_hints" STRUCT(
"slot_hints" MAP(VARCHAR, MAP(VARCHAR, STRUCT(
"runtime_hint_values" STRUCT(
"phrase" VARCHAR
)[]
)))
)
)
Show child fields
session_state.active_contexts[]
Show child fields
session_state.active_contexts[].context_attributes

A list of contexts active for the request. A context can be activated when a previous intent is fulfilled, or by including the context in the request.

If you don't specify a list of contexts, Amazon Lex V2 will use the current list of contexts for the session. If you specify an empty list, all contexts for the session are cleared.

session_state.active_contexts[].name

The name of the context.

session_state.active_contexts[].time_to_live

Indicates the number of turns or seconds that the context is active. Once the time to live expires, the context is no longer returned in a response.

Show child fields
session_state.active_contexts[].time_to_live.time_to_live_in_seconds

The number of seconds that the context is active. You can specify between 5 and 86400 seconds (24 hours).

session_state.active_contexts[].time_to_live.turns_to_live

The number of turns that the context is active. You can specify up to 20 turns. Each request and response from the bot is a turn.

session_state.dialog_action

The next step that Amazon Lex V2 should take in the conversation with a user.

Show child fields
session_state.dialog_action.slot_elicitation_style

Configures the slot to use spell-by-letter or spell-by-word style. When you use a style on a slot, users can spell out their input to make it clear to your bot.

  • Spell by letter - "b" "o" "b"

  • Spell by word - "b as in boy" "o as in oscar" "b as in boy"

For more information, see Using spelling to enter slot values .

session_state.dialog_action.slot_to_elicit

The name of the slot that should be elicited from the user.

session_state.dialog_action.sub_slot_to_elicit

The name of the constituent sub slot of the composite slot specified in slotToElicit that should be elicited from the user.

Show child fields
session_state.dialog_action.sub_slot_to_elicit.name

The name of the slot that should be elicited from the user.

session_state.dialog_action.type

The next action that the bot should take in its interaction with the user. The following values are possible:

  • Close – Indicates that there will not be a response from the user. For example, the statement "Your order has been placed" does not require a response.

  • ConfirmIntent – The next action is asking the user if the intent is complete and ready to be fulfilled. This is a yes/no question such as "Place the order?"

  • Delegate – The next action is determined by Amazon Lex V2.

  • ElicitIntent – The next action is to elicit an intent from the user.

  • ElicitSlot – The next action is to elicit a slot value from the user.

session_state.intent

The active intent that Amazon Lex V2 is processing.

Show child fields
session_state.intent.confirmation_state

Indicates whether the intent has been Confirmed, Denied, or None if the confirmation stage has not yet been reached.

session_state.intent.name

The name of the intent.

session_state.intent.slots

A map of all of the slots for the intent. The name of the slot maps to the value of the slot. If a slot has not been filled, the value is null.

session_state.intent.state

Indicates the fulfillment state for the intent. The meanings of each value are as follows:

  • Failed – The bot failed to fulfill the intent.

  • Fulfilled – The bot has completed fulfillment of the intent.

  • FulfillmentInProgress – The bot is in the middle of fulfilling the intent.

  • InProgress – The bot is in the middle of eliciting the slot values that are necessary to fulfill the intent.

  • ReadyForFulfillment – The bot has elicited all the slot values for the intent and is ready to fulfill the intent.

  • Waiting – The bot is waiting for a response from the user (limited to streaming conversations).

session_state.originating_request_id

A unique identifier for a specific request.

session_state.runtime_hints

Hints for phrases that a customer is likely to use for a slot. Amazon Lex V2 uses the hints to help determine the correct value of a slot.

Show child fields
session_state.runtime_hints.slot_hints

A list of the slots in the intent that should have runtime hints added, and the phrases that should be added for each slot.

The first level of the slotHints map is the name of the intent. The second level is the name of the slot within the intent. For more information, see Using hints to improve accuracy.

The intent name and slot name must exist.

session_state.session_attributes

Map of key/value pairs representing session-specific context information. It contains application information passed between Amazon Lex V2 and a client application.