单个机器人的多个QnA Maker服务 [英] Multiple QnA Maker services for a single bot

查看:97
本文介绍了单个机器人的多个QnA Maker服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一种能够回答有关不同产品的不同问题的机器人.我正在考虑在QnA Maker中为不同的产品创建多个服务,因此问题和答案不会混淆.例如,与我的个人资料"相关的问题因产品而异,因此我可以使用LUIS处理该情况.

I am developing a bot capable of answering different questions about different products. I was thinking on creating multiple services in QnA Maker for the different products, so the questions and answers don't get mixed. For example, questions related to "my profile" have different answers depending on the product, and I could use LUIS to handle that context.

使用多个QnA服务可以吗?还有其他方法可以解决这个问题吗?

Is that possible with multiple QnA services? Is there any other approach to this issue?

推荐答案

好吧,我让它与2种不同的QnA服务一起运行.我发现的唯一解决方案是调用REST服务,而不使用识别器.

Well, I got it running with 2 different QnA services. The only solution I found was to make a call to the REST service instead of using the recognizer.

以下是手动调用一项服务的代码:

Here is the code to make a manual call to one service:

var fetch = require('node-fetch');
require('dotenv-extended').load({
    path: '../.env'
});

var get_restQnA = function (question, callback){

    qnaurl=`https://westus.api.cognitive.microsoft.com/qnamaker/v2.0/knowledgebases/${process.env.KB_ID}/generateAnswer`;    
    fetch(qnaurl, {
        method: 'POST',
        headers: {
            "Content-Type": "application/json",
            "Ocp-Apim-Subscription-Key": process.env.QNA_KEY
        },
        body: JSON.stringify({
            "question": question,
            "top": 1
        })
    }).then(response => {
        return response.json();
    }).then(data => {
        console.log('Here is the data: ', data);
    }).catch(err => {console.log(err);});
}

module.exports.get_restQnA = get_restQnA;

由于您使用的是唯一的服务ID,因此只需以不同的方式调用LUIS即可调用每个服务.

Since you are using the unique service ID, you just have to call each service in the different intents you have for LUIS.

这篇关于单个机器人的多个QnA Maker服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆