You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/cognitive-services/QnAMaker/How-To/integrate-with-power-virtual-assistant-fallback-topic.md
+52-40Lines changed: 52 additions & 40 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,9 +5,9 @@ ms.topic: conceptual
5
5
ms.date: 03/09/2020
6
6
---
7
7
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
9
9
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.
11
11
12
12
## Use QnA Maker knowledge base with a Power Virtual Agent
13
13
@@ -17,25 +17,30 @@ QnA Maker is a cloud-based API service that lets you create a conversational que
17
17
18
18
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.
19
19
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.
21
21
22
22
## Power Automate connects to GenerateAnswer action
23
23
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.
25
25
26
26
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.
27
27
28
28
## Process steps to connect an agent to your knowledge base
29
+
29
30
Steps to use a Power Virtual agent with QnA Maker:
30
-
* In QnA Maker portal
31
+
* In [QnA Maker](https://www.qnamaker.ai/) portal
31
32
* 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
34
35
* Build agent topic
35
36
* 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
@@ -46,36 +51,34 @@ Steps to use a Power Virtual agent with QnA Maker:
46
51
47
52
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.
48
53
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.
50
55
51
56
## Create Power Virtual Agent's System fallback topic
52
57
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.
56
59
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**.
58
61
59
62

60
63
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.
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.
66
69
67
70
> [!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.
69
72
70
73
## Use authoring canvas to add an action
71
74
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.
73
76
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`.
75
78
76
79

77
80
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**.
79
82
80
83

81
84
@@ -85,15 +88,21 @@ Use the Power Virtual agent's authoring canvas to connect the fallback topic to
85
88
86
89
## Create Power Automate Flow to connect to your knowledge base
87
90
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.
89
98
90
99

91
100
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.
93
102
94
103

95
104
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**.
97
106
98
107
1. Search for `Qna` to find the **QnA Maker** actions, then select **Generate answer**.
99
108
@@ -103,35 +112,33 @@ Use the Power Virtual agent's authoring canvas to connect the fallback topic to
103
112
104
113

105
114
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.
109
116
110
117
 portal.](../media/how-to-integrate-power-virtual-agent/published-knowledge-base-settings.png)
111
118
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.
113
120
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**.
115
122
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.
117
124
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**.
119
126
120
127

121
128
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**.
123
130
124
131
1. To set the knowledge base answer to the variable, search for and select the`Apply to each` action.
125
132
126
133
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.
127
134
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.
129
136
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.
131
138
132
139

133
140
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.
135
142
136
143

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

149
156
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.
151
158
152
159
1. In the solution, select **+ Add existing**, then select **Flow** from the list.
153
160
154
161
1. Select the **Outside solutions** tab, then select the flow you just created. Select **Add** to finish the process.
155
162
156
-

163
+

157
164
158
165
## Add solution's flow to Power Virtual Agent
159
166
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.
161
168
162
169
1. Select the **+** connector under the **Trigger Phrases** action box to insert a new step in the flow, then select **Call an action**.
163
170
@@ -181,10 +188,15 @@ The final canvas is shown below.
181
188
182
189
## Test Power Virtual Agent
183
190
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.
185
192
186
193
[](../media/how-to-integrate-power-virtual-agent/power-virtual-agent-test.png#lightbox)
187
194
188
195
## Next step
189
196
190
-
[Get analytics on your knowledge base](get-analytics-knowledge-base.md)
197
+
[Get analytics on your knowledge base](get-analytics-knowledge-base.md)
*[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