Skip to content

Lex Runtime V2  >  Operations  >  put_session

put_session

Operation

put_session async

put_session(input: PutSessionInput, plugins: list[Plugin] | None = None) -> PutSessionOutput

Creates a new session or modifies an existing session with an Amazon Lex V2 bot. Use this operation to enable your application to set the state of the bot.

Parameters:

Name Type Description Default
input PutSessionInput

An instance of PutSessionInput.

required
plugins list[Plugin] | None

A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations.

None

Returns:

Type Description
PutSessionOutput

An instance of PutSessionOutput.

Input

PutSessionInput dataclass

Dataclass for PutSessionInput structure.

Attributes

bot_alias_id class-attribute instance-attribute
bot_alias_id: str | None = None

The alias identifier of the bot that receives the session data.

bot_id class-attribute instance-attribute
bot_id: str | None = None

The identifier of the bot that receives the session data.

locale_id class-attribute instance-attribute
locale_id: str | None = None

The locale where the session is in use.

messages class-attribute instance-attribute
messages: list[Message] | None = None

A list of messages to send to the user. Messages are sent in the order that they are defined in the list.

request_attributes class-attribute instance-attribute
request_attributes: dict[str, str] | None = None

Request-specific information passed between Amazon Lex V2 and the client application.

The namespace x-amz-lex: is reserved for special attributes. Don't create any request attributes with the prefix x-amz-lex:.

response_content_type class-attribute instance-attribute
response_content_type: str | None = None

The message that Amazon Lex V2 returns in the response can be either text or speech depending on the value of this parameter.

  • If the value is text/plain; charset=utf-8, Amazon Lex V2 returns text in the response.
session_id class-attribute instance-attribute
session_id: str | None = None

The identifier of the session that receives the session data.

session_state class-attribute instance-attribute
session_state: SessionState | None = None

Sets the state of the session with the user. You can use this to set the current intent, attributes, context, and dialog action. Use the dialog action to determine the next step that Amazon Lex V2 should use in the conversation with the user.

Output

PutSessionOutput dataclass

Dataclass for PutSessionOutput structure.

Attributes

audio_stream class-attribute instance-attribute
audio_stream: StreamingBlob = b''

If the requested content type was audio, the audio version of the message to convey to the user.

content_type class-attribute instance-attribute
content_type: str | None = None

The type of response. Same as the type specified in the responseContentType field in the request.

messages class-attribute instance-attribute
messages: str | None = None

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

request_attributes class-attribute instance-attribute
request_attributes: str | None = None

A base-64-encoded gzipped field that provides request-specific information passed between the client application and Amazon Lex V2. These are the same as the requestAttribute parameter in the call to the PutSession operation.

session_id class-attribute instance-attribute
session_id: str | None = None

The identifier of the session that received the data.

session_state class-attribute instance-attribute
session_state: str | None = None

A base-64-encoded gzipped field that represents the current state of the dialog between the user and the bot. Use this to determine the progress of the conversation and what the next action may be.