闲聊机器人_讲个笑话,如何为您的虚拟客服人员聊天机器人增加闲聊支持

闲聊机器人

微软电源平台解决方案 (SOLUTIONS FOR MICROSOFT POWER PLATFORM)

Whatever your Chatbot is designed for, and no matter how clear or simple its purpose is, your users will always try to chit-chat first.

无论您的Chatbot是为什么目的而设计的,无论其目的是多么清晰或简单,您的用户都将始终首先尝试聊天。

Knowing this, it becomes essential that even your simplest Chatbot has decent small talk skills. But this could be a challenge — especially when you work with low-code products like Power Virtual Agents (Power VA) as such products might not have a good Small Talk feature out of the box.

知道这一点,即使您最简单的聊天机器人也要具备体面的闲聊技巧,这一点至关重要。 但这可能是一个挑战-尤其是在使用低代码产品(如Power Virtual Agents(Power VA))时,因为此类产品可能没有现成的良好的Small Talk功能。

In this guide, I’ll show you how to add a small talk capability to any Power VA Chatbot using QnA Maker as part of the Azure Cognitive Services Suite and combine both products with the help of Power Automate.

在本指南中,我将向您展示如何使用QnA Maker作为Azure认知服务套件的一部分,向任何Power VA Chatbot添加小型通话功能,以及如何在Power Automate的帮助下将这两种产品组合在一起。

If you’re new to Power VA, I got you covered with a simple step-by-step introduction here on Medium.

如果你是新的电源VA,我给你盖上一个简单的一步一步地介绍了这里的媒介。

Let’s get started.

让我们开始吧。

创建QnA Maker闲聊知识库 (Create a QnA Maker Small Talk KB)

With the help of Microsoft’s QnA Maker, we can create a knowledge base for our Chatbot with a prepopulated dataset for ~100 chit-chat scenarios, which include responses and sample queries. We can choose between 5 different personalities and 9 languages. You can learn more about it on GitHub.

借助Microsoft的QnA Maker ,我们可以为聊天机器人创建知识库,其中包含针对100个聊天场景的预填充数据集,其中包括响应和示例查询。 我们可以选择5种不同的个性和9种语言。 您可以在GitHub上了解更多有关它的信息。

To create our Small Talk knowledge base, go to https://www.qnamaker.ai/, sign in, and click Create a knowledge base.

要创建我们的Small Talk知识库,请访问https://www.qnamaker.ai/ ,登录并单击创建知识库

Image for post

Click the Create a QnA service button to get redirected to the Azure Portal to create your own QnA Maker instance.

单击创建QnA服务按钮以重定向到Azure门户以创建自己的QnA Maker实例。

Image for post

In the Azure Portal, you have to name a couple of resources. Choose the appropriate name and location for every service that is created.

在Azure门户中,您必须命名几个资源。 为创建的每个服务选择适当的名称和位置。

If you don’t have an Azure subscription, sign up for an Azure free trial first.

如果您没有Azure订阅,请先注册一个Azure免费试用版

Furthermore, if you’re not an Azure expert, this might be a bit confusing. Don’t worry, and use the same settings as I did. Only replace West Europe with your nearest location and MyBot with the name of your Chatbot. The rest follows some best practices for naming and simple deployment.

此外,如果您不是Azure专家,这可能会造成混淆。 不用担心,并使用与我相同的设置。 仅将西欧替换为您最近的位置,并将MyBot替换为您的聊天机器人的名称。 其余的遵循一些命名和简单部署的最佳实践。

Image for post

Click your way all through the end of the wizard, verify your settings one last time, and hit Create.

在向导末尾单击您的方式,最后一次确认设置,然后点击创建

Image for post

Wait for the Your deployment is completed message and jump back to the QnA Maker Portal in your browser.

等待“ 您的部署已完成”消息,然后跳回到浏览器中的QnA Maker Portal。

Image for post

Back in the QnA Maker portal, click the Refresh button and select the previously created Azure QnA Service instance from the drop-down list. Note that it might require you to refresh (F5) multiple times or wait some more minutes for the instance to show up.

返回QnA Maker门户,单击“ 刷新”按钮,然后从下拉列表中选择以前创建的Azure QnA服务实例。 请注意,它可能需要多次刷新(F5)或等待几分钟才能显示该实例。

Give your QnA Maker knowledge base a speaking name, as I did.

像我一样,给您的QnA Maker知识库起一个说话的名字。

Image for post

Now we can add some Small Talk (aka Chit-Chat) scenarios and choose between the 5 different personalities.

现在,我们可以添加一些Small Talk(又名Chit-Chat)场景,并在5种不同的个性之间进行选择。

When ready, click Create your KB.

准备就绪后,点击创建您的KB

Image for post

When your knowledge base is ready, we can optionally tweak it a little bit. For instance, you could search for ‘Who are you?’ and change its response to include a personalized welcome message from your Chatbot.

准备好您的知识库后,我们可以选择对其进行一些调整。 例如,您可以搜索“ 您是谁?” 并更改其响应以包含来自聊天机器人的个性化欢迎消息。

It’s also possible to add new QnA pairs, like a basic FAQ for your business. Play around with it and hit Save and train when you feel ready.

也可以添加新的QnA对,例如您企业的基本FAQ。 试一试,并在准备就绪时点击保存并训练

Image for post

Now we can go to Publish tab and hit the Publish button.

现在,我们可以转到“ 发布”选项卡,然后单击“ 发布”按钮。

Image for post

After publishing was successful, the portal provides us with the necessary details like the knowledge base id, host, and endpoint key. Keep this page open, as we later need this information.

发布成功后,门户将为我们提供必要的详细信息,例如知识库ID主机端点密钥 。 保持此页面为打开状态,因为稍后我们需要此信息。

Image for post

将Chit Chat添加到您的Power VA Chatbot (Adding Chit Chat to your Power VA Chatbot)

In the Power VA admin portal, open your Chatbot, click the Gear icon, and select System fallback.

在Power VA管理门户中,打开您的Chatbot,单击Gear图标,然后选择System fallback

Image for post

By clicking the Add button, we enable the Fallback system topic. This replaces the default behavior of automatically prompting for information and allows us to hook in our custom logic.

通过单击添加按钮,启用后备系统主题。 这取代了自动提示信息的默认行为,并允许我们挂接到我们的自定义逻辑。

Image for post

After the Fallback system topic was added, click Go to fallback topic to open the designer.

添加后备系统主题后,单击“ 转到后备主题”以打开设计器。

Image for post

First, we remove the default message and the escalate redirect using the three dots on each canvas.

首先,我们使用每个画布上的三个点删除默认消息和逐步重定向。

Image for post

Click the + icon at the end of the connector, choose Call an action and click Create a flow.

点击连接器末端的+图标,选择调用动作 ,然后点击创建流程

Image for post

This fires up the Power Automate admin portal with a trigger and output action for Power VA. We’ll now make a couple of modifications to that flow.

这将通过Power VA的触发和输出操作来启动Power Automate管理门户。 现在,我们将对该流程进行一些修改。

First, we add a new Input for our trigger with a click on +Add an input. Choose a Text input and name it Question.

首先,点击+添加输入,为触发器添加一个新的输入 。 选择一个文本输入并将其命名为Question

Also, we add the Generate answer (preview) action using the + icon.

另外,我们使用+图标添加“ 生成答案(预览)”操作。

Image for post

In the next step, we have to configure the connection to our QnA Maker instance. We need the connection details displayed when you published your knowledge base in QnA Maker before (refer back to the screenshot above).

下一步,我们必须配置与QnA Maker实例的连接。 我们需要您之前在QnA Maker中发布知识库时显示的连接详细信息(请参考上面的屏幕截图)。

Enter a Connection Name as you want — map API Key to the Endpoint Key and Site URL to Host. Verify your settings once more and click Create.

根据需要输入连接名称 -将API密钥映射到端点密钥 ,将站点URL映射到Host 。 再次确认您的设置,然后点击创建

Image for post

In the next step, the Generate answer action asks for the same parameter once again. We also need the Knowledge Base Id, which is just the GUID part from the deployment details in the QnA Maker portal.

在下一步中,“ 生成 答案”操作将再次询问相同的参数。 我们还需要知识库ID ,它只是QnA Maker门户中部署详细信息的GUID部分。

Finally, we map the Question field to the new Question input of our trigger from above.

最后,我们从上方将Question字段映射到触发器的新Question输入。

Image for post

QnA Maker might respond with multiple answers to a single question. This is why we ‘pick’ the best answer from the response with the next two steps.

QnA Maker可能会对单个问题回答多个答案。 这就是为什么我们在接下来的两个步骤中从响应中“挑选”最佳答案。

First, we add an Initialize variable step and create a new object named BestAnswer. We initialize the object with the first answer entry we get from the Generate answer action. For this, we use the following simple expression.

首先,我们添加一个Initialize变量步骤并创建一个名为BestAnswer的新对象。 我们使用从“ 生成答案”操作中获得的第一个答案条目来初始化对象。 为此,我们使用以下简单表达式。

first(outputs('Generate_answer')?['body/answers'])

This expression selects the first answer from above.

该表达式从上方选择第一个答案。

Image for post

Now that we have this answer, we add a Parse JSON action to construct an object from our Best Answer. For this, we use the below JSON schema that you can copy and paste into the action’s schema field.

现在我们有了这个答案,我们添加了一个JSON解析操作,以根据Best Answer来构造一个对象。 为此,我们使用下面的JSON模式,您可以将其复制并粘贴到操作的模式字段中。

Image for post

As the final step in our flow, we add two outputs.

作为流程的最后一步,我们添加两个输出。

First, we add a text output named Answer and map it to the answer property of our best answer.

首先,我们添加一个名为Answer文本输出,并将其映射到我们最佳答案的answer属性。

Second, we add a number output named Score and map it to the score property, respectively. The score is a confidence value, which indicates how sure QnA Maker is about the response. We’ll use this value at a later point.

其次,我们添加一个名为Score数字输出并将其分别映射到score属性。 分数是置信度值,表示QnA Maker对响应的确定程度。 我们稍后将使用此值。

Before you hit save, give your flow a better name.

在点击保存之前,给您的流程起一个更好的名字。

Image for post

Back on the fallback system topic in Power VA, we can now add the new flow and link the UnrecognizedTriggerPhase variable to the flow’s Question input. This way, we simply pass what the user said to our flow.

回到Power VA中的后备系统主题,我们现在可以添加新流并将UnrecognizedTriggerPhase变量链接到流的Question输入。 这样,我们只需将用户所说的内容传递给我们的流程即可。

Image for post

After that, we add a new condition using the + icon at the end of the connector.

之后,我们使用连接器末尾的+图标添加新条件。

We test if the Score variable is greater 0. With this condition, we make sure that we received a proper answer from QnA Maker, which is worth displaying to the user, which we do with a simple message that uses the Answer variable.

我们测试Score变量是否大于0 。 在这种情况下,我们确保从QnA Maker那里收到了正确的答案,值得向用户显示,这是我们使用一条使用Answer变量的简单消息完成的。

For any other case, we respond with a static message that indicates that even our QnA Small Talk database has absolutely no idea what the user said.

对于其他任何情况,我们都会以静态消息进行响应,该消息指示即使我们的QnA Small Talk数据库也完全不知道用户说了什么。

Image for post

Finally, hit the Save button and we’re good to test the small talk skills of our Chatbot. Just drop a bunch of silly questions and see how the Chatbot reacts.

最后,点击“ 保存”按钮,我们很好地测试了聊天机器人的聊天技巧。 只需提出一些愚蠢的问题,然后看看聊天机器人的React如何。

Image for post

That’s it. Our Chatbot behaves very naturally and can answer many of the most common questions. Even an imperfect answer could lead to hilarious and humorous conversations. Your Chatbot will definitively stand your first user interaction, and there is always the chance to improve the results by adding new QnA pairs.

而已。 我们的聊天机器人行为举止非常自然,可以回答许多最常见的问题。 即使是不完美的答案也可能导致幽默和幽默的对话。 您的Chatbot一定会经受住您的首次用户交互,并且始终有机会通过添加新的QnA对来改善结果。

👉,Sebastian

Se,塞巴斯蒂安

翻译自: https://towardsdatascience.com/tell-me-a-joke-how-to-add-small-talk-support-to-your-power-virtual-agents-chatbot-6a0eba974de2

闲聊机器人

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值