任何人都可以提供关于如何确切地使用inputTranscript lex事件将输入作为值返回给插槽的信息,以允许使用开放的插槽类型吗?我可以捕获用户输入没问题,它只是将它作为遇到问题的插槽值发送回去.从研究中可以看出,这是完成将任何值接受到插槽中的能力的最佳方法.我只是似乎无法真正使它工作.我已经阅读了几篇有关创建插槽的文章,然后使用了elicit插槽功能,但是其中没有什么非常详细的. 谢谢
Can anyone provide any insight on exactly how to use the inputTranscript lex event to feed that input back to a slot as its value, to allow for an open slot type? I can capture the user input no problem, its just sending it back as the slot value where I'm encountering issues. From what I can see from researching, this is the best way to accomplish the ability to accept any value into a slot. I just cant seem to be able to actually get it to work. I've read a few posts stating to create the slot, then use the elicit slot function but nothing out there is very detailed. Thanks
推荐答案假设您的意图中有一个插槽anyString. 您需要做的第一件事就是取消选中此插槽的必需复选框. 现在,在选项中,选择Initialization and validation code hook并选择Lambda函数. 在DialogCodeHook中,我们可以使用以下代码来获取用户输入并将其分配到插槽anyString中:
Suppose you have a slot anyString in your intent. First thing you need to do is uncheck the required checkbox for this slot. Now in Options, choose Initialization and validation code hook and select your Lambda function. IN DialogCodeHook we can grab the user input and assign it to our slot anyString using below code:
slots = intent_request['currentIntent']['slots'] slots['anyString'] = intent_request['inputTranscript']您可以阅读有关dialogAction的更多信息这里.
You can read more about dialogAction here.
希望有帮助.
更多推荐
使用Amazon Lex的inputTranscript允许一个宽阔的插槽
发布评论