【问题标题】:How do you identify questions that the bot could not answer您如何识别机器人无法回答的问题
【发布时间】:2020-05-20 00:55:38
【问题描述】:

我的组织开始尝试使用 Microsoft 机器人框架。我们的企业架构师提出的问题之一如下:

我们如何识别机器人无法回答的问题?

我已经检查了文档,但我仍然不清楚。谁能详细说明他们用来识别未回答问题的技术?我们认为这很重要,因为它确定了进一步增长的机会。

【问题讨论】:

    标签: botframework azure-language-understanding qnamaker


    【解决方案1】:

    您可以使用多种技术来实现这一点。本质上,您要做的是存储 Bot 无法提供分析答案的任何问题。

    您可以通过使用 QnAMaker 中的评分机制来做到这一点。例如,如果 QnAMaker 返回零分,则不存在答案,因此我们需要将该问题写回存储进行分析。

    您可以在 Azure 堆栈中为此使用多种存储解决方案,例如 Application Insights、Cosmos、Blob、SharePoint 列表等。

    在下面的示例中(为简洁起见,代码被修剪),我使用 Application Insights 来存储此信息。我已经导入了 botbuilder-applicationinsights 包,并创建了一个简单的自定义事件来捕获对 QnAMaker 得分为零的任何响应。

    const {
        ApplicationInsightsTelemetryClient,
        ApplicationInsightsWebserverMiddleware
    } = require('botbuilder-applicationinsights');
    
    const {
        MessageFactory,
        CardFactory
    } = require('botbuilder');
    
    const {
        QnAServiceHelper
    } = require('../helpers/qnAServiceHelper');
    
    const {
        CardHelper
    } = require('../helpers/cardHelper');
    
    const {
        FunctionDialogBase
    } = require('./functionDialogBase');
    
    // Setup Application Insights
    settings = require('../settings').settings;
    const appInsightsClient = new ApplicationInsightsTelemetryClient(settings.instrumentationKey);
    
    class QnADialog extends FunctionDialogBase {
    
        constructor() {
            super('qnaDialog');
        }
    
        async processAsync(oldState, activity) {
    
            var newState = null;
            var query = activity.text;
            var qnaResult = await QnAServiceHelper.queryQnAService(query, oldState);
            var qnaAnswer = qnaResult[0].answer;
            var qnaNonResponse = qnaResult[0].score;
    
            var prompts = null;
            if (qnaResult[0].context != null) {
                prompts = qnaResult[0].context.prompts;
            }
    
            var outputActivity = null;
            if (prompts == null || prompts.length < 1) {
                outputActivity = MessageFactory.text(qnaAnswer);
    
            } else {
                var newState = {
                    PreviousQnaId: qnaResult[0].id,
                    PreviousUserQuery: query
                }
    
                outputActivity = CardHelper.GetHeroCard(qnaAnswer, prompts);
            }
    
            if (qnaNonResponse === 0) {
    
                    const {
                        NonResponseCard
                    } = require('../dialogs/non-response');
                    const quicknonresponseCard = CardFactory.adaptiveCard(NonResponseCard);
                    outputActivity = ({
                        attachments: [quicknonresponseCard]
                    });
                    console.log("Cannot find QnA response for" + " " + query);
                    appInsightsClient.trackEvent({
                        name: "Non-response",
                        properties: {
                            question: query
                        }
                    });
                }
            return ([newState, outputActivity, null]);
        }
    }
    
    module.exports.QnADialog = QnADialog;
    

    然后我可以连接我可能在 Power Bi 中的 Application Insights 中使用的查询,以显示那些未回答的问题。

    有多种方法可以实现这一点,但这是我最终选择的一种。

    【讨论】:

      【解决方案2】:

      根据您的模型的大小和复杂性,您将希望使用 LUIS 或 qnamaker。如果你妈妈很简单,qnamaker 就可以了。对于一些更复杂的东西,特别是如果你想使用实体 LUIS 绝对是要走的路。他们每个人都有自己的技术,@steviebleeds 描述了如何在 qnamaker 上做到这一点。对于 Louis,您将查看您的置信度阈值,并且您应该记录低于您设置的置信度阈值的值。每次你从刘易斯那里得到一个预测时,它都会向你发送一个意图列表,每个人都有一个对预测的置信度百分比。您应该评估这个置信度百分比,并根据您的新持有量来决定是否要回答您的用户。您还想查看所有没有返回意图的问题。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-04-03
        • 2012-08-06
        • 2021-10-20
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多