recognize_text¶
Operation¶
recognize_text
async
¶
recognize_text(input: RecognizeTextInput, plugins: list[Plugin] | None = None) -> RecognizeTextOutput
Sends user input to Amazon Lex V2. Client applications use this API to send requests to Amazon Lex V2 at runtime. Amazon Lex V2 then interprets the user input using the machine learning model that it build for the bot.
In response, Amazon Lex V2 returns the next message to convey to the user and an optional response card to display.
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.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input
|
RecognizeTextInput
|
An instance of |
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 |
|---|---|
RecognizeTextOutput
|
An instance of |
Input¶
RecognizeTextInput
dataclass
¶
Dataclass for RecognizeTextInput structure.
Attributes¶
bot_alias_id
class-attribute
instance-attribute
¶
bot_alias_id: str | None = None
The alias identifier in use for the bot that processes the request.
bot_id
class-attribute
instance-attribute
¶
bot_id: str | None = None
The identifier of the bot that processes the request.
locale_id
class-attribute
instance-attribute
¶
locale_id: str | None = None
The locale where the session is in use.
request_attributes
class-attribute
instance-attribute
¶
request_attributes: dict[str, str] | None = None
Request-specific information passed between the client application and Amazon Lex V2
The namespace x-amz-lex: is reserved for special attributes. Don't
create any request attributes with the prefix x-amz-lex:.
session_id
class-attribute
instance-attribute
¶
session_id: str | None = None
The identifier of the user session that is having the conversation.
session_state
class-attribute
instance-attribute
¶
session_state: SessionState | None = None
The current state of the dialog between the user and the bot.
text
class-attribute
instance-attribute
¶
text: str | None = field(repr=False, default=None)
The text that the user entered. Amazon Lex V2 interprets this text.
Output¶
RecognizeTextOutput
dataclass
¶
Dataclass for RecognizeTextOutput structure.
Attributes¶
interpretations
class-attribute
instance-attribute
¶
interpretations: list[Interpretation] | None = None
A list of intents that Amazon Lex V2 determined might satisfy the user's utterance.
Each interpretation includes the intent, a score that indicates now 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.
messages
class-attribute
instance-attribute
¶
messages: list[Message] | None = None
A list of messages last sent to the user. The messages are ordered based on the order that you returned the messages from your Lambda function or the order that the messages are defined in the bot.
recognized_bot_member
class-attribute
instance-attribute
¶
recognized_bot_member: RecognizedBotMember | None = None
The bot member that recognized the text.
request_attributes
class-attribute
instance-attribute
¶
request_attributes: dict[str, str] | None = None
The attributes sent in the request.
session_id
class-attribute
instance-attribute
¶
session_id: str | None = None
The identifier of the session in use.
session_state
class-attribute
instance-attribute
¶
session_state: SessionState | None = None
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.