Skip to content

Commit a26d479

Browse files
authored
Merge pull request #97936 from diberry/diberry/1205-qna-extraction
[CogSvcs] QnA Maker - first char capitalized
2 parents 71b9bb3 + 6a536f7 commit a26d479

File tree

1 file changed

+38
-36
lines changed

1 file changed

+38
-36
lines changed

articles/cognitive-services/QnAMaker/How-To/multiturn-conversation.md

Lines changed: 38 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ms.custom: seodec18
99
ms.service: cognitive-services
1010
ms.subservice: qna-maker
1111
ms.topic: conceptual
12-
ms.date: 09/25/2019
12+
ms.date: 12/05/2019
1313
ms.author: diberry
1414
---
1515

@@ -25,15 +25,15 @@ To see how multi-turn works, view the following demonstration video:
2525

2626
Some questions can't be answered in a single turn. When you design your client application (chat bot) conversations, a user might ask a question that needs to be filtered or refined to determine the correct answer. You make this flow through the questions possible by presenting the user with *follow-up prompts*.
2727

28-
When a user asks a question, QnA Maker returns the answer _and_ any follow-up prompts. This response allows you to present the follow-up questions as choices.
28+
When a user asks a question, QnA Maker returns the answer _and_ any follow-up prompts. This response allows you to present the follow-up questions as choices.
2929

3030
## Example multi-turn conversation with chat bot
3131

3232
With multi-turn, a chat bot manages a conversation with a user to determine the final answer, as shown in the following image:
3333

3434
![A multi-turn dialog with prompts that guide a user through a conversation](../media/conversational-context/conversation-in-bot.png)
3535

36-
In the preceding image, a user has started a conversation by entering **My account**. The knowledge base has three linked question-and-answer pairs. To refine the answer, the user selects one of the three choices in the knowledge base. The question (#1), has three follow-up prompts, which are presented in the chat bot as three options (#2).
36+
In the preceding image, a user has started a conversation by entering **My account**. The knowledge base has three linked question-and-answer pairs. To refine the answer, the user selects one of the three choices in the knowledge base. The question (#1), has three follow-up prompts, which are presented in the chat bot as three options (#2).
3737

3838
When the user selects an option (#3), the next list of refining options (#4) is presented. This sequence continues (#5) until the user determines the correct, final answer (#6).
3939

@@ -44,32 +44,34 @@ After publishing your KB, you can select the **Create Bot** button to deploy you
4444

4545
## Create a multi-turn conversation from a document's structure
4646

47-
When you create a knowledge base, the **Populate your KB** section displays an **Enable multi-turn extraction from URLs, .pdf or .docx files** check box.
47+
When you create a knowledge base, the **Populate your KB** section displays an **Enable multi-turn extraction from URLs, .pdf or .docx files** check box.
4848

4949
![Check box for enabling multi-turn extraction](../media/conversational-context/enable-multi-turn.png)
5050

51-
When you select this option, QnA Maker extracts the hierarchy present in the document structure. The hierarchy is converted in to follow up prompts and the root of the hierarchy serves as the parent QnA. In some documents the root of the hierarchy does not have content which could serve as an answer, you can provide the 'Default Answer Text' to be used as a substitute answer text to extract such hierarchies.
51+
When you select this option, QnA Maker extracts the hierarchy present in the document structure. The hierarchy is converted in to follow up prompts and the root of the hierarchy serves as the parent QnA. In some documents the root of the hierarchy does not have content which could serve as an answer, you can provide the 'Default Answer Text' to be used as a substitute answer text to extract such hierarchies.
5252

53-
Multi-turn structure can be inferred only from URLs, PDF files, or DOCX files. For an example of structure, view an image of a [Microsoft Surface user manual PDF file](https://github.com/Azure-Samples/cognitive-services-sample-data-files/blob/master/qna-maker/data-source-formats/product-manual.pdf).
53+
Multi-turn structure can be inferred only from URLs, PDF files, or DOCX files. For an example of structure, view an image of a [Microsoft Surface user manual PDF file](https://github.com/Azure-Samples/cognitive-services-sample-data-files/blob/master/qna-maker/data-source-formats/product-manual.pdf).
5454

5555
![![Example of structure in a user manual](../media/conversational-context/import-file-with-conversational-structure.png)](../media/conversational-context/import-file-with-conversational-structure.png#lightbox)
5656

5757
### Building your own multi-turn document
5858

5959
If you are creating a multi-turn document, please keep in mind the following guidelines:
6060

61-
* Use headings and sub-headings to denote hierarchy. For example You can h1 to denote the parent QnA and h2 to denote the QnA that should be taken as prompt. Use small heading size to denote subsequent hierarchy. Don't use style, color, or some other mechanism to imply structure in your document, QnA Maker will not extract the multi-turn prompts.
61+
* Use headings and sub-headings to denote hierarchy. For example You can h1 to denote the parent QnA and h2 to denote the QnA that should be taken as prompt. Use small heading size to denote subsequent hierarchy. Don't use style, color, or some other mechanism to imply structure in your document, QnA Maker will not extract the multi-turn prompts.
6262

63-
* Do not end a heading with a question mark, `?`.
63+
* First character of heading must be capitalized.
64+
65+
* Do not end a heading with a question mark, `?`.
6466

6567
* You can use the [sample document](https://github.com/Azure-Samples/cognitive-services-sample-data-files/blob/master/qna-maker/data-source-formats/multi-turn.docx) as an example to create your own multi-turn document.
6668

6769
### Adding files to a multi-turn KB
6870

69-
When you add a hierarchical document, QnA Maker determines follow-up prompts from the structure to create conversational flow.
71+
When you add a hierarchical document, QnA Maker determines follow-up prompts from the structure to create conversational flow.
7072

71-
1. In QnA Maker, select an existing knowledge base which was created with **Enable multi-turn extraction from URLs, .pdf or .docx files.** enabled.
72-
1. Go to the **Settings** page, select the file or URL to add.
73+
1. In QnA Maker, select an existing knowledge base which was created with **Enable multi-turn extraction from URLs, .pdf or .docx files.** enabled.
74+
1. Go to the **Settings** page, select the file or URL to add.
7375
1. **Save and train** the knowledge base.
7476

7577
> [!Caution]
@@ -78,25 +80,25 @@ When you add a hierarchical document, QnA Maker determines follow-up prompts fro
7880

7981
## Create knowledge base with multi-turn prompts with the Create API
8082

81-
You can create a knowledge case with multi-turn prompts using the [QnA Maker Create API](https://docs.microsoft.com/rest/api/cognitiveservices/qnamaker/knowledgebase/create). The prompts are adding in the `context` property's `prompts` array.
83+
You can create a knowledge case with multi-turn prompts using the [QnA Maker Create API](https://docs.microsoft.com/rest/api/cognitiveservices/qnamaker/knowledgebase/create). The prompts are adding in the `context` property's `prompts` array.
8284

8385
## Show questions and answers with context
8486

85-
Reduce the displayed question-and-answer pairs to only those with contextual conversations.
87+
Reduce the displayed question-and-answer pairs to only those with contextual conversations.
8688

87-
Select **View options**, and then select **Show context**. The list displays question-and-answer pairs that contain follow-up prompts.
89+
Select **View options**, and then select **Show context**. The list displays question-and-answer pairs that contain follow-up prompts.
8890

8991
![Filter question-and-answer pairs by contextual conversations](../media/conversational-context/filter-question-and-answers-by-context.png)
9092

9193
The multi-turn context is displayed in the first column.
9294

9395
![![The "Context (PREVIEW)" column](../media/conversational-context/surface-manual-pdf-follow-up-prompt.png)](../media/conversational-context/surface-manual-pdf-follow-up-prompt.png#lightbox)
9496

95-
In the preceding image, **#1** indicates bold text in the column, which signifies the current question. The parent question is the top item in the row. Any questions below it are the linked question-and-answer pairs. These items are selectable, so that you can immediately go to the other context items.
97+
In the preceding image, **#1** indicates bold text in the column, which signifies the current question. The parent question is the top item in the row. Any questions below it are the linked question-and-answer pairs. These items are selectable, so that you can immediately go to the other context items.
9698

9799
## Add an existing question-and-answer pair as a follow-up prompt
98100

99-
The original question, **My account**, has follow-up prompts, such as **Accounts and signing in**.
101+
The original question, **My account**, has follow-up prompts, such as **Accounts and signing in**.
100102

101103
![The "Accounts and signing in" answers and follow-up prompts](../media/conversational-context/detected-and-linked-follow-up-prompts.png)
102104

@@ -113,35 +115,35 @@ Add a follow-up prompt to an existing question-and-answer pair that isn't curren
113115
|Link to answer|Enter **Use the sign-in screen** to find the existing question-and-answer pair.|
114116

115117

116-
1. One match is returned. Select this answer as the follow-up, and then select **Save**.
118+
1. One match is returned. Select this answer as the follow-up, and then select **Save**.
117119

118120
![The "Follow-up prompt (PREVIEW)" page](../media/conversational-context/search-follow-up-prompt-for-existing-answer.png)
119121

120122
1. After you've added the follow-up prompt, select **Save and train** in the top navigation.
121-
122-
### Edit the display text
123123

124-
When a follow-up prompt is created, and an existing question-and-answer pair is entered as the **Link to Answer**, you can enter new **Display text**. This text doesn't replace the existing question, and it doesn't add a new alternate question. It is separate from those values.
124+
### Edit the display text
125+
126+
When a follow-up prompt is created, and an existing question-and-answer pair is entered as the **Link to Answer**, you can enter new **Display text**. This text doesn't replace the existing question, and it doesn't add a new alternate question. It is separate from those values.
125127

126128
1. To edit the display text, search for and select the question in the **Context** field.
127-
1. In the row for that question, select the follow-up prompt in the answer column.
129+
1. In the row for that question, select the follow-up prompt in the answer column.
128130
1. Select the display text you want to edit, and then select **Edit**.
129131

130132
![The Edit command for the display text](../media/conversational-context/edit-existing-display-text.png)
131133

132-
1. In the **Follow-up prompt** pop-up window, change the existing display text.
133-
1. When you're done editing the display text, select **Save**.
134+
1. In the **Follow-up prompt** pop-up window, change the existing display text.
135+
1. When you're done editing the display text, select **Save**.
134136
1. In the top navigation bar, **Save and train**.
135137

136138

137139
## Add a new question-and-answer pair as a follow-up prompt
138140

139141
When you add a new question-and-answer pair to the knowledge base, each pair should be linked to an existing question as a follow-up prompt.
140142

141-
1. On the knowledge base toolbar, search for and select the existing question-and-answer pair for **Accounts and signing in**.
143+
1. On the knowledge base toolbar, search for and select the existing question-and-answer pair for **Accounts and signing in**.
142144

143-
1. In the **Answer** column for this question, select **Add follow-up prompt**.
144-
1. Under **Follow-up prompt (PREVIEW)**, create a new follow-up prompt by entering the following values:
145+
1. In the **Answer** column for this question, select **Add follow-up prompt**.
146+
1. Under **Follow-up prompt (PREVIEW)**, create a new follow-up prompt by entering the following values:
145147

146148
|Field|Value|
147149
|--|--|
@@ -153,9 +155,9 @@ When you add a new question-and-answer pair to the knowledge base, each pair sho
153155
![Create a new prompt question and answer](../media/conversational-context/create-child-prompt-from-parent.png)
154156

155157

156-
1. Select **Create new**, and then select **Save**.
158+
1. Select **Create new**, and then select **Save**.
157159

158-
This action creates a new question-and-answer pair and links the selected question as a follow-up prompt. The **Context** column, for both questions, indicates a follow-up prompt relationship.
160+
This action creates a new question-and-answer pair and links the selected question as a follow-up prompt. The **Context** column, for both questions, indicates a follow-up prompt relationship.
159161

160162
1. Select **View options**, and then select [**Show context (PREVIEW)**](#show-questions-and-answers-with-context).
161163

@@ -179,7 +181,7 @@ If you don't enable multi-turn, the answer is returned but follow-up prompts are
179181

180182
## A JSON request to return an initial answer and follow-up prompts
181183

182-
Use the empty `context` object to request the answer to the user's question and include follow-up prompts.
184+
Use the empty `context` object to request the answer to the user's question and include follow-up prompts.
183185

184186
```JSON
185187
{
@@ -193,7 +195,7 @@ Use the empty `context` object to request the answer to the user's question and
193195

194196
## A JSON response to return an initial answer and follow-up prompts
195197

196-
The preceding section requested an answer and any follow-up prompts to **Accounts and signing in**. The response includes the prompt information, which is located at *answers[0].context*, and the text to display to the user.
198+
The preceding section requested an answer and any follow-up prompts to **Accounts and signing in**. The response includes the prompt information, which is located at *answers[0].context*, and the text to display to the user.
197199

198200
```JSON
199201
{
@@ -258,7 +260,7 @@ The preceding section requested an answer and any follow-up prompts to **Account
258260
}
259261
```
260262

261-
The `prompts` array provides text in the `displayText` property and the `qnaId` value. You can show these answers as the next displayed choices in the conversation flow and then send the selected `qnaId` back to QnA Maker in the following request.
263+
The `prompts` array provides text in the `displayText` property and the `qnaId` value. You can show these answers as the next displayed choices in the conversation flow and then send the selected `qnaId` back to QnA Maker in the following request.
262264

263265
<!--
264266
@@ -270,7 +272,7 @@ The `promptsToDelete` array provides the ...
270272

271273
Fill the `context` object to include the previous context.
272274

273-
In the following JSON request, the current question is *Use Windows Hello to sign in* and the previous question was *accounts and signing in*.
275+
In the following JSON request, the current question is *Use Windows Hello to sign in* and the previous question was *accounts and signing in*.
274276

275277
```JSON
276278
{
@@ -284,7 +286,7 @@ In the following JSON request, the current question is *Use Windows Hello to sig
284286
"previousUserQuery": "accounts and signing in"
285287
}
286288
}
287-
```
289+
```
288290

289291
## A JSON response to return a non-initial answer and follow-up prompts
290292

@@ -348,16 +350,16 @@ The QnA Maker _GenerateAnswer_ JSON response includes the follow-up prompts in t
348350

349351
## Query the knowledge base with the QnA Maker ID
350352

351-
If you are building a custom application using multi-turn feature. In the initial question's response, any follow-up prompts and its associated `qnaId` is returned. Now that you have the ID, you can pass this in the follow-up prompt's request body. If the request body contains the `qnaId`, and the context object (which contains the previous QnA Maker properties), then GenerateAnswer will return the exact question by ID, instead of using the ranking algorithm to find the answer by the question text.
353+
If you are building a custom application using multi-turn feature. In the initial question's response, any follow-up prompts and its associated `qnaId` is returned. Now that you have the ID, you can pass this in the follow-up prompt's request body. If the request body contains the `qnaId`, and the context object (which contains the previous QnA Maker properties), then GenerateAnswer will return the exact question by ID, instead of using the ranking algorithm to find the answer by the question text.
352354

353355

354356
## Display order is supported in the Update API
355357

356-
The [display text and display order](https://docs.microsoft.com/rest/api/cognitiveservices/qnamaker/knowledgebase/update#promptdto), returned in the JSON response, is supported for editing by the [Update API](https://docs.microsoft.com/rest/api/cognitiveservices/qnamaker/knowledgebase/update).
358+
The [display text and display order](https://docs.microsoft.com/rest/api/cognitiveservices/qnamaker/knowledgebase/update#promptdto), returned in the JSON response, is supported for editing by the [Update API](https://docs.microsoft.com/rest/api/cognitiveservices/qnamaker/knowledgebase/update).
357359

358360
## Add or delete multi-turn prompts with the Update API
359361

360-
You can add or delete multi-turn prompts using the [QnA Maker Update API](https://docs.microsoft.com/rest/api/cognitiveservices/qnamaker/knowledgebase/update). The prompts are adding in the `context` property's `promptsToAdd` array and the `promptsToDelete` array.
362+
You can add or delete multi-turn prompts using the [QnA Maker Update API](https://docs.microsoft.com/rest/api/cognitiveservices/qnamaker/knowledgebase/update). The prompts are adding in the `context` property's `promptsToAdd` array and the `promptsToDelete` array.
361363

362364
## Export knowledge base for version control
363365

0 commit comments

Comments
 (0)