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/get-answer-from-knowledge-base-csharp.md
+13-14Lines changed: 13 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
2
title: "Quickstart: Get answer from knowledge base - REST, C# - QnA Maker"
3
-
titleSuffix: Azure Cognitive Services
3
+
titleSuffix: Azure Cognitive Services
4
4
description: This C# REST-based quickstart walks you through getting an answer from a knowledge base, programmatically.
5
5
services: cognitive-services
6
6
author: diberry
@@ -9,28 +9,27 @@ manager: nitinme
9
9
ms.service: cognitive-services
10
10
ms.subservice: qna-maker
11
11
ms.topic: quickstart
12
-
ms.date: 10/01/2019
12
+
ms.date: 12/16/2019
13
13
ms.author: diberry
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#.
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
---
16
16
17
17
# Quickstart: Get answers to a question from a knowledge base with C#
18
18
19
-
This quickstart walks you through programmatically getting an answer from a published QnA Maker knowledge base. The knowledge base contains questions and answers from [data sources](../Concepts/data-sources-supported.md) such as FAQs. The [question](../how-to/metadata-generateanswer-usage.md#generateanswer-request-configuration) is sent to the QnA Maker service. The [response](../how-to/metadata-generateanswer-usage.md#generateanswer-response-properties) includes the top-predicted answer.
19
+
This quickstart walks you through programmatically getting an answer from a published QnA Maker knowledge base. The knowledge base contains questions and answers from [data sources](../Concepts/data-sources-supported.md) such as FAQs. The [question](../how-to/metadata-generateanswer-usage.md#generateanswer-request-configuration) is sent to the QnA Maker service. The [response](../how-to/metadata-generateanswer-usage.md#generateanswer-response-properties) includes the top-predicted answer.
* Latest [**Visual Studio Community edition**](https://www.visualstudio.com/downloads/).
25
-
* You must have a [QnA Maker service](../How-To/set-up-qnamaker-service-azure.md). To retrieve your key, select **Keys** under **Resource Management** in your Azure dashboard for your QnA Maker resource.
26
-
***Publish** page settings. If you do not have a published knowledge base, create an empty knowledge base, then import a knowledge base on the **Settings** page, then publish. You can download and use [this basic knowledge base](https://github.com/Azure-Samples/cognitive-services-sample-data-files/blob/master/qna-maker/knowledge-bases/basic-kb.tsv).
26
+
* You must have a [QnA Maker service](../How-To/set-up-qnamaker-service-azure.md). To retrieve your key, select **Keys** under **Resource Management** in your Azure dashboard for your QnA Maker resource.
27
+
***Publish** page settings. If you do not have a published knowledge base, create an empty knowledge base, then import a knowledge base on the **Settings** page, then publish. You can download and use [this basic knowledge base](https://github.com/Azure-Samples/cognitive-services-sample-data-files/blob/master/qna-maker/knowledge-bases/basic-kb.tsv).
27
28
28
-
The publish page settings include POST route value, Host value, and EndpointKey value.
29
+
The publish page settings include POST route value, Host value, and EndpointKey value.
The code for this quickstart is in the [https://github.com/Azure-Samples/cognitive-services-qnamaker-csharp](https://github.com/Azure-Samples/cognitive-services-qnamaker-csharp/tree/master/documentation-samples/quickstarts/get-answer) repository.
33
-
34
33
## Create a knowledge base project
35
34
36
35
1. Open Visual Studio 2019 Community edition.
@@ -44,7 +43,7 @@ At the top of the Program.cs file, replace the single using statement with the f
44
43
45
44
## Add the required constants
46
45
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.
46
+
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
47
49
48
[!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
49
@@ -54,17 +53,17 @@ The following code makes an HTTPS request to the QnA Maker API to send the quest
54
53
55
54
[!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
55
57
-
The `Authorization` header's value includes the string `EndpointKey`.
56
+
The `Authorization` header's value includes the string `EndpointKey`.
58
57
59
-
Learn more about the [request](../how-to/metadata-generateanswer-usage.md#generateanswer-request) and [response](../how-to/metadata-generateanswer-usage.md#generateanswer-response).
58
+
Learn more about the [request](../how-to/metadata-generateanswer-usage.md#generateanswer-request) and [response](../how-to/metadata-generateanswer-usage.md#generateanswer-response).
60
59
61
60
## Build and run the program
62
61
63
62
Build and run the program from Visual Studio. It will automatically send the request to the QnA Maker API, then it will print to the console window.
64
63
65
-
[!INCLUDE [JSON request and response](../../../../includes/cognitive-services-qnamaker-quickstart-get-answer-json.md)]
64
+
[!INCLUDE [JSON request and response](../../../../includes/cognitive-services-qnamaker-quickstart-get-answer-json.md)]
66
65
67
-
[!INCLUDE [Clean up files and knowledge base](../../../../includes/cognitive-services-qnamaker-quickstart-cleanup-resources.md)]
66
+
[!INCLUDE [Clean up files and knowledge base](../../../../includes/cognitive-services-qnamaker-quickstart-cleanup-resources.md)]
Copy file name to clipboardExpand all lines: articles/cognitive-services/QnAMaker/Quickstarts/get-answer-from-knowledge-base-go.md
+13-13Lines changed: 13 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
2
title: "Quickstart: Get answer from knowledge base - REST, Go - QnA Maker"
3
-
titleSuffix: Azure Cognitive Services
3
+
titleSuffix: Azure Cognitive Services
4
4
description: This Go REST-based quickstart walks you through getting an answer from a knowledge base, programmatically.
5
5
services: cognitive-services
6
6
author: diberry
@@ -9,28 +9,28 @@ manager: nitinme
9
9
ms.service: cognitive-services
10
10
ms.subservice: qna-maker
11
11
ms.topic: quickstart
12
-
ms.date: 10/01/2019
12
+
ms.date: 12/16/2019
13
13
ms.author: diberry
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 Go.
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 Go.
15
15
---
16
16
17
17
# Quickstart: Get answers to a question from a knowledge base with Go
18
18
19
-
This quickstart walks you through programmatically getting an answer from a published QnA Maker knowledge base. The knowledge base contains questions and answers from [data sources](../Concepts/data-sources-supported.md) such as FAQs. The [question](../how-to/metadata-generateanswer-usage.md#generateanswer-request-configuration) is sent to the QnA Maker service. The [response](../how-to/metadata-generateanswer-usage.md#generateanswer-response-properties) includes the top-predicted answer.
19
+
This quickstart walks you through programmatically getting an answer from a published QnA Maker knowledge base. The knowledge base contains questions and answers from [data sources](../Concepts/data-sources-supported.md) such as FAQs. The [question](../how-to/metadata-generateanswer-usage.md#generateanswer-request-configuration) is sent to the QnA Maker service. The [response](../how-to/metadata-generateanswer-usage.md#generateanswer-response-properties) includes the top-predicted answer.
*[Visual Studio Code](https://code.visualstudio.com/)
25
-
* You must have a [QnA Maker service](../How-To/set-up-qnamaker-service-azure.md). To retrieve your key, select **Keys** under **Resource Management** in your Azure dashboard for your QnA Maker resource.
26
-
***Publish** page settings. If you do not have a published knowledge base, create an empty knowledge base, then import a knowledge base on the **Settings** page, then publish. You can download and use [this basic knowledge base](https://github.com/Azure-Samples/cognitive-services-sample-data-files/blob/master/qna-maker/knowledge-bases/basic-kb.tsv).
27
+
* You must have a [QnA Maker service](../How-To/set-up-qnamaker-service-azure.md). To retrieve your key, select **Keys** under **Resource Management** in your Azure dashboard for your QnA Maker resource.
28
+
***Publish** page settings. If you do not have a published knowledge base, create an empty knowledge base, then import a knowledge base on the **Settings** page, then publish. You can download and use [this basic knowledge base](https://github.com/Azure-Samples/cognitive-services-sample-data-files/blob/master/qna-maker/knowledge-bases/basic-kb.tsv).
27
29
28
-
The publish page settings include POST route value, Host value, and EndpointKey value.
30
+
The publish page settings include POST route value, Host value, and EndpointKey value.
The code for this quickstart is in the [https://github.com/Azure-Samples/cognitive-services-qnamaker-Go](https://github.com/Azure-Samples/cognitive-services-qnamaker-Go/tree/master/documentation-samples/quickstarts/get-answer) repository.
33
-
34
34
## Create a Go file
35
35
36
36
Open VSCode and create a new file named `get-answer.go` and add the following class:
@@ -51,7 +51,7 @@ Above the `main` function, at the top of the `get-answer.go` file, add necessary
51
51
52
52
## Add the required constants
53
53
54
-
At the top of the `main` function, add the required constants to access QnA Maker. These values are on the **Publish** page after you publish the knowledge base.
54
+
At the top of the `main` function, add the required constants to access QnA Maker. These values are on the **Publish** page after you publish the knowledge base.
55
55
56
56
[!code-go[Add the required constants](~/samples-qnamaker-go/documentation-samples/quickstarts/get-answer/get-answer.go?range=17-33"Add the required constants")]
57
57
@@ -61,7 +61,7 @@ The following code makes an HTTPS request to the QnA Maker API to send the quest
61
61
62
62
[!code-go[Add a POST request to send question to knowledge base](~/samples-qnamaker-go/documentation-samples/quickstarts/get-answer/get-answer.go?range=35-48"Add a POST request to send question to knowledge base")]
63
63
64
-
The `Authorization` header's value includes the string `EndpointKey`.
64
+
The `Authorization` header's value includes the string `EndpointKey`.
65
65
66
66
Learn more about the [request](../how-to/metadata-generateanswer-usage.md#generateanswer-request) and [response](../how-to/metadata-generateanswer-usage.md#generateanswer-response).
67
67
@@ -81,10 +81,10 @@ Build and run the program from the command line. It will automatically send the
81
81
./get-answer
82
82
```
83
83
84
-
[!INCLUDE [JSON request and response](../../../../includes/cognitive-services-qnamaker-quickstart-get-answer-json.md)]
84
+
[!INCLUDE [JSON request and response](../../../../includes/cognitive-services-qnamaker-quickstart-get-answer-json.md)]
85
85
86
86
87
-
[!INCLUDE [Clean up files and knowledge base](../../../../includes/cognitive-services-qnamaker-quickstart-cleanup-resources.md)]
87
+
[!INCLUDE [Clean up files and knowledge base](../../../../includes/cognitive-services-qnamaker-quickstart-cleanup-resources.md)]
Copy file name to clipboardExpand all lines: articles/cognitive-services/QnAMaker/Quickstarts/get-answer-from-knowledge-base-java.md
+15-15Lines changed: 15 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
2
title: "Quickstart: Get answer from knowledge base - REST, Java - QnA Maker"
3
-
titleSuffix: Azure Cognitive Services
3
+
titleSuffix: Azure Cognitive Services
4
4
description: This Java REST-based quickstart walks you through getting an answer from a knowledge base, programmatically.
5
5
services: cognitive-services
6
6
author: diberry
@@ -9,40 +9,40 @@ manager: nitinme
9
9
ms.service: cognitive-services
10
10
ms.subservice: qna-maker
11
11
ms.topic: quickstart
12
-
ms.date: 10/01/2019
12
+
ms.date: 12/16/2019
13
13
ms.author: diberry
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 Java.
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 Java.
15
15
---
16
16
17
17
# Quickstart: Get answers to a question from a knowledge base with Java
18
18
19
-
This quickstart walks you through programmatically getting an answer from a published QnA Maker knowledge base. The knowledge base contains questions and answers from [data sources](../Concepts/data-sources-supported.md) such as FAQs. The [question](../how-to/metadata-generateanswer-usage.md#generateanswer-request-configuration) is sent to the QnA Maker service. The [response](../how-to/metadata-generateanswer-usage.md#generateanswer-response-properties) includes the top-predicted answer.
19
+
This quickstart walks you through programmatically getting an answer from a published QnA Maker knowledge base. The knowledge base contains questions and answers from [data sources](../Concepts/data-sources-supported.md) such as FAQs. The [question](../how-to/metadata-generateanswer-usage.md#generateanswer-request-configuration) is sent to the QnA Maker service. The [response](../how-to/metadata-generateanswer-usage.md#generateanswer-response-properties) includes the top-predicted answer.
*[JDK SE](https://aka.ms/azure-jdks) (Java Development Kit, Standard Edition)
24
-
* This sample uses the Apache [HTTP client](https://hc.apache.org/httpcomponents-client-ga/) from HTTP Components. You need to add the following Apache HTTP client libraries to your project:
26
+
* This sample uses the Apache [HTTP client](https://hc.apache.org/httpcomponents-client-ga/) from HTTP Components. You need to add the following Apache HTTP client libraries to your project:
25
27
* httpclient-4.5.3.jar
26
28
* httpcore-4.4.6.jar
27
29
* commons-logging-1.2.jar
28
30
*[Visual Studio Code](https://code.visualstudio.com/)
29
-
* You must have a [QnA Maker service](../How-To/set-up-qnamaker-service-azure.md). To retrieve your key, select **Keys** under **Resource Management** in your Azure dashboard for your QnA Maker resource.
30
-
***Publish** page settings. If you do not have a published knowledge base, create an empty knowledge base, then import a knowledge base on the **Settings** page, then publish. You can download and use [this basic knowledge base](https://github.com/Azure-Samples/cognitive-services-sample-data-files/blob/master/qna-maker/knowledge-bases/basic-kb.tsv).
31
+
* You must have a [QnA Maker service](../How-To/set-up-qnamaker-service-azure.md). To retrieve your key, select **Keys** under **Resource Management** in your Azure dashboard for your QnA Maker resource.
32
+
***Publish** page settings. If you do not have a published knowledge base, create an empty knowledge base, then import a knowledge base on the **Settings** page, then publish. You can download and use [this basic knowledge base](https://github.com/Azure-Samples/cognitive-services-sample-data-files/blob/master/qna-maker/knowledge-bases/basic-kb.tsv).
31
33
32
-
The publish page settings include POST route value, Host value, and EndpointKey value.
34
+
The publish page settings include POST route value, Host value, and EndpointKey value.
The code for this quickstart is in the [https://github.com/Azure-Samples/cognitive-services-qnamaker-java](https://github.com/Azure-Samples/cognitive-services-qnamaker-java/tree/master/documentation-samples/quickstarts/get-answer) repository.
37
-
38
38
## Create a java file
39
39
40
40
Open VSCode and create a new file named `GetAnswer.java` and add the following class:
41
41
42
42
```Java
43
43
publicclassGetAnswer {
44
44
45
-
publicstaticvoidmain(String[] args)
45
+
publicstaticvoidmain(String[] args)
46
46
{
47
47
48
48
}
@@ -57,7 +57,7 @@ This quickstart uses Apache classes for HTTP requests. Above the GetAnswer class
57
57
58
58
## Add the required constants
59
59
60
-
At the top of the `GetAnswer.java` class, add the required constants to access QnA Maker. These values are on the **Publish** page after you publish the knowledge base.
60
+
At the top of the `GetAnswer.java` class, add the required constants to access QnA Maker. These values are on the **Publish** page after you publish the knowledge base.
61
61
62
62
[!code-java[Add the required constants](~/samples-qnamaker-java/documentation-samples/quickstarts/get-answer/GetAnswer.java?range=26-42"Add the required constants")]
63
63
@@ -67,7 +67,7 @@ The following code makes an HTTPS request to the QnA Maker API to send the quest
67
67
68
68
[!code-java[Add a POST request to send question to knowledge base](~/samples-qnamaker-java/documentation-samples/quickstarts/get-answer/GetAnswer.java?range=44-72"Add a POST request to send question to knowledge base")]
69
69
70
-
The `Authorization` header's value includes the string `EndpointKey`.
70
+
The `Authorization` header's value includes the string `EndpointKey`.
71
71
72
72
Learn more about the [request](../how-to/metadata-generateanswer-usage.md#generateanswer-request) and [response](../how-to/metadata-generateanswer-usage.md#generateanswer-response).
73
73
@@ -87,10 +87,10 @@ Build and run the program from the command line. It will automatically send the
87
87
java -cp ".;lib/*" GetAnswer
88
88
```
89
89
90
-
[!INCLUDE [JSON request and response](../../../../includes/cognitive-services-qnamaker-quickstart-get-answer-json.md)]
90
+
[!INCLUDE [JSON request and response](../../../../includes/cognitive-services-qnamaker-quickstart-get-answer-json.md)]
91
91
92
92
93
-
[!INCLUDE [Clean up files and knowledge base](../../../../includes/cognitive-services-qnamaker-quickstart-cleanup-resources.md)]
93
+
[!INCLUDE [Clean up files and knowledge base](../../../../includes/cognitive-services-qnamaker-quickstart-cleanup-resources.md)]
0 commit comments