Skip to content

put_session

Operation

put_session

put_session(request: PutSessionInput | PutSessionInputDict | None = None, /, *, plugins: list[Plugin] | None = None, **kwargs: Unpack[PutSessionInputDict]) -> 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
request PutSessionInput | PutSessionInputDict | None

The input as a model or dictionary. Pass this or keyword arguments, not both.

None
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
**kwargs Unpack[PutSessionInputDict]

The input fields as keyword arguments.

{}

Returns:

Type Description
PutSessionOutput

An instance of PutSessionOutput.

put_session async

put_session(request: PutSessionInput | PutSessionInputDict | None = None, /, *, plugins: list[Plugin] | None = None, **kwargs: Unpack[PutSessionInputDict]) -> 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
request PutSessionInput | PutSessionInputDict | None

The input as a model or dictionary. Pass this or keyword arguments, not both.

None
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
**kwargs Unpack[PutSessionInputDict]

The input fields as keyword arguments.

{}

Returns:

Type Description
PutSessionOutput

An instance of PutSessionOutput.

Input

Pass the input as keyword arguments, a positional dictionary, or a positional model object. Pass plugins separately as a keyword argument.

PutSessionInputDict

Bases: TypedDict

Dictionary form of PutSessionInput.

Attributes

bot_alias_id instance-attribute
bot_alias_id: Required[str]

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

bot_id instance-attribute
bot_id: Required[str]

The identifier of the bot that receives the session data.

locale_id instance-attribute
locale_id: Required[str]

The locale where the session is in use.

messages instance-attribute
messages: Sequence[Message | MessageDict] | 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 instance-attribute
request_attributes: Mapping[str, str] | 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 instance-attribute
response_content_type: str | 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 instance-attribute
session_id: Required[str]

The identifier of the session that receives the session data.

session_state instance-attribute

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.

PutSessionInput dataclass

Bases: _SerdeShape

Dataclass for PutSessionInput structure.

Attributes

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

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

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

The identifier of the bot that receives the session data.

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

The locale where the session is in use.

messages class-attribute instance-attribute
messages: list[Message] | 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 = ...

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

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

The identifier of the session that receives the session data.

session_state class-attribute instance-attribute
session_state: SessionState | 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

Bases: _SerdeShape

Dataclass for PutSessionOutput structure.

Attributes

audio_stream class-attribute instance-attribute
audio_stream: StreamingBlob = ...

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

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

messages class-attribute instance-attribute
messages: str | 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 = ...

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.

response_metadata class-attribute instance-attribute
response_metadata: ResponseMetadata = ...

Metadata about the response that produced this output. Use this to recover the request identifiers a service's support team needs in order to investigate a call. Members of the metadata are individually optional.

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

The identifier of the session that received the data.

session_state class-attribute instance-attribute
session_state: str | 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.