Skip to content

Commit cd878c0

Browse files
authored
Merge pull request #99128 from diberry/diberry/1216-qna-get-answer
[Cogsvcs] QnA - get answer - fresh
2 parents 8074e79 + fb4bd9f commit cd878c0

File tree

5 files changed

+67
-68
lines changed

5 files changed

+67
-68
lines changed

articles/cognitive-services/QnAMaker/Quickstarts/get-answer-from-knowledge-base-csharp.md

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "Quickstart: Get answer from knowledge base - REST, C# - QnA Maker"
3-
titleSuffix: Azure Cognitive Services
3+
titleSuffix: Azure Cognitive Services
44
description: This C# REST-based quickstart walks you through getting an answer from a knowledge base, programmatically.
55
services: cognitive-services
66
author: diberry
@@ -9,28 +9,27 @@ manager: nitinme
99
ms.service: cognitive-services
1010
ms.subservice: qna-maker
1111
ms.topic: quickstart
12-
ms.date: 10/01/2019
12+
ms.date: 12/16/2019
1313
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#.
1515
---
1616

1717
# Quickstart: Get answers to a question from a knowledge base with C#
1818

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.
2020

21+
[Reference documentation](https://docs.microsoft.com/rest/api/cognitiveservices/qnamakerruntime/runtime) | [Sample](https://github.com/Azure-Samples/cognitive-services-qnamaker-csharp/blob/master/documentation-samples/quickstarts/get-answer/QnAMakerAnswerQuestion/Program.cs)
2122

2223
## Prerequisites
2324

2425
* 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).
2728

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.
2930

3031
![Publish settings](../media/qnamaker-quickstart-get-answer/publish-settings.png)
3132

32-
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-
3433
## Create a knowledge base project
3534

3635
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
4443

4544
## Add the required constants
4645

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.
4847

4948
[!code-csharp[Add the required constants](~/samples-qnamaker-csharp/documentation-samples/quickstarts/get-answer/QnAMakerAnswerQuestion/Program.cs?range=9-41 "Add the required constants")]
5049

@@ -54,17 +53,17 @@ The following code makes an HTTPS request to the QnA Maker API to send the quest
5453

5554
[!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")]
5655

57-
The `Authorization` header's value includes the string `EndpointKey`.
56+
The `Authorization` header's value includes the string `EndpointKey`.
5857

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).
6059

6160
## Build and run the program
6261

6362
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.
6463

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)]
6665

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)]
6867

6968
## Next steps
7069

articles/cognitive-services/QnAMaker/Quickstarts/get-answer-from-knowledge-base-go.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "Quickstart: Get answer from knowledge base - REST, Go - QnA Maker"
3-
titleSuffix: Azure Cognitive Services
3+
titleSuffix: Azure Cognitive Services
44
description: This Go REST-based quickstart walks you through getting an answer from a knowledge base, programmatically.
55
services: cognitive-services
66
author: diberry
@@ -9,28 +9,28 @@ manager: nitinme
99
ms.service: cognitive-services
1010
ms.subservice: qna-maker
1111
ms.topic: quickstart
12-
ms.date: 10/01/2019
12+
ms.date: 12/16/2019
1313
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.
1515
---
1616

1717
# Quickstart: Get answers to a question from a knowledge base with Go
1818

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.
20+
21+
[Reference documentation](https://docs.microsoft.com/rest/api/cognitiveservices/qnamakerruntime/runtime) | [Sample](https://github.com/Azure-Samples/cognitive-services-qnamaker-go/blob/master/documentation-samples/quickstarts/get-answer/get-answer.go)
2022

2123
## Prerequisites
2224

2325
* [Go 1.10.1](https://golang.org/dl/)
2426
* [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).
2729

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.
2931

3032
![Publish settings](../media/qnamaker-quickstart-get-answer/publish-settings.png)
3133

32-
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-
3434
## Create a Go file
3535

3636
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
5151

5252
## Add the required constants
5353

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.
5555

5656
[!code-go[Add the required constants](~/samples-qnamaker-go/documentation-samples/quickstarts/get-answer/get-answer.go?range=17-33 "Add the required constants")]
5757

@@ -61,7 +61,7 @@ The following code makes an HTTPS request to the QnA Maker API to send the quest
6161

6262
[!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")]
6363

64-
The `Authorization` header's value includes the string `EndpointKey`.
64+
The `Authorization` header's value includes the string `EndpointKey`.
6565

6666
Learn more about the [request](../how-to/metadata-generateanswer-usage.md#generateanswer-request) and [response](../how-to/metadata-generateanswer-usage.md#generateanswer-response).
6767

@@ -81,10 +81,10 @@ Build and run the program from the command line. It will automatically send the
8181
./get-answer
8282
```
8383

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)]
8585

8686

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)]
8888

8989
## Next steps
9090

articles/cognitive-services/QnAMaker/Quickstarts/get-answer-from-knowledge-base-java.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "Quickstart: Get answer from knowledge base - REST, Java - QnA Maker"
3-
titleSuffix: Azure Cognitive Services
3+
titleSuffix: Azure Cognitive Services
44
description: This Java REST-based quickstart walks you through getting an answer from a knowledge base, programmatically.
55
services: cognitive-services
66
author: diberry
@@ -9,40 +9,40 @@ manager: nitinme
99
ms.service: cognitive-services
1010
ms.subservice: qna-maker
1111
ms.topic: quickstart
12-
ms.date: 10/01/2019
12+
ms.date: 12/16/2019
1313
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.
1515
---
1616

1717
# Quickstart: Get answers to a question from a knowledge base with Java
1818

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.
20+
21+
[Reference documentation](https://docs.microsoft.com/rest/api/cognitiveservices/qnamakerruntime/runtime) | [Sample](https://github.com/Azure-Samples/cognitive-services-qnamaker-java/blob/master/documentation-samples/quickstarts/get-answer/GetAnswer.java)
2022

2123
## Prerequisites
2224

2325
* [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:
2527
* httpclient-4.5.3.jar
2628
* httpcore-4.4.6.jar
2729
* commons-logging-1.2.jar
2830
* [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).
3133

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.
3335

3436
![Publish settings](../media/qnamaker-quickstart-get-answer/publish-settings.png)
3537

36-
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-
3838
## Create a java file
3939

4040
Open VSCode and create a new file named `GetAnswer.java` and add the following class:
4141

4242
```Java
4343
public class GetAnswer {
4444

45-
public static void main(String[] args)
45+
public static void main(String[] args)
4646
{
4747

4848
}
@@ -57,7 +57,7 @@ This quickstart uses Apache classes for HTTP requests. Above the GetAnswer class
5757

5858
## Add the required constants
5959

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.
6161

6262
[!code-java[Add the required constants](~/samples-qnamaker-java/documentation-samples/quickstarts/get-answer/GetAnswer.java?range=26-42 "Add the required constants")]
6363

@@ -67,7 +67,7 @@ The following code makes an HTTPS request to the QnA Maker API to send the quest
6767

6868
[!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")]
6969

70-
The `Authorization` header's value includes the string `EndpointKey`.
70+
The `Authorization` header's value includes the string `EndpointKey`.
7171

7272
Learn more about the [request](../how-to/metadata-generateanswer-usage.md#generateanswer-request) and [response](../how-to/metadata-generateanswer-usage.md#generateanswer-response).
7373

@@ -87,10 +87,10 @@ Build and run the program from the command line. It will automatically send the
8787
java -cp ".;lib/*" GetAnswer
8888
```
8989

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)]
9191

9292

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)]
9494

9595
## Next steps
9696

0 commit comments

Comments
 (0)