使用AWS Lambda(python)来执行Amazon Lex的if语句时遇到麻烦

编程入门 行业动态 更新时间:2024-10-10 15:19:49
本文介绍了使用AWS Lambda(python)来执行Amazon Lex的if语句时遇到麻烦的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试为Amazon lex做一个if语句,其中如果用户对问题1回答"A",则用户的下一个问题将是问题2,但是当用户回答"B"时,则将用户带到问题3.例如,

示例1:

Lex:你喜欢冰淇淋吗?"

用户:是"

Lex:什么味道"?

示例2:

Lex:你喜欢冰淇淋吗?"

用户:否"

Lex:你喜欢蛋糕吗?"

我知道我必须在aws lambda(python)中进行验证,但是我不确定如何执行此代码.

解决方案

首先,取消选中lex上该冰淇淋味插槽的require按钮(您可以在lambda中进行验证).

当填入对冰淇淋y/n的答复时,您将检查该值是否为no,在这种情况下,您会将冰淇淋风味的值分配给N/A,并引起下一个问题的答复./p>

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.

解决方案

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.

更多推荐

使用AWS Lambda(python)来执行Amazon Lex的if语句时遇到麻烦

本文发布于:2023-11-28 06:02:31,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1641218.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:语句   麻烦   Lambda   AWS   python

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!