Using Amazon Lex's inputTranscript to allow for an wide open slot

☆樱花仙子☆ 提交于 2020-01-06 12:36:22

问题


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


回答1:


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']

You can read more about dialogAction here.

Hope it helps.



来源:https://stackoverflow.com/questions/54079835/using-amazon-lexs-inputtranscript-to-allow-for-an-wide-open-slot

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!