Skip to content

Commit 6630ca0

Browse files
authored
Merge pull request #112903 from diberry/diberry/0427-qna-fresh-april
[Cogsvcs] Qna Maker - freshness
2 parents 8a92beb + f9b758a commit 6630ca0

File tree

7 files changed

+36
-130
lines changed

7 files changed

+36
-130
lines changed

articles/cognitive-services/QnAMaker/Quickstarts/get-answer-from-knowledge-base-using-url-tool.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ms.service: cognitive-services
99
ms.subservice: qna-maker
1010
zone_pivot_groups: URL-test-interface
1111
ms.topic: quickstart
12-
ms.date: 02/08/2020
12+
ms.date: 04/27/2020
1313
ms.author: diberry
1414
#Customer intent: As an knowledge base manager new to the QnA Maker service, I want to get an answer from a published knowledge base using a URL tool such as Postman or cURL.
1515
---

articles/cognitive-services/QnAMaker/Quickstarts/quickstart-sdk.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: "Quickstart: Use SDK to create and manage knowledge base - QnA Maker"
33
description: This quickstart shows you how to create and manage your knowledge base using the client SDK.
44
ms.topic: quickstart
5-
ms.date: 01/13/2020
5+
ms.date: 04/27/2020
66
zone_pivot_groups: programming-languages-set-six
77
---
88

articles/cognitive-services/QnAMaker/includes/quickstart-sdk-csharp.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22
title: "Quickstart: QnA Maker client library for .NET"
33
description: This quickstart shows how to get started with the QnA Maker client library for .NET. Follow these steps to install the package and try out the example code for basic tasks. QnA Maker enables you to power a question-and-answer service from your semi-structured content like FAQ documents, URLs, and product manuals.
44
ms.topic: quickstart
5-
ms.date: 01/13/2020
5+
ms.date: 04/27/2020
66
---
77
Use the QnA Maker client library for .NET to:
88

99
* Create a knowledge base
10-
* Manage a knowledge base
10+
* Update a knowledge base
1111
* Publish a knowledge base
12-
* Generate an answer from the knowledge base
12+
* Get published endpoint key
13+
* Wait for long-running task
14+
* Delete knowledge base
1315

1416
[Reference documentation](https://docs.microsoft.com/dotnet/api/microsoft.azure.cognitiveservices.knowledge.qnamaker?view=azure-dotnet) | [Library source code](https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/cognitiveservices/Knowledge.QnAMaker) | [Package (NuGet)](https://www.nuget.org/packages/Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker/) | [C# Samples](https://github.com/Azure-Samples/cognitive-services-qnamaker-csharp)
1517

@@ -18,15 +20,18 @@ Use the QnA Maker client library for .NET to:
1820
## Prerequisites
1921

2022
* Azure subscription - [Create one for free](https://azure.microsoft.com/free/)
21-
* The current version of [.NET Core](https://dotnet.microsoft.com/download/dotnet-core).
23+
* The [Visual Studio IDE](https://visualstudio.microsoft.com/vs/) or current version of [.NET Core](https://dotnet.microsoft.com/download/dotnet-core).
24+
* Once you have your Azure subscription, create a [QnA Maker resource](https://ms.portal.azure.com/#create/Microsoft.CognitiveServicesQnAMaker) in the Azure portal to get your authoring key and endpoint. After it deploys, select **Go to resource**.
25+
* You will need the key and endpoint from the resource you create to connect your application to the QnA Maker API. You'll paste your key and endpoint into the code below later in the quickstart.
26+
* You can use the free pricing tier (`F0`) to try the service, and upgrade later to a paid tier for production.
2227

2328
## Setting up
2429

2530
### Create a QnA Maker Azure resource
2631

2732
Azure Cognitive Services are represented by Azure resources that you subscribe to. Create a resource for QnA Maker using the [Azure portal](https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account) or [Azure CLI](https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account-cli) on your local machine.
2833

29-
After getting a key and endpoint for your resource, [create environment variables](https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account#configure-an-environment-variable-for-authentication) for the key, named `QNAMAKER_SUBSCRIPTION_KEY`. The resource name is used as part of the endpoint URL.
34+
After getting a key and endpoint for your resource, [create an environment variable](https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account#configure-an-environment-variable-for-authentication) for the key, named `QNAMAKER_SUBSCRIPTION_KEY`. The resource name is used as custom subdomain of the endpoint URL.
3035

3136
### Create a new C# application
3237

@@ -115,7 +120,7 @@ In the **main** method, create a variable for your resource's authentication pul
115120

116121
Create a [QnAMakerRuntimeClient](https://docs.microsoft.com/dotnet/api/microsoft.azure.cognitiveservices.knowledge.qnamaker.qnamakerruntimeclient?view=azure-dotnet) to query the knowledge base to generate an answer or train from active learning.
117122

118-
[!code-csharp[Authenticate the runtime](~/samples-qnamaker-csharp/documentation-samples/quickstarts/Knowledgebase_Quickstart/Program.cs?name=EndpointKey)]
123+
[!code-csharp[Authenticate the runtime](~/samples-qnamaker-csharp/documentation-samples/quickstarts/Knowledgebase_Quickstart/Program.cs?name=EndpointKey&highlight=3)]
119124

120125
## Create a knowledge base
121126

@@ -129,7 +134,7 @@ Call the [CreateAsync](https://docs.microsoft.com/dotnet/api/microsoft.azure.cog
129134

130135
The final line of the following code returns the knowledge base ID from the response from MonitorOoperation.
131136

132-
[!code-csharp[Create a knowledge base](~/samples-qnamaker-csharp/documentation-samples/quickstarts/Knowledgebase_Quickstart/Program.cs?name=CreateKB&highlight=29,30)]
137+
[!code-csharp[Create a knowledge base](~/samples-qnamaker-csharp/documentation-samples/quickstarts/Knowledgebase_Quickstart/Program.cs?name=CreateKB&highlight=30)]
133138

134139
Make sure the include the [`MonitorOperation`](#get-status-of-an-operation) function, referenced in the above code, in order to successfully create a knowledge base.
135140

articles/cognitive-services/QnAMaker/includes/quickstart-sdk-nodejs.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: "Quickstart: QnA Maker client library for Node.js"
33
description: This quickstart shows how to get started with the QnA Maker client library for Node.js.
44
ms.topic: quickstart
5-
ms.date: 01/13/2020
5+
ms.date: 04/27/2020
66
---
77
Use the QnA Maker client library for Node.js to:
88

@@ -21,6 +21,9 @@ Use the QnA Maker client library for Node.js to:
2121

2222
* Azure subscription - [Create one for free](https://azure.microsoft.com/free/)
2323
* The current version of [Node.js](https://nodejs.org).
24+
* Once you have your Azure subscription, create a [QnA Maker resource](https://ms.portal.azure.com/#create/Microsoft.CognitiveServicesQnAMaker) in the Azure portal to get your authoring key and endpoint. After it deploys, select **Go to resource**.
25+
* You will need the key and endpoint from the resource you create to connect your application to the QnA Maker API. You'll paste your key and endpoint into the code below later in the quickstart.
26+
* You can use the free pricing tier (`F0`) to try the service, and upgrade later to a paid tier for production.
2427

2528
## Setting up
2629

@@ -126,7 +129,7 @@ Make sure the include the [`wait_for_operation`](#get-status-of-an-operation) fu
126129

127130
## Publish a knowledge base
128131

129-
Publish the knowledge base using the [publish](https://docs.microsoft.com/javascript/api/@azure/cognitiveservices-qnamaker/knowledgebase?view=azure-node-latest#publish-string--msrest-requestoptionsbase-) method. This takes the current saved and trained model, referenced by the knowledge base ID, and publishes that at an endpoint. Check the HTTP response code to validate publish succeeded.
132+
Publish the knowledge base using the [publish](https://docs.microsoft.com/javascript/api/@azure/cognitiveservices-qnamaker/knowledgebase?view=azure-node-latest#publish-string--msrest-requestoptionsbase-) method. This takes the current saved and trained model, referenced by the knowledge base ID, and publishes that at an endpoint. Check the HTTP response code to validate that the publish succeeded.
130133

131134
[!code-javascript[Publish a knowledge base](~/cognitive-services-quickstart-code/javascript/QnAMaker/sdk/qnamaker_quickstart.js?name=publishKnowledgeBase&highlight=3)]
132135

articles/cognitive-services/QnAMaker/includes/quickstart-sdk-python.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
1-
1+
---
2+
title: "Quickstart: QnA Maker client library for Python"
3+
description: This quickstart shows how to get started with the QnA Maker client library for Python.
4+
ms.topic: include
5+
ms.date: 04/27/2020
6+
---
27
Use the QnA Maker client library for python to:
38

49
* Create a knowledge base
5-
* Manage a knowledge base
10+
* Update a knowledge base
611
* Publish a knowledge base
12+
* Get published endpoint key
13+
* Wait for long-running task
14+
* Delete knowledge base
715

816
[Reference documentation](https://docs.microsoft.com/python/api/azure-cognitiveservices-knowledge-qnamaker/azure.cognitiveservices.knowledge.qnamaker?view=azure-python) | [Library source code](https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker) | [Package (pypi)](https://pypi.org/project/azure-cognitiveservices-knowledge-qnamaker/) | [Python samples](https://github.com/Azure-Samples/cognitive-services-qnamaker-python/blob/master/documentation-samples/quickstarts/knowledgebase_quickstart/knowledgebase_quickstart.py)
917

@@ -13,6 +21,9 @@ Use the QnA Maker client library for python to:
1321

1422
* Azure subscription - [Create one for free](https://azure.microsoft.com/free/)
1523
* [Python 3.x](https://www.python.org/)
24+
* Once you have your Azure subscription, create a [QnA Maker resource](https://ms.portal.azure.com/#create/Microsoft.CognitiveServicesQnAMaker) in the Azure portal to get your authoring key and endpoint. After it deploys, select **Go to resource**.
25+
* You will need the key and endpoint from the resource you create to connect your application to the QnA Maker API. You'll paste your key and endpoint into the code below later in the quickstart.
26+
* You can use the free pricing tier (`F0`) to try the service, and upgrade later to a paid tier for production.
1627

1728
## Setting up
1829

articles/cognitive-services/QnAMaker/includes/quickstart-test-tool-curl.md

Lines changed: 2 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ms.service: cognitive-services
88
ms.subservice: luis
99
ms.topic: include
1010
ms.custom: include file
11-
ms.date: 02/08/2020
11+
ms.date: 04/27/2020
1212
ms.author: diberry
1313
---
1414

@@ -291,120 +291,7 @@ The JSON response uses the same schema as the published knowledge base query.
291291

292292
Because the question of `Thank you` exactly matched a Chit-chat question, QnA Maker is completely confident with the score of 100. QnA Maker also returned all the related questions, as well as the metadata property containing the Chit-chat metadata tag information.
293293

294-
## Use cURL with threshold and default answer
295-
296-
You can request a minimum threshold for the answer. If the threshold is not met, the default answer is returned.
297-
298-
1. Use the following cURL command, replacing with your own resource name, knowledge base ID, and endpoint key, to ask for an answer to `size` with a threshold of 80% or better. The knowledge base should not find that answer because the question's score is 71%, and instead return the default answer you provided when you created the knowledge base.
299-
300-
```bash
301-
curl -X POST https://replace-with-your-resource-name.azurewebsites.net/qnamaker/knowledgebases/replace-with-your-knowledge-base-id/generateAnswer -H "Authorization: EndpointKey replace-with-your-endpoint-key" -H "Content-type: application/json" -d "{'question':'size', 'scoreThreshold':80.00}"
302-
```
303-
304-
1. Run the cURL command and receive the JSON response, including the score and answer.
305-
306-
```json
307-
{
308-
"answers": [
309-
{
310-
"questions": [],
311-
"answer": "No good match found in KB.",
312-
"score": 0.0,
313-
"id": -1,
314-
"source": null,
315-
"metadata": []
316-
}
317-
],
318-
"debugInfo": null,
319-
"activeLearningEnabled": true
320-
}
321-
```
322-
323-
QnA Maker returned a score of `0`, which means no confidence. It also returned the default answer.
324-
325-
```json
326-
{
327-
"answers": [
328-
{
329-
"questions": [
330-
"I thank you",
331-
"Oh, thank you",
332-
"My sincere thanks",
333-
"My humblest thanks to you",
334-
"Marvelous, thanks",
335-
"Marvelous, thank you kindly",
336-
"Marvelous, thank you",
337-
"Many thanks to you",
338-
"Many thanks",
339-
"Kthx",
340-
"I'm grateful, thanks",
341-
"Ahh, thanks",
342-
"I'm grateful for that, thank you",
343-
"Perfecto, thanks",
344-
"I appreciate you",
345-
"I appreciate that",
346-
"I appreciate it",
347-
"I am very thankful for that",
348-
"How kind, thank you",
349-
"Great, thanks",
350-
"Great, thank you",
351-
"Gracias",
352-
"Gotcha, thanks",
353-
"Gotcha, thank you",
354-
"Awesome thanks!",
355-
"I'm grateful for that, thank you kindly",
356-
"thank you pal",
357-
"Wonderful, thank you!",
358-
"Wonderful, thank you very much",
359-
"Why thank you",
360-
"Thx",
361-
"Thnx",
362-
"That's very kind",
363-
"That's great, thanks",
364-
"That is lovely, thanks",
365-
"That is awesome, thanks!",
366-
"Thanks bot",
367-
"Thanks a lot",
368-
"Okay, thanks!",
369-
"Thank you so much",
370-
"Perfect, thanks",
371-
"Thank you my friend",
372-
"Thank you kindly",
373-
"Thank you for that",
374-
"Thank you bot",
375-
"Thank you",
376-
"Right on, thanks very much",
377-
"Right on, thanks a lot",
378-
"Radical, thanks",
379-
"Rad, thanks",
380-
"Rad thank you",
381-
"Wonderful, thanks!",
382-
"Thanks"
383-
],
384-
"answer": "You're welcome.",
385-
"score": 100.0,
386-
"id": 75,
387-
"source": "qna_chitchat_Professional.tsv",
388-
"metadata": [
389-
{
390-
"name": "editorial",
391-
"value": "chitchat"
392-
}
393-
],
394-
"context": {
395-
"isContextOnly": false,
396-
"prompts": []
397-
}
398-
}
399-
],
400-
"debugInfo": null,
401-
"activeLearningEnabled": true
402-
}
403-
```
404-
405-
Because the question of `Thank you` exactly matched a Chit-chat question, QnA Maker is completely confident with the score of 100. QnA Maker also returned all the related questions, as well as the metadata property containing the Chit-chat metadata tag information.
406-
407-
## Use cURL with threshold and default answer
294+
## Use threshold and default answer
408295

409296
You can request a minimum threshold for the answer. If the threshold is not met, the default answer is returned.
410297

articles/cognitive-services/QnAMaker/includes/quickstart-test-tool-postman.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ms.service: cognitive-services
88
ms.subservice: luis
99
ms.topic: include
1010
ms.custom: include file
11-
ms.date: 02/08/2020
11+
ms.date: 04/27/2020
1212
ms.author: diberry
1313
---
1414

@@ -35,7 +35,7 @@ Use this procedure to configure Postman, then read each subsequent section to co
3535
|Name|Setting|Purpose and value|
3636
|--|--|--|
3737
|`POST`| `/knowledgebases/replace-with-your-knowledge-base-id/generateAnswer`|This is the HTTP method and route for the URL.|
38-
|`Host`|`https://diberry-qna-s0-s.azurewebsites.net/qnamaker`|This is the host of the URL. Concatenate the Host and Post values to get the complete generateAnswer URL.|
38+
|`Host`|`https://YOUR-RESOURCE_NAME.azurewebsites.net/qnamaker`|This is the host of the URL. Concatenate the Host and Post values to get the complete generateAnswer URL.|
3939
|`Authorization`|`EndpointKey xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`|The header value for to authorize your request to Azure. |
4040
|`Content-type`|`application/json`|The header value for your content.|
4141
||`{"question":"<Your question>"}`|The body of the POST request as a JSON object. This value will change in each following section depending on what the query is meant to do.|

0 commit comments

Comments
 (0)