Skip to content

Commit 7597f7f

Browse files
committed
edits
1 parent 15f6363 commit 7597f7f

File tree

1 file changed

+52
-40
lines changed

1 file changed

+52
-40
lines changed

articles/cognitive-services/QnAMaker/How-To/integrate-with-power-virtual-assistant-fallback-topic.md

Lines changed: 52 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ ms.topic: conceptual
55
ms.date: 03/09/2020
66
---
77

8-
# How to add a QnA Maker knowledge base to Power Virtual Agent as the fallback action
8+
# How to add a QnA Maker knowledge base to Power Virtual Agent
99

10-
Extend your [Power Virtual Agent](https://powervirtualagents.microsoft.com/) bot to provide the bot's fallback answer from your knowledge base. Use Power Automate to send the user's question to your knowledge base, and receive the knowledge base answer. Configure your bot's fallback action as part of your conversation flow from within the Power portal.
10+
Extend your [Power Virtual Agent](https://powervirtualagents.microsoft.com/) bot to provide answers from your knowledge base. You can configure your bot topic _conversation path_ to send the user's text, as the _trigger phrase_, to your knowledge base, then return the answer to your user shown in a message.
1111

1212
## Use QnA Maker knowledge base with a Power Virtual Agent
1313

@@ -17,25 +17,30 @@ QnA Maker is a cloud-based API service that lets you create a conversational que
1717

1818
A Power Virtual Agent is created with a series of topics (subject areas), in order to answer user questions by performing actions. If an answer can't be found, a system fallback can return an answer.
1919

20-
You can send the question to your knowledge base as part of a topic's action or as the fallback action. They both use the same mechanism (action) to connect to your knowledge base and return an answer.
20+
You can send the question to your knowledge base as part of a topic's action or as part of the System Fallback topic path. They both use the same mechanism of an action to connect to your knowledge base and return an answer.
2121

2222
## Power Automate connects to GenerateAnswer action
2323

24-
To connect your agent to your knowledge base, use Power Automate. Power Automate provides a process **flow, which connects to QnA Maker's GenerateAnswer API.
24+
To connect your agent to your knowledge base, use Power Automate to create the action. Power Automate provides a process **flow**, which connects to QnA Maker's GenerateAnswer API.
2525

2626
Once the **flow** is designed and saved, it is available from a Power Automate **Solution**. Once the GenerateAnswer flow is added to a solution, use that solution as an action in your agent.
2727

2828
## Process steps to connect an agent to your knowledge base
29+
2930
Steps to use a Power Virtual agent with QnA Maker:
30-
* In QnA Maker portal
31+
* In [QnA Maker](https://www.qnamaker.ai/) portal
3132
* Build and publish knowledge base
32-
* Copy knowledge base details
33-
* In Power Virtual Agent
33+
* Copy knowledge base details including knowledge base ID, runtime endpoint key, and runtime endpoint host.
34+
* In [Power Virtual Agent](https://powerva.microsoft.com/) portal
3435
* Build agent topic
3536
* Call an action (to Power Automate Flow)
36-
* In Power Automate
37-
* Build a flow with connector to QnA
38-
Maker's GenerateAnswer
37+
* In [Power Automate](https://us.flow.microsoft.com/) portal
38+
* Build a flow with connector to [QnA
39+
Maker's GenerateAnswer](https://docs.microsoft.com/connectors/cognitiveservicesqnamaker/)
40+
* QnA Maker published knowledge base information
41+
* Knowledge base ID
42+
* QnA Maker resource endpoint host
43+
* QnA Maker resource endpoint key
3944
* Input - user query
4045
* Output - knowledge base answer
4146
* Create solution and add flow
@@ -46,36 +51,34 @@ Steps to use a Power Virtual agent with QnA Maker:
4651

4752
Before you build your agent, create and publish your knowledge base. Next, find the endpoint key, endpoint host, and knowledge base ID on the **Settings** page in the QnA Maker portal.
4853

49-
You will need this information for the Power Automate step to configure your QnA Maker GenerateAnswer connection.
54+
You will need this information for the [Power Automate step](#create-power-automate-flow-to-connect-to-your-knowledge-base) to configure your QnA Maker GenerateAnswer connection.
5055

5156
## Create Power Virtual Agent's System fallback topic
5257

53-
The first step is to configure an agent topic. While it can be any topic, this procedure uses the System **fallback** topic. If the agent can't find an answer, it should pass the answer to QnA Maker's GenerateAnswer API.
54-
55-
1. In the [Power Virtual Agents](https://powerva.microsoft.com/#/) portal, on the top-right corner of the navigation, select the **Settings** page. The icon for this page is the gear.
58+
The first step is to configure an agent topic. While it can be any topic, this procedure uses the System **Fallback** topic. If the agent can't find an answer, it should pass the answer to QnA Maker's GenerateAnswer API.
5659

57-
1. Select **System Fallback**.
60+
1. In the [Power Virtual Agents](https://powerva.microsoft.com/#/) portal, on the top-right corner of the navigation, select the **Settings** page. The icon for this page is the gear. Select **System Fallback**.
5861

5962
![Power Virtual agent menu item for System Fallback](../media/how-to-integrate-power-virtual-agent/power-virtual-agent-settings-system-fallback.png)
6063

61-
1. On the pop-up **Settings** window, select **+ Add** to add a System fallback topic to your default list of topics.
64+
1. On the pop-up **Settings** window, select **+ Add** to add a System Fallback topic.
6265

6366
![On Settings window, add fallback topic.](../media/how-to-integrate-power-virtual-agent/power-virtual-agent-settings-add-fallback-topic.png)
6467

65-
1. After the topic is added, select the button **Go to fallback topic** to author the fallback topic on the authoring canvas.
68+
1. After the topic is added, select **Go to Fallback topic** to author the Fallback topic on the authoring canvas.
6669

6770
> [!TIP]
68-
> If you need to return to the fallback topic, the fallback topic is under **Topics** section, as part of the **System** topics.
71+
> If you need to return to the Fallback topic, it is available in the **Topics** section, as part of the **System** topics.
6972
7073
## Use authoring canvas to add an action
7174

72-
Use the Power Virtual agent's authoring canvas to connect the fallback topic to your knowledge base. The topic starts with the **unrecognized user text**. You need to add an action that passes that text to QnA Maker, then displays the answer as a message. The last step of displaying an answer is handled as a separate step later.
75+
Use the Power Virtual Agent's authoring canvas to connect the Fallback topic to your knowledge base. The topic starts with the **unrecognized user text**. You need to add an action that passes that text to QnA Maker, then shows the answer as a message. The last step of displaying an answer is handled as a separate step later.
7376

74-
1. The new fallback action may already have a flow designed. Delete all items in the flow except for the first item, **Trigger Phrases**, with the `Unrecognized user input`.
77+
1. The new Fallback action may already have conversation flow elements. Delete all items in the flow except for the first item, **Trigger Phrases**, with the `Unrecognized user input`.
7578

7679
![Start fallback action with trigger phrases](../media/how-to-integrate-power-virtual-agent/fallback-action-start-trigger-phrases.png)
7780

78-
1. Select the **+** connector under the **Trigger Phrases** box, then select **Call an action**.
81+
1. Select the **+** connector flowing from the **Trigger Phrases** box, then select **Call an action**.
7982

8083
![Call an action](../media/how-to-integrate-power-virtual-agent/create-new-item-call-an-action.png)
8184

@@ -85,15 +88,21 @@ Use the Power Virtual agent's authoring canvas to connect the fallback topic to
8588

8689
## Create Power Automate Flow to connect to your knowledge base
8790

88-
1. In **Power Automate**, the **Flow Template** is started. On the **Power Virtual agents** item, select **Edit** to configure the input variable coming from your agent to your knowledge base. The text-based input variable is the user-submitted text question from your agent.
91+
The following procedure creates an action that:
92+
* takes the incoming user text
93+
* sends it to QnA Maker
94+
* assigns the QnA Maker response to a variable
95+
* sends only the top answer as the response back to your agent
96+
97+
1. In **Power Automate**, the **Flow Template** is started. On the **Power Virtual Agents** item, select **Edit** to configure the input variable coming from your agent to your knowledge base. The text-based input variable is the user-submitted text question from your agent.
8998

9099
![Configure your input variable as a text string](../media/how-to-integrate-power-virtual-agent/power-automate-configure-input-variable.png)
91100

92-
1. Add a text input and name the variable `InputText` with a description of `IncomingUserQuestion`.
101+
1. Add a text input and name the variable `InputText` with a description of `IncomingUserQuestion`. This naming helps distinguish the input text from the output text you create later.
93102

94103
![Add a text input and name the variable `InputText` with a description of `UserQuestion`](../media/how-to-integrate-power-virtual-agent/power-automate-configure-input-variable-name-and-description.png)
95104

96-
1. Select the **+** connector under the **Power Virtual Agents** box, to insert a new step in the flow (before the **Return value(s) to Power Virtual Agent**), then select **Add an action**.
105+
1. Select the **+** connector flowing from the **Power Virtual Agents** box, to insert a new step in the flow (before the **Return value(s) to Power Virtual Agent**), then select **Add an action**.
97106

98107
1. Search for `Qna` to find the **QnA Maker** actions, then select **Generate answer**.
99108

@@ -103,35 +112,33 @@ Use the Power Virtual agent's authoring canvas to connect the fallback topic to
103112

104113
![The connections settings for QnA Maker appear in the action.](../media/how-to-integrate-power-virtual-agent/generate-answer-knowledge-base-settings.png)
105114

106-
1. Configures the action to take the InputText, and pass it to the GenerateAnswer API.
107-
108-
Enter your published knowledge base settings found on the **Settings** page in the [QnA Maker](https://www.qnamaker.ai/) portal.
115+
1. Configure the action with your knowledge base ID, endpoint host and endpoint key. These are found on the **Settings** page of your knowledge base, in the QnA Maker portal.
109116

110117
![Enter your published knowledge base settings found on the **Settings** page in the [QnA Maker](https://www.qnamaker.ai/) portal.](../media/how-to-integrate-power-virtual-agent/published-knowledge-base-settings.png)
111118

112-
Select the **Question** text area. This displays a list of choices. Select `InputText`.
119+
1. To configure the **Question**, select the text box, then select the `InputText` from the list.
113120

114-
1. Select the **+** connector under the **Generate answer** action box to insert a new step in the flow, then select **Add an action**.
121+
1. Select the **+** connector flowing from the **Generate answer** action box to insert a new step in the flow, then select **Add an action**.
115122

116-
1. To add a variable to capture the answer text returned from GenerateAnswer, search for and select the`Initialize variable` action.
123+
1. To add a variable to capture the answer text returned from GenerateAnswer, search for and select the `Initialize variable` action.
117124

118-
Set the name of the variable to `OutgoingQnAAnswer`, and select the type as **String**.
125+
Set the name of the variable to `OutgoingQnAAnswer`, and select the type as **String**. Don't set the **Value**.
119126

120127
![Set the name of the variable to `QnAAnswer`, and select the type as **String**](../media/how-to-integrate-power-virtual-agent/initialize-output-variable-for-qna-answer.png)
121128

122-
1. Select the **+** connector under the **Initialize variable** action box to insert a new step in the flow, then select **Add an action**.
129+
1. Select the **+** connector flowing from the **Initialize variable** action box to insert a new step in the flow, then select **Add an action**.
123130

124131
1. To set the knowledge base answer to the variable, search for and select the`Apply to each` action.
125132

126133
Select the GenerateAnswer `answers`, which is the entire JSON from the GenerateAnswer API call. In the same **Apply to each** box, select **Add an action**. This subsequent action gets only the top answer and sets that to the variable.
127134

128-
1. In the **Set variable** box, select the text box for name, then select **OutgoingQnAAnswer** from the list.
135+
1. In the **Set variable** box, select the text box for **Name**, then select **OutgoingQnAAnswer** from the list.
129136

130-
Select the text box for value, then select **Answers Answer** from the list.
137+
Select the text box for **Value**, then select **Answers Answer** from the list.
131138

132139
![Set the name and value for the variable ](../media/how-to-integrate-power-virtual-agent/power-automate-flow-apply-to-each-set-variable.png)
133140

134-
1. To return the variable (and its value), select the **Return value(s) to Power Virtual Agent** then select **Add an output**. Select a **Text** output type then select a **Title** you will see in the Power Virtual Agent, such as `FinalAnswer`. Select the text box for the value, then select the `OutgoingQnAAnswer` variable.
141+
1. To return the variable (and its value), select the **Return value(s) to Power Virtual Agent** then select **Add an output**. Select a **Text** output type then enter the **Title** of `FinalAnswer`. Select the text box for the **Value**, then select the `OutgoingQnAAnswer` variable.
135142

136143
![Set the return value](../media/how-to-integrate-power-virtual-agent/power-automate-flow-return-value.png)
137144

@@ -147,17 +154,17 @@ In order for the Power Virtual Agent to find and connect to the flow, the flow m
147154

148155
![Create new solution](../media/how-to-integrate-power-virtual-agent/power-automate-create-new-solution.png)
149156

150-
1. In the list of solutions, select the solution you just created.
157+
1. In the list of solutions, select the solution you just created. It should be at the top of the list.
151158

152159
1. In the solution, select **+ Add existing**, then select **Flow** from the list.
153160

154161
1. Select the **Outside solutions** tab, then select the flow you just created. Select **Add** to finish the process.
155162

156-
![Add flow to solution](../media/how-to-integrate-power-virtual-agent/power-automate-add-flow-to-solution.png)
163+
![Add flow to solution](../media/how-to-integrate-power-virtual-agent/power-automate-add-flow-to-solution.png)
157164

158165
## Add solution's flow to Power Virtual Agent
159166

160-
1. Return to the browser tab with your Power Virtual agent. The authoring canvas should still be open.
167+
1. Return to the browser tab with your Power Virtual Agent. The authoring canvas should still be open.
161168

162169
1. Select the **+** connector under the **Trigger Phrases** action box to insert a new step in the flow, then select **Call an action**.
163170

@@ -181,10 +188,15 @@ The final canvas is shown below.
181188

182189
## Test Power Virtual Agent
183190

184-
Test the agent by typing in a question that your knowledge base can answer. The authoring canvas reports the successful steps with a green checkmark.
191+
Test the agent by typing in a question that your knowledge base can answer. The authoring canvas reports the successful steps with a green check mark.
185192

186193
[![Test you Power Virtual Agent with a query meant for your knowledge base.](../media/how-to-integrate-power-virtual-agent/power-virtual-agent-test.png)](../media/how-to-integrate-power-virtual-agent/power-virtual-agent-test.png#lightbox)
187194

188195
## Next step
189196

190-
[Get analytics on your knowledge base](get-analytics-knowledge-base.md)
197+
[Get analytics on your knowledge base](get-analytics-knowledge-base.md)
198+
199+
Learn more about:
200+
* [Power Virtual Agents](https://docs.microsoft.com/power-virtual-agents/)
201+
* [Power Automate](https://docs.microsoft.com/power-automate/)
202+
* [QnA Maker connector](https://us.flow.microsoft.com/connectors/shared_cognitiveservicesqnamaker/qna-maker/) and the [settings for the connector](https://docs.microsoft.com/connectors/cognitiveservicesqnamaker/)

0 commit comments

Comments
 (0)