start_conversation¶
Operation¶
Async only
This operation uses an event stream, so only the asynchronous client supports it.
start_conversation
async
¶
start_conversation(request: StartConversationInput | StartConversationInputDict | None = None, /, *, plugins: list[Plugin] | None = None, **kwargs: Unpack[StartConversationInputDict]) -> AsyncDuplexEventStream[StartConversationRequestEventStream, StartConversationResponseEventStream, StartConversationOutput]
Starts an HTTP/2 bidirectional event stream that enables you to send audio, text, or DTMF input in real time. After your application starts a conversation, users send input to Amazon Lex V2 as a stream of events. Amazon Lex V2 processes the incoming events and responds with streaming text or audio events.
Audio input must be in the following format:
audio/lpcm sample-rate=8000 sample-size-bits=16 channel-count=1; is-big-endian=false.
If the optional post-fulfillment response is specified, the messages are returned as follows. For more information, see PostFulfillmentStatusSpecification.
-
Success message - Returned if the Lambda function completes successfully and the intent state is fulfilled or ready fulfillment if the message is present.
-
Failed message - The failed message is returned if the Lambda function throws an exception or if the Lambda function returns a failed intent state without a message.
-
Timeout message - If you don't configure a timeout message and a timeout, and the Lambda function doesn't return within 30 seconds, the timeout message is returned. If you configure a timeout, the timeout message is returned when the period times out.
For more information, see Completion message.
If the optional update message is configured, it is played at the specified frequency while the Lambda function is running and the update message state is active. If the fulfillment update message is not active, the Lambda function runs with a 30 second timeout.
For more information, see Update message
The StartConversation operation is supported only in the following
SDKs:
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request
|
StartConversationInput | StartConversationInputDict | 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[StartConversationInputDict]
|
The input fields as keyword arguments. |
{}
|
Returns:
| Type | Description |
|---|---|
AsyncDuplexEventStream[StartConversationRequestEventStream, StartConversationResponseEventStream, StartConversationOutput]
|
An |
Input¶
Pass the input as keyword arguments, a positional dictionary, or a positional model object. Pass plugins separately as a keyword argument.
StartConversationInputDict
¶
Bases: TypedDict
Dictionary form of StartConversationInput.
Attributes¶
bot_alias_id
instance-attribute
¶
The alias identifier in use for the bot that processes the request.
StartConversationInput
dataclass
¶
Bases: _SerdeShape
Dataclass for StartConversationInput structure.
Attributes¶
bot_alias_id
class-attribute
instance-attribute
¶
bot_alias_id: str | None = ...
The alias identifier in use for the bot that processes the request.
bot_id
class-attribute
instance-attribute
¶
bot_id: str | None = ...
The identifier of the bot to process the request.
conversation_mode
class-attribute
instance-attribute
¶
conversation_mode: str | None = ...
The conversation type that you are using the Amazon Lex V2. If the
conversation mode is AUDIO you can send both audio and DTMF
information. If the mode is TEXT you can only send text.
Output¶
This operation returns an AsyncDuplexEventStream for bidirectional streaming.
Event Stream Structure¶
Input Event Type¶
StartConversationRequestEventStream
Output Event Type¶
StartConversationResponseEventStream
Initial Response Structure¶
StartConversationOutput
dataclass
¶
Bases: _SerdeShape
Dataclass for StartConversationOutput structure.