首页 > 解决方案 > 有没有办法将 QnA 问题转换为 LUIS 意图表达

问题描述

我遵循此 Microsoft 文档来实现使用 LUIS 将用户问题路由到 QnAMaker 的 Bot:https://docs.microsoft.com/en-us/azure/bot-service/bot-builder-tutorial-dispatch?视图=azure-bot-service-4.0&tabs=cs

基本上我在 V3 文档中注意到(https://docs.microsoft.com/en-us/azure/cognitive-services/qnamaker/tutorials/integrate-qnamaker-luis)(因为在 V4 中没有提到它)它说:

为每个 QnA Maker 知识库添加一个意图。示例话语应与 QnA Maker 知识库中的问题相对应。

我的问题是,除了手动将 QnA Maker 中的所有问题复制到每个 Intent(假设我有多个 KB)之外,还有更简单的方法吗?例如从 QnA Maker 或类似的东西导出文件?

标签: azurebotframeworkazure-language-understandingazure-bot-serviceqnamaker

解决方案


这是使用Dispatch工具完成的。本质上,它的作用是从您的 QnA Maker KB 下载问题并创建一个名称中带有“dispatch”的新 LUIS 应用程序。在这个新应用程序中,将为您的每个 QnA Maker KB 添加一个意图,命名为q_<kb_name_here>,来自相关 KB 的问题将作为话语添加到此意图中。

如何执行此操作在您链接的文档的创建调度模型部分下进行了概述。

您需要安装随附的NodeJSnpm ,以便从文件夹中的命令行执行以下操作CognitiveModels(粗略指南):

// install botdispatch package
npm i -g botdispatch

// initialise a dispatch file
dispatch init -n <filename-to-create> --luisAuthoringKey "<your-luis-authoring-key>" --luisAuthoringRegion <your-region>

// add references to luis and qna apps
dispatch add -t luis -i "<app-id-for-weather-app>" -n "<name-of-weather-app>" -v <app-version-number> -k "<your-luis-authoring-key>" --intentName l_Weather
dispatch add -t luis -i "<app-id-for-home-automation-app>" -n "<name-of-home-automation-app>" -v <app-version-number> -k "<your-luis-authoring-key>" --intentName l_HomeAutomation
dispatch add -t qna -i "<knowledge-base-id>" -n "<knowledge-base-name>" -k "<azure-qna-service-key1>" --intentName q_sample-qna

// generate a dispatch model
dispatch create

然后,您必须在 LUIS 门户中找到您的新应用并发布它,然后才能使用它。然后按照使用调度模型利用 LUIS 进行路由下的步骤进行操作。


推荐阅读