如何退出从结尾循环的 wit.ai 故事?
How to quit a wit.ai story which is looped back from the end?
我的 wit.ai 应用程序中有三个故事:
- order_pizza: typical pizza ordering with size and toppings
- reserve_table: book a table for a specific date and time
- fav_topping: query favourite pizza topping from historical data by date
第三个,fav_topping有点特别。用户可以问'What was my favourite topping in June?'。得到答案后,可以通过更改日期再次询问 'Hm, and in July?'.
更正式地说:假设我有一个包含多个实体(X 和 Y)的故事。用户用几个参数(a 代表 X,b 代表 Y)提出问题,然后得到答案。然后再次询问(c 代表 X),我的机器人通过将当前参数与之前的参数混合来给出答案(c 代表 X,b 代表 Y)。
为了解决这个问题,我从头到尾回顾了我的 fav_topping 故事:
fav_topping story with a loop-back
完美运行,但我遇到了问题。它永远不会结束。所以无法阻止,用户无法更改主题。这是来自我的 node.js 客户端的日志,使用交互模式:
> What was my favourite topping in June?
fav_topping
context in: {}
entities in: {"contact":[{"confidence":0.9965486088458536,"type":"value","value":"my","suggested":true}],"datetime":[{"confidence":0.9954243915206602,"type":"value","value":"2017-06-01T00:00:00.000-07:00","grain":"month","values":[{"type":"value","value":"2017-06-01T00:00:00.000-07:00","grain":"month"},{"type":"value","value":"2018-06-01T00:00:00.000-07:00","grain":"month"},{"type":"value","value":"2019-06-01T00:00:00.000-07:00","grain":"month"}]}],"intent":[{"confidence":0.9969200405818317,"value":"fav_topping"}]}
context out is: {"ft_answer":"Your favourite topping was tomato for sure :) *"}
sending... {"text":"Your favourite topping was tomato for sure :) "}
> and in June?
fav_topping
context in: {"ft_answer":"Your favourite topping was tomato for sure :) "}
entities in: {"datetime":[{"confidence":0.994470434703695,"type":"value","value":"2017-06-01T00:00:00.000-07:00","grain":"month","values":[{"type":"value","value":"2017-06-01T00:00:00.000-07:00","grain":"month"},{"type":"value","value":"2018-06-01T00:00:00.000-07:00","grain":"month"},{"type":"value","value":"2019-06-01T00:00:00.000-07:00","grain":"month"}]}]}
context out is: {"ft_answer":"Your favourite topping was tomato for sure :) "}
sending... {"text":"Your favourite topping was tomato for sure :) "}
> OK, I want a normal pizza with tomato and pepperoni
fav_topping
context in: {"ft_answer":"Your favourite topping was tomato for sure :) "}
entities in: {"contact":[{"confidence":0.5452832324099028,"type":"value","value":"I","suggested":true}],"pizza_size":[{"confidence":0.9769454518025678,"type":"value","value":"middle"}],"pizza_topping":[{"confidence":0.9934795348369287,"type":"value","value":"tomato"},{"confidence":0.9505825366331593,"type":"value","value":"pepperoni"}],"intent":[{"confidence":0.6669035510798399,"value":"order_pizza"}]}
context out is: {"ft_answer":"Your favourite topping was tomato for sure :) "}
sending... {"text":"Your favourite topping was tomato for sure :) "}
> Book me a table for 5 persons at 9pm
fav_topping
context in: {"ft_answer":"Your favourite topping was tomato for sure :) "}
entities in: {"contact":[{"confidence":0.8387365394318869,"type":"value","value":"me","suggested":true}],"number":[{"confidence":1,"type":"value","value":5}],"datetime":[{"confidence":1,"type":"value","value":"2016-07-07T21:00:00.000-07:00","grain":"hour","values":[{"type":"value","value":"2016-07-07T21:00:00.000-07:00","grain":"hour"},{"type":"value","value":"2016-07-08T21:00:00.000-07:00","grain":"hour"},{"type":"value","value":"2016-07-09T21:00:00.000-07:00","grain":"hour"}]}],"intent":[{"confidence":0.9997353858626356,"value":"reserve_table"}]}
context out is: {"ft_answer":"Your favourite topping was tomato for sure :) "}
sending... {"text":"Your favourite topping was tomato for sure :) *"}
问题是:我如何告诉 manually/programatically BE 完成这个故事?或者,我如何设置我的故事来处理切换?
还有一点:正如您在我的日志中看到的那样,BE 很好地理解用户开始了一个新主题(认识到意图更改为 'order_pizza' 和 'reserve_table')。如果我能明确定义故事的意图,也许会有很大帮助。你怎么看? (对我们现在的内容没有太大的改变:定义故事的第一句话)
感谢您的详细解释。这是 Bot Engine 目前的一个限制,我们正在研究一种更优雅的方式来解决这个问题。同时,当意图不是 "fav_topping".
时,您可能想要删除 "ft_answer" 上下文键
有关上下文的更多信息
机智读取上下文以预测下一步。我们从不更新我们这边的上下文。您将使用您这边的操作来更新上下文中的键。这些键可以反过来影响基于故事的预测,也可以通过变量构建机器人答案。机智使用当前上下文(目前仅使用键)、上下文的先前状态(在交互 N-1、N-2 ......)以及用户消息(特征实体)来预测下一个动作。
我的 wit.ai 应用程序中有三个故事:
- order_pizza: typical pizza ordering with size and toppings
- reserve_table: book a table for a specific date and time
- fav_topping: query favourite pizza topping from historical data by date
第三个,fav_topping有点特别。用户可以问'What was my favourite topping in June?'。得到答案后,可以通过更改日期再次询问 'Hm, and in July?'.
更正式地说:假设我有一个包含多个实体(X 和 Y)的故事。用户用几个参数(a 代表 X,b 代表 Y)提出问题,然后得到答案。然后再次询问(c 代表 X),我的机器人通过将当前参数与之前的参数混合来给出答案(c 代表 X,b 代表 Y)。
为了解决这个问题,我从头到尾回顾了我的 fav_topping 故事: fav_topping story with a loop-back
完美运行,但我遇到了问题。它永远不会结束。所以无法阻止,用户无法更改主题。这是来自我的 node.js 客户端的日志,使用交互模式:
> What was my favourite topping in June?
fav_topping
context in: {}
entities in: {"contact":[{"confidence":0.9965486088458536,"type":"value","value":"my","suggested":true}],"datetime":[{"confidence":0.9954243915206602,"type":"value","value":"2017-06-01T00:00:00.000-07:00","grain":"month","values":[{"type":"value","value":"2017-06-01T00:00:00.000-07:00","grain":"month"},{"type":"value","value":"2018-06-01T00:00:00.000-07:00","grain":"month"},{"type":"value","value":"2019-06-01T00:00:00.000-07:00","grain":"month"}]}],"intent":[{"confidence":0.9969200405818317,"value":"fav_topping"}]}
context out is: {"ft_answer":"Your favourite topping was tomato for sure :) *"}
sending... {"text":"Your favourite topping was tomato for sure :) "}
> and in June?
fav_topping
context in: {"ft_answer":"Your favourite topping was tomato for sure :) "}
entities in: {"datetime":[{"confidence":0.994470434703695,"type":"value","value":"2017-06-01T00:00:00.000-07:00","grain":"month","values":[{"type":"value","value":"2017-06-01T00:00:00.000-07:00","grain":"month"},{"type":"value","value":"2018-06-01T00:00:00.000-07:00","grain":"month"},{"type":"value","value":"2019-06-01T00:00:00.000-07:00","grain":"month"}]}]}
context out is: {"ft_answer":"Your favourite topping was tomato for sure :) "}
sending... {"text":"Your favourite topping was tomato for sure :) "}
> OK, I want a normal pizza with tomato and pepperoni
fav_topping
context in: {"ft_answer":"Your favourite topping was tomato for sure :) "}
entities in: {"contact":[{"confidence":0.5452832324099028,"type":"value","value":"I","suggested":true}],"pizza_size":[{"confidence":0.9769454518025678,"type":"value","value":"middle"}],"pizza_topping":[{"confidence":0.9934795348369287,"type":"value","value":"tomato"},{"confidence":0.9505825366331593,"type":"value","value":"pepperoni"}],"intent":[{"confidence":0.6669035510798399,"value":"order_pizza"}]}
context out is: {"ft_answer":"Your favourite topping was tomato for sure :) "}
sending... {"text":"Your favourite topping was tomato for sure :) "}
> Book me a table for 5 persons at 9pm
fav_topping
context in: {"ft_answer":"Your favourite topping was tomato for sure :) "}
entities in: {"contact":[{"confidence":0.8387365394318869,"type":"value","value":"me","suggested":true}],"number":[{"confidence":1,"type":"value","value":5}],"datetime":[{"confidence":1,"type":"value","value":"2016-07-07T21:00:00.000-07:00","grain":"hour","values":[{"type":"value","value":"2016-07-07T21:00:00.000-07:00","grain":"hour"},{"type":"value","value":"2016-07-08T21:00:00.000-07:00","grain":"hour"},{"type":"value","value":"2016-07-09T21:00:00.000-07:00","grain":"hour"}]}],"intent":[{"confidence":0.9997353858626356,"value":"reserve_table"}]}
context out is: {"ft_answer":"Your favourite topping was tomato for sure :) "}
sending... {"text":"Your favourite topping was tomato for sure :) *"}
问题是:我如何告诉 manually/programatically BE 完成这个故事?或者,我如何设置我的故事来处理切换?
还有一点:正如您在我的日志中看到的那样,BE 很好地理解用户开始了一个新主题(认识到意图更改为 'order_pizza' 和 'reserve_table')。如果我能明确定义故事的意图,也许会有很大帮助。你怎么看? (对我们现在的内容没有太大的改变:定义故事的第一句话)
感谢您的详细解释。这是 Bot Engine 目前的一个限制,我们正在研究一种更优雅的方式来解决这个问题。同时,当意图不是 "fav_topping".
时,您可能想要删除 "ft_answer" 上下文键有关上下文的更多信息
机智读取上下文以预测下一步。我们从不更新我们这边的上下文。您将使用您这边的操作来更新上下文中的键。这些键可以反过来影响基于故事的预测,也可以通过变量构建机器人答案。机智使用当前上下文(目前仅使用键)、上下文的先前状态(在交互 N-1、N-2 ......)以及用户消息(特征实体)来预测下一个动作。