Dialogflow值存储在错误的参数中 [英] Dialogflow values are stored in wrong parameters

查看:71
本文介绍了Dialogflow值存储在错误的参数中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含不同参数的dialogflow意图。尽管参数名称是唯一的,但在某些情况下,值存储在错误的参数中,而不是在其自己的参数中。





和另一个类似的Intent





在执行时,您将检查触发了哪个操作以确定要调整的值,然后检查参数以查看如何调整它-如果设置了一个数字,则将使用该数字,否则可以通过以下方式对其进行调整百分比。如果要进行相对调整,则可以为其他短语添加其他值。



解决方案2:使用通用值参数



与解决方案1类似,您只需为几个通用参数(百分比值,数字等)加上参数即可,而不必在要调整的属性后面命名每个值参数。确定属性(您的 VarName 参数和实体类型)。



意图更容易指定,但是在在后端,您需要确定用户是否指定了对属性没有意义的value参数(例如,用户指定了更改Term的百分比)并产生错误。可能看起来像这样:





解决方案3:将两者结合在一起



当然,您可以使用所需的任何参数名称。默认情况下,它会在类型之后命名参数,因为这很不错而且很通用。因此,您将使用操作来确定要设置的内容,然后使用通用名称来确定如何设置或调整它。



这些可能看起来像这样:






I have a dialogflow intent which includes different parameters. Although parameter names are unique, in some cases values are stored in wrong parameters and not in their own parameter.

1.png

2.png

3.png

4.png

Image 1.png shows my intent and its "User Says" sentences.As you can see in 2.png, I have a VarName user defined entity for each variable name.Now in 3.png I try dialogflow by writing "Change Loan Term to 20". But as you can see in 4.png instead of putting 20 in "loan-term" parameter, dialogflow puts "Loan Term" value in "years-to-average-principal" which is wrong parameter for this sentence.

I hope I could make it clear. Thanks in advance,

解决方案

The problem is that you have two sample phrases that, from Dialogflow's perspective, match the exact same kind of inputs. By assigning a portion of a phrase to a parameter, you're basically saying that this part of the phrase can be replaced by anything that matches the parameter's Entity type.

So the phrase "Change Years to Average Principal to 5" can be thought to match something like Change @VarName to @sys.number. But the phrase "Change Loan Term to 30" also matches that.

You have several solutions, depending on how you are doing fulfillment and processing these numbers.

Solution 1: Use different Intents

Instead of making one Intent that lets you change all the possible variables, create multiple Intents that capture phrases the way people would express them and tie your backend to handle each intent specifically. So you might have one Intent that looks like this

and another Intent that looks like this

In your fulfillment, you'd check which Action was triggered to determine which value to adjust and then check the parameter to see how to adjust it - if a number was set, you'd use that number, otherwise you might adjust it by the percentage. You could add other values for other phrases if you wanted to do relative adjustments.

Solution 2: Use generic value parameters

Similar to solution 1, instead of naming each value parameter after the attribute you want to adjust, you'll just have a few generic ones (percent value, number, etc) plus the parameter to determine the attribute (your VarName parameter and Entity type).

The Intent is easier to specify, but on the back end, you'll need to determine if the user has specified an value parameter that doesn't make sense for the attribute (such as the user specifying a percentage for changing the Term) and generate an error. It might look something like this:

Solution 3: Combine the two

You can use whatever parameter names you want, of course. By default, it names the parameters after the type, because that's nice and generic. So you'd use the Action to figure out what to set, and then the generic names to figure out how to set or adjust it.

Those might look something like this:

这篇关于Dialogflow值存储在错误的参数中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆