LexRuntimeV2Client.put_session
rboto-lex-runtime-v2==0.4.0 · Service index · Types
Model summary (excerpt): 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.
Install and imports
from rboto import LexRuntimeV2Client
from collections.abc import Sequence
from rboto_lex_runtime_v2.types import (
Message,
PutSessionOutput,
SessionState,
)
Signature
async def put_session(
*,
bot_id: str,
bot_alias_id: str,
locale_id: str,
session_id: str,
session_state: SessionState,
messages: Sequence[Message] | None = None,
request_attributes: dict[str, str] | None = None,
response_content_type: str | None = None,
) -> PutSessionOutput: ...
Arguments without defaults are required. None omits an optional request argument. Static types do not validate resource existence, permissions, lengths, ranges, or conditional service requirements.
Arguments
| Argument | Required | Model notes (excerpt) |
|---|---|---|
bot_id |
Yes | The identifier of the bot that receives the session data. |
bot_alias_id |
Yes | The alias identifier of the bot that receives the session data. |
locale_id |
Yes | The locale where the session is in use. |
session_id |
Yes | The identifier of the session that receives the session data. |
session_state |
Yes | 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. |
messages |
No | A list of messages to send to the user. Messages are sent in the order that they are defined in the list. |
request_attributes |
No | 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 |
No | 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. |
Output
PutSessionOutput.
Read-only native attributes, accessed as response.field. Collection getters materialize Python values; to_dict() recursively materializes a mapping. Streams are consumed once.
| Field | Type | Presence | References |
|---|---|---|---|
content_type |
str | None |
Always present | — |
messages |
str | None |
Always present | — |
session_state |
str | None |
Always present | — |
request_attributes |
str | None |
Always present | — |
session_id |
str | None |
Always present | — |
audio_stream |
ByteStream |
Always present | ByteStream |
| None means a value can be absent. Output mappings include every declared key; optional input keys may be omitted. Unknown output enum/union variants are not automatically valid inputs.
Related types
Message, PutSessionOutput, SessionState
Follow these links for nested inputs and outputs; recursive types link back to the same type page.
Pagination and streaming
No generated paginator for this operation.
Output streams: ByteStream.
Consume with async for. Do not reuse a consumed stream.
ByteStream.read() buffers the complete body.
Errors
Import from rboto_lex_runtime_v2.exceptions:
AccessDeniedError, BadGatewayError, ConflictError, DependencyFailedError, InternalServerError, ResourceNotFoundError, ThrottlingError, ValidationError.
Other service failures use the service base error; credential, transport and timeout failures use shared errors.