在 QnA Maker 中检索与搜索关键字匹配的多个问题

Retrieve multiple questions matching the search keyword in QnA Maker

我有一个使用 LUIS 和 QnA Maker 的机器人。

现在,我可以根据搜索关键字在我的 bot 中发送查询并获得回复。但如果我的搜索关键字用于多个问题,QnA Maker 只会检索第一个匹配的 QnA 对。

考虑以下 QnA 对:

What is flexible working?   Flexibility to work from home
How to avail flexible working?  Get in touch with manager

如果用户键入确切的问题并按回车键,则响应将是与问题匹配的答案。但是,如果用户在这种情况下键入 flexible working,则响应将只是第一个 QnA 答案。因此,在这种情况下,我想检索这两个问题并将其作为可供选择的问题选项返回给用户。

我尝试覆盖 RespondFromQnAMakerResultAsync 并检查了 QnA maker APIs。不幸的是我没有找到任何方法来做到这一点。

请问有什么帮助吗?让我知道我是否可以对此进行重新措辞或澄清。

in case my search keyword is used in multiple questions, the QnA maker just retrieves the first matching QnA pair

您可以尝试为QnAMakerAttribute指定top参数,它控制return的答案数。

QnAMakerAttribute的定义:

public QnAMakerAttribute(string subscriptionKey, string knowledgebaseId, string defaultMessage = null, double scoreThreshold = 0.3, int top = 1);

在你的QnaDialog中,你可以这样指定它:

public QnaDialog() : base(new QnAMakerService(new QnAMakerAttribute("{subscriptionKey_here}", "{knowledgebaseId_here}", "Sorry, I couldn't find an answer for that", 0.5, 5)))
{
}

编辑:

以上方法对我有用,它可以推广问题并显示所选问题的答案。