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/Quickstarts/create-new-kb-csharp.md
+12-8Lines changed: 12 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ ms.custom: seodec18
9
9
ms.service: cognitive-services
10
10
ms.subservice: qna-maker
11
11
ms.topic: quickstart
12
-
ms.date: 07/16/2019
12
+
ms.date: 09/24/2019
13
13
ms.author: diberry
14
14
#Customer intent: As an API or REST developer new to the QnA Maker service, I want to programmatically create a knowledge base using C#.
15
15
---
@@ -45,24 +45,26 @@ At the top of Program.cs, replace the single using statement with the following
45
45
46
46
At the top of the Program class, add the following constants to access QnA Maker:
47
47
48
-
[!code-csharp[Add the required constants](~/samples-qnamaker-csharp/documentation-samples/quickstarts/create-knowledge-base/QnaQuickstartCreateKnowledgebase/Program.cs?range=17-24"Add the required constants")]
48
+
[!code-csharp[Add the required constants](~/samples-qnamaker-csharp/documentation-samples/quickstarts/create-knowledge-base/QnaQuickstartCreateKnowledgebase/Program.cs?range=17-26"Add the required constants")]
49
49
50
50
## Add the KB definition
51
51
52
52
After the constants, add the following KB definition:
53
53
54
-
[!code-csharp[Add the required constants](~/samples-qnamaker-csharp/documentation-samples/quickstarts/create-knowledge-base/QnaQuickstartCreateKnowledgebase/Program.cs?range=32-57"Add the required constants")]
54
+
[!code-csharp[Add the required constants](~/samples-qnamaker-csharp/documentation-samples/quickstarts/create-knowledge-base/QnaQuickstartCreateKnowledgebase/Program.cs?range=28-58"Add the knowledge base definition")]
55
55
56
56
## Add supporting functions and structures
57
57
Add the following code block inside the Program class:
58
58
59
-
[!code-csharp[Add supporting functions and structures](~/samples-qnamaker-csharp/documentation-samples/quickstarts/create-knowledge-base/QnaQuickstartCreateKnowledgebase/Program.cs?range=62-82"Add supporting functions and structures")]
59
+
[!code-csharp[Add supporting functions and structures](~/samples-qnamaker-csharp/documentation-samples/quickstarts/create-knowledge-base/QnaQuickstartCreateKnowledgebase/Program.cs?range=60-99"Add supporting functions and structures")]
60
60
61
61
## Add a POST request to create KB
62
62
63
63
The following code makes an HTTPS request to the QnA Maker API to create a KB and receives the response:
64
64
65
-
[!code-csharp[Add a POST request to create KB](~/samples-qnamaker-csharp/documentation-samples/quickstarts/create-knowledge-base/QnaQuickstartCreateKnowledgebase/Program.cs?range=91-105"Add a POST request to create KB")]
65
+
[!code-csharp[Add PostCreateKB to request via POST](~/samples-qnamaker-csharp/documentation-samples/quickstarts/create-knowledge-base/QnaQuickstartCreateKnowledgebase/Program.cs?range=145-165"Add PostCreateKB to request via POST")]
66
+
67
+
[!code-csharp[Add a POST request to create KB](~/samples-qnamaker-csharp/documentation-samples/quickstarts/create-knowledge-base/QnaQuickstartCreateKnowledgebase/Program.cs?range=101-122"Add a POST request to create KB")]
66
68
67
69
This API call returns a JSON response that includes the operation ID. Use the operation ID to determine if the KB is successfully created.
68
70
@@ -80,7 +82,9 @@ This API call returns a JSON response that includes the operation ID. Use the op
80
82
81
83
Check the status of the operation.
82
84
83
-
[!code-csharp[Add GET request to determine creation status](~/samples-qnamaker-csharp/documentation-samples/quickstarts/create-knowledge-base/QnaQuickstartCreateKnowledgebase/Program.cs?range=159-170"Add GET request to determine creation status")]
85
+
[!code-csharp[Add GetStatus to request via GET](~/samples-qnamaker-csharp/documentation-samples/quickstarts/create-knowledge-base/QnaQuickstartCreateKnowledgebase/Program.cs?range=167-187"Add GetStatus to request via GET")]
86
+
87
+
[!code-csharp[Add GET request to determine creation status](~/samples-qnamaker-csharp/documentation-samples/quickstarts/create-knowledge-base/QnaQuickstartCreateKnowledgebase/Program.cs?range=124-143"Add GET request to determine creation status")]
84
88
85
89
This API call returns a JSON response that includes the operation status:
86
90
@@ -111,13 +115,13 @@ Repeat the call until success or failure:
111
115
112
116
The following method creates the KB and repeats checks on the status. The _create_**Operation ID** is returned in the POST response header field **Location**, then used as part of the route in the GET request. Because the KB creation may take some time, you need to repeat calls to check the status until the status is either successful or fails. When the operation succeeds, the KB ID is returned in **resourceLocation**.
Copy file name to clipboardExpand all lines: articles/cognitive-services/QnAMaker/Quickstarts/get-answer-from-knowledge-base-csharp.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ manager: nitinme
9
9
ms.service: cognitive-services
10
10
ms.subservice: qna-maker
11
11
ms.topic: quickstart
12
-
ms.date: 09/04/2019
12
+
ms.date: 09/24/2019
13
13
ms.author: diberry
14
14
#Customer intent: As an API or REST developer new to the QnA Maker service, I want to programmatically get an answer a knowledge base using C#.
15
15
---
@@ -46,13 +46,13 @@ At the top of the Program.cs file, replace the single using statement with the f
46
46
47
47
At the top of the `Program` class, inside the `Main`, add the required constants to access QnA Maker. These values are on the **Publish** page after you publish the knowledge base.
48
48
49
-
[!code-csharp[Add the required constants](~/samples-qnamaker-csharp/documentation-samples/quickstarts/get-answer/QnAMakerAnswerQuestion/Program.cs?range=14-30"Add the required constants")]
49
+
[!code-csharp[Add the required constants](~/samples-qnamaker-csharp/documentation-samples/quickstarts/get-answer/QnAMakerAnswerQuestion/Program.cs?range=9-41"Add the required constants")]
50
50
51
51
## Add a POST request to send question and get answer
52
52
53
53
The following code makes an HTTPS request to the QnA Maker API to send the question to the knowledge base and receives the response:
54
54
55
-
[!code-csharp[Add a POST request to send question to knowledge base](~/samples-qnamaker-csharp/documentation-samples/quickstarts/get-answer/QnAMakerAnswerQuestion/Program.cs?range=32-57"Add a POST request to send question to knowledge base")]
55
+
[!code-csharp[Add a POST request to send question to knowledge base](~/samples-qnamaker-csharp/documentation-samples/quickstarts/get-answer/QnAMakerAnswerQuestion/Program.cs?range=43-76"Add a POST request to send question to knowledge base")]
56
56
57
57
The `Authorization` header's value includes the string `EndpointKey`.
Copy file name to clipboardExpand all lines: articles/cognitive-services/QnAMaker/Quickstarts/publish-kb-csharp.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ ms.custom: seodec18
9
9
ms.service: cognitive-services
10
10
ms.subservice: qna-maker
11
11
ms.topic: quickstart
12
-
ms.date: 09/03/2019
12
+
ms.date: 09/24/2019
13
13
ms.author: diberry
14
14
#Customer intent: As an API or REST developer new to the QnA Maker service, I want to programmatically publish a knowledge base using C#.
15
15
---
@@ -47,15 +47,15 @@ At the top of Program.cs, replace the single using statement with the following
47
47
48
48
## Add required constants
49
49
50
-
In the **Main**method, add the required constants to access QnA Maker. Replace the values with your own.
50
+
In the **Program**class, add the required constants to access QnA Maker.
51
51
52
-
[!code-csharp[Add the required constants](~/samples-qnamaker-csharp/documentation-samples/quickstarts/publish-knowledge-base/QnAMakerPublishQuickstart/Program.cs?range=11-14"Add the required constants")]
52
+
[!code-csharp[Add the required constants](~/samples-qnamaker-csharp/documentation-samples/quickstarts/publish-knowledge-base/QnAMakerPublishQuickstart/Program.cs?range=8-34"Add the required constants")]
53
53
54
-
## Add POST request to publish knowledge base
54
+
## Add the Main method to publish the knowledge base
55
55
56
56
After the required constants, add the following code, which makes an HTTPS request to the QnA Maker API to publish a knowledge base and receives the response:
57
57
58
-
[!code-csharp[Add HTTP Post request and response](~/samples-qnamaker-csharp/documentation-samples/quickstarts/publish-knowledge-base/QnAMakerPublishQuickstart/Program.cs?range=16-29&dedent=8"Add HTTP Post request and response")]
58
+
[!code-csharp[Add HTTP Post request and response](~/samples-qnamaker-csharp/documentation-samples/quickstarts/publish-knowledge-base/QnAMakerPublishQuickstart/Program.cs?range=36-56"Add HTTP Post request and response")]
59
59
60
60
The API call returns a 204 status for a successful publish without any content in the body of the response.
0 commit comments