LUIS中用于多轮对话的新意图 [英] New intent in LUIS for multi turn dialogs

查看:137
本文介绍了LUIS中用于多轮对话的新意图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要创建一个多转对话框.我不知道如何将它与LUIS模型联系起来.我签出了文档,但是有些示例只有一个转弯对话框.另外,我使用Virtual Assistant模板. 我想做这样的事情.

I am going to create a multi-turn dialog. I didn't get how it should be connected with LUIS models. I checked out documentation, but there are samples with only one turn dialogs. Also, I use Virtual Assistant template. I want to do something like this.

用户:我要预订航班

User: I want to book a flight

Bot:目的地是什么?

Bot: What is the destination?

用户:伦敦

Bot:什么时候?

用户:9月21日.

Bot:机票已购买.

Bot: The ticket was bought.

问题是第二步会发生什么?我应该检查调度员吗?我应该为意图内的所有步骤添加所有可能的短语吗?

The questions are what happens on the second step? Should I check out dispatcher? Should I add all possible phrases for all steps inside the intent?

推荐答案

LUIS常规内容

对于您的LUIS模型,您将需要您的意图-BookFlightNone.在BookFlight意图下,您将拥有Utterances-您希望能够触发BookFlight意图的所有短语.

For your LUIS model you will need your intents - BookFlight and None. Under your BookFlight intent you will have your Utterances - all the phrases you want to be able to trigger the BookFlight intent.

MyLuisApp
--BookFlight
----I want to book a flight
----Book a flight
----I need a plane ticket
----etc
--None
----Utterances that don't match any of your intents

按照此文档.

将此功能添加到新的漫游器或核心漫游器模板

提供了几个有关如何实现此目标的示例,但是最好的方法是使用对话框.您想要的是

There are a couple different samples provided on how you could achieve this, but the best way is using Dialogs. What you want is a Waterfall Dialog. Inside this Dialog you can define each stage in the waterfall e.g. Ask for destination, ask for date etc.

为了触发BookFlight瀑布,您需要一个MainDialog来处理每个请求,并与LUIS调度程序进行检查

In order to trigger the BookFlight waterfall you would have a MainDialog that handled every request, and checks with the LUIS dispatcher link1 and link2 to find out the users intent as per this example. If the intent is BookFlight then you would start the BookFlightDialog which contains the book flight waterfall.

...
// Check dispatch result
var dispatchResult = await cognitiveModels.DispatchService.RecognizeAsync<DispatchLuis>(dc.Context, CancellationToken.None);
var intent = dispatchResult.TopIntent().intent;

if (intent == "BookFlight")
{
    // Start BookFlightDialog
    await dc.BeginDialogAsync(nameof(BookFlightDialog));
}


常规瀑布对话框的内容

您将步骤定义为:

var waterfallSteps = new WaterfallStep[]
{
    AskDestinationAsync,
    AskDepartureDateAsync,
    ConfirmStepAsync,
    FinishDialogAsync,
};

对于您的方案,实际上已经使用BookFlight意图创建了一个示例,官方文档.因此,您可以进行测试以查看一切工作原理,然后根据需要对其进行修改.

For your scenario there is actually a sample that has already been created with the BookFlight intent available here. There is a full guide on how to get this setup and working in the official documentation. So you can test to see how everything works then modify it as you need.

其他有趣的链接:

  • Custom prompt sample - roll your own.
  • Multi-turn sample - waterfall dialog.

虚拟助手的东西

一旦了解了上述工作原理,您将可以通过执行以下操作来修改Virtual Assistant模板以处理BookFlight意图:

Once you understand how the above works you will be able to modify the Virtual Assistant template to handle the BookFlight intent by taking the following actions:

  • 向连接到VA模板的现有LUIS DISPATCH 应用添加BookFlight意图.
  • 为BookFlight意图添加语音.
  • 保存并培训您的LUIS应用.
  • 发布您的LUIS应用.
  • 按照说明运行PowerShell Core 并从项目目录的根目录开始,即在Virtual Assistant文件夹中.
查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆