QnA Maker 知识库返回‘No good match found in KB’用于后续提示

QnA Maker Knowledge Base returning ‘No good match found in KB’ for follow-up prompts

我的 QnA 知识库出现问题,当使用我已配置为 return 答案的后续提示时,它正在重新调整“在 KB 中找不到合适的匹配项”。

我设置了 c.200 question/answer 对,它们都有后续提示将每个 question/answer 对链接到其他 question/answer 对。但是,当我在 QnA Maker 中测试知识库时,我得到的答案是“在 KB 中找不到答案”。

下面是一个例子:

我有一对 question/answer 来回答“什么是抑郁症”这个问题,它有五个不同的后续提示 - 患病率、原因、类型、症状和相关问题:

正如您在下图中看到的,患病率跟进提示被配置为使用“抑郁症有多常见”questions/answer 对来回答:

但是,当我使用 QnA Maker 的内置测试聊天机器人对此进行测试时,我得到的答案是“在 KB 中找不到合适的匹配项”:

当我检查结果时,我看到以下内容:

如您所见,没有答案 returned,置信度得分为 'None'。

有没有其他人以前见过这个问题并有解决方案?

Follow-up 当前不支持 QnA Maker 门户之外的开箱即用提示。有一个 C# and NodeJS 实验样本可用,它演示了如何将此功能集成到您的机器人中。

由于您没有指定语言首选项,我会选择 C# 语言,基本上您的 QnA 代码需要从以下内容更新:

var qnaMaker = new QnAMaker(new QnAMakerEndpoint
{
    KnowledgeBaseId = _configuration["QnAKnowledgebaseId"],
    EndpointKey = _configuration["QnAEndpointKey"],
    Host = _configuration["QnAEndpointHostName"]
},
null,
httpClient);

var response = await qnaMaker.GetAnswersAsync(turnContext);

if (response != null && response.Length > 0)
{
    await turnContext.SendActivityAsync(MessageFactory.Text(response[0].Answer), cancellationToken);
}
else
{
    await turnContext.SendActivityAsync(MessageFactory.Text("No QnA Maker answers were found."), cancellationToken);
}

至:

var qnaMaker = new QnAMaker(new QnAMakerEndpoint
{
    KnowledgeBaseId = _configuration["QnAKnowledgebaseId"],
    EndpointKey = _configuration["QnAEndpointKey"],
    Host = _configuration["QnAEndpointHostName"]
},
null,
httpClient);

var response = await qnaMaker.GetAnswersAsync(turnContext);
var qnaAnswer = response[0].Answer;
var prompts = response[0].Context?.Prompts;

if (prompts == null || prompts.Length < 1)
{
    await turnContext.SendActivityAsync(MessageFactory.Text(response[0].Answer), cancellationToken);
}
else
{
    // Set bot state only if prompts are found in QnA result
    newState = new QnABotState
    {
        PreviousQnaId = response[0].Id,
        PreviousUserQuery = query
    };

    outputActivity = CardHelper.GetHeroCard(qnaAnswer, prompts);
}

相关代码在this file中,你可以看到有一些额外的代码涉及通过follow-up提示存储进度,所以插入你的知识库可能更容易示例的详细信息,然后在将其移植到您的机器人中之前先试用一下,看看它是如何工作的。

在 Matt 的帮助下,我们对门户聊天机器人与 QnA 进行了一些测试 API,发现门户聊天机器人存在一个错误,作为 API returns 的答案正如预期的那样。我将通过在 BotFramework 文档页面 here

上发布详细信息作为反馈来跟进