Having trouble to do if statement for Amazon Lex using AWS Lambda (python)

半腔热情 提交于 2019-12-13 02:49:58

问题


I am trying to do an if statement for amazon lex where if a user answers 'A' for question 1, user's next question will be question 2 but when user answers 'B', the user is brought to question 3 instead. For example,

Example 1:

Lex: "Do you like ice cream?"

User: "Yes"

Lex: "What flavour"?

Example 2:

Lex: "Do you like ice cream?"

User: "No"

Lex: "Do you like cake?"

I know I have to do the validation in aws lambda (python) but I am not really sure what the code is for this to happen.


回答1:


First, uncheck the require button on lex for that ice cream flavor slot (you can do the validation in lambda).

When the response for ice cream y/n is populated you would check to see if the value is no in which case you would assign the value of the ice cream flavor to N/A and elicit response for the next question.



来源:https://stackoverflow.com/questions/47132680/having-trouble-to-do-if-statement-for-amazon-lex-using-aws-lambda-python

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