AWS Lex + Lambda - 无论上下文如何拦截所有下一个用户响应 - 没有定义样本话语?
AWS Lex + Lambda - Intercepting all of next user response regardless of context - without defining sample utterances?
考虑以下场景(U=用户,L=Lex):
U1:你好
L1:您好,请告诉我您的名字。
U2:鲍勃
L2:鲍勃,考虑以下问题:天空是什么颜色?
U3:天空通常是蓝色的,但有时天空是红色的。
系统读取问题数据库并随机选择一个呈现给用户。这是通过 AWS Lambda 完成的,问题在消息 L2 中呈现给用户。
有没有办法说“用户的下一个响应应该被视为他们对问题的回答而不定义话语等?”这是因为机器人发送的问题可能会有很大差异。
我需要一种方法将所有块 U3 传递回 Lambda 进行处理。无论上下文如何,我将如何实现这一目标? (我正在为 Lambda 使用 python)
谢谢
Lex 始终将整个用户的输入传递到 inputTranscript
字段下的 Request
。
inputTranscript – The text used to process the request.
If the input was text, the inputTranscript field contains the text that was input by the user.
If the input was an audio stream, the inputTranscript field contains the text extracted from the audio stream. This is the text that is actually processed to recognize intents and slot values.
这是 Lambda 收到的 Lex 请求的格式 event
:
{
"currentIntent": {
"name": "intent-name",
"slots": {...},
"slotDetails": {...},
"confirmationStatus": "(None, Confirmed, or Denied)"
},
"bot": {...},
"userId": "XXXX",
"invocationSource": "(FulfillmentCodeHook or DialogCodeHook)",
"outputDialogMode": "(Text or Voice)",
"messageVersion": "1.0",
"sessionAttributes": {...},
"requestAttributes": {...}
"inputTranscript": "Text of full user's input utterance",
}
所以在 Lambda 中,您可以通过以下方式访问 inputTranscipt
:
userInput = event.inputTranscript
考虑以下场景(U=用户,L=Lex):
U1:你好
L1:您好,请告诉我您的名字。
U2:鲍勃
L2:鲍勃,考虑以下问题:天空是什么颜色?
U3:天空通常是蓝色的,但有时天空是红色的。
系统读取问题数据库并随机选择一个呈现给用户。这是通过 AWS Lambda 完成的,问题在消息 L2 中呈现给用户。
有没有办法说“用户的下一个响应应该被视为他们对问题的回答而不定义话语等?”这是因为机器人发送的问题可能会有很大差异。
我需要一种方法将所有块 U3 传递回 Lambda 进行处理。无论上下文如何,我将如何实现这一目标? (我正在为 Lambda 使用 python)
谢谢
Lex 始终将整个用户的输入传递到 inputTranscript
字段下的 Request
。
inputTranscript – The text used to process the request.
If the input was text, the inputTranscript field contains the text that was input by the user.
If the input was an audio stream, the inputTranscript field contains the text extracted from the audio stream. This is the text that is actually processed to recognize intents and slot values.
这是 Lambda 收到的 Lex 请求的格式 event
:
{
"currentIntent": {
"name": "intent-name",
"slots": {...},
"slotDetails": {...},
"confirmationStatus": "(None, Confirmed, or Denied)"
},
"bot": {...},
"userId": "XXXX",
"invocationSource": "(FulfillmentCodeHook or DialogCodeHook)",
"outputDialogMode": "(Text or Voice)",
"messageVersion": "1.0",
"sessionAttributes": {...},
"requestAttributes": {...}
"inputTranscript": "Text of full user's input utterance",
}
所以在 Lambda 中,您可以通过以下方式访问 inputTranscipt
:
userInput = event.inputTranscript