Microsoft QnA maker 是否使用 LUIS?

Does Microsoft QnA maker use LUIS?

我打算使用 QnA maker,但它在后台使用 LUIS 吗? 如果以与 QnA maker 训练的方式不同的方式提出问题,它会回应吗?

does it use LUIS in the background ?

不,但你可以Combining Search, QnA Maker, and/or LUIS

根据文档,建议通过以下三种方式与LUIS一起实现QnA。

  1. Call both QnA Maker and LUIS at the same time, and respond to the user by using information from the first one that returns a score of a specific threshold.

  2. Call LUIS first, and if no intent meets a specific threshold score, i.e., "None" intent is triggered, then call QnA Maker. Alternatively, create a LUIS intent for QnA Maker, feeding your LUIS model with example QnA questions that map to "QnAIntent."

  3. Call QnA Maker first, and if no answer meets a specific threshold score, then call LUIS.

这里我 post 一个用 C# 编写的第三种方法的代码示例。

MessagesController中先调用QnA Maker:

if (activity.Type == ActivityTypes.Message)
{
    await Conversation.SendAsync(activity, () => new Dialogs.MyQnADialog());
}

MyQnADialog中,查看是否有匹配的答案,如果没有,调用LUIS:

[QnAMakerAttribute("QnASubscriptionKey", "QnAKnowledgebaseId", "No Answer in Knowledgebase, seraching in Luis...", 0.5)]
[Serializable]
public class MyQnADialog : QnAMakerDialog
{

    protected override async Task DefaultWaitNextMessageAsync(IDialogContext context, IMessageActivity message, QnAMakerResults result)
    {
        if (result.Answers.Count == 0)
        {
            await context.Forward(new MyLuisDialog(), this.ResumeAfterNewOrderDialog, message, CancellationToken.None);
        }
        context.Wait(this.MessageReceivedAsync);
        //return base.DefaultWaitNextMessageAsync(context, message, result);
    }
    private async Task ResumeAfterNewOrderDialog(IDialogContext context, IAwaitable<object> result)
    {
        var resultfromnewdialog = await result;
        context.Wait(this.MessageReceivedAsync);
    }

}

QnA 不使用 LUIS 或意图识别,而是使用 n-gram 来检测相似性,如文档中所述。

从 MS Build 2018 开始,您可以使用 LUIS 调度应用程序。它允许您将多个 LUIS 应用程序和 QnA 知识库合并到一个调度应用程序中。这意味着将用户输入发送到 LUIS 和 QnA,或者根据置信度分数以特定顺序发送用户输入应该成为过去。

您的第一个电话是针对 LUIS 调度应用程序的。结果将告诉您是否需要联系子 luis 应用程序,或者更确切地说是 QnA 知识库。它之所以能够做到这一点,是因为 LUIS 调度应用的话语中充满了来自 QnA 知识库的话语。您可以将多个 LUIS 应用 and/or QnA 知识库添加到此调度。

我建议查看 Bot Builder 调度工具 (CLI)。