This repository was archived by the owner on Jan 5, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 493
[QnA Maker] Support for multiturn is added #2397
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
c180f26
Support for multiturn is added
gurvsing 5eb016f
Updating tests
gurvsing 9412c7c
Comment fix
gurvsing ef8e36f
Support for multiturn is added
gurvsing 1c6c993
Updating tests
gurvsing 4bcdd25
Comment fix
gurvsing 70eb14c
Comment addressed
gurvsing 66444f9
Merge changes
gurvsing 8c0f6fc
Comment addressed
gurvsing e89ef24
Merge branch 'master' into gurvsing/multiturn
gurvsing 8544fa7
Merge branch 'gurvsing/multiturn' of https://github.com/microsoft/bot…
gurvsing File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Text; | ||
| using Newtonsoft.Json; | ||
|
|
||
| namespace Microsoft.Bot.Builder.AI.QnA | ||
| { | ||
| /// <summary> | ||
| /// Prompt Object. | ||
| /// </summary> | ||
| public class Prompt | ||
| { | ||
| private const int DefaultDisplayOrder = 0; | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets displayOrder - index of the prompt - used in ordering of the prompts. | ||
| /// </summary> | ||
| /// <value>Display order.</value> | ||
| [JsonProperty("displayOrder")] | ||
| public int DisplayOrder { get; set; } = DefaultDisplayOrder; | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets qna id corresponding to the prompt - if QnaId is present, QnADTO object is ignored. | ||
| /// </summary> | ||
| /// <value>QnA Id.</value> | ||
| [JsonProperty("qnaId")] | ||
| public int QnaId { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets displayText - Text displayed to represent a follow up question prompt. | ||
| /// </summary> | ||
| /// <value>Display test.</value> | ||
| [JsonProperty("displayText")] | ||
| public string DisplayText { get; set; } = string.Empty; | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the QnADTO returned from the API. | ||
| /// </summary> | ||
| /// <value> | ||
| /// The QnA DTO. | ||
| /// </value> | ||
| [JsonProperty("qna")] | ||
| public object Qna { get; set; } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
libraries/Microsoft.Bot.Builder.AI.QnA/Models/QnARequestContext.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using System; | ||
| using Newtonsoft.Json; | ||
|
|
||
| namespace Microsoft.Bot.Builder.AI.QnA | ||
| { | ||
| /// <summary> | ||
| /// The context associated with QnA. Used to mark if the current prompt is relevant with a previous question or not. | ||
| /// </summary> | ||
| public class QnARequestContext | ||
| { | ||
| /// <summary> | ||
| /// Gets or sets the previous QnA Id that was returned. | ||
| /// </summary> | ||
| /// <value> | ||
| /// The previous QnA Id. | ||
| /// </value> | ||
| [JsonProperty(PropertyName = "previousQnAId")] | ||
| public int PreviousQnAId { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the previous user query/question. | ||
| /// </summary> | ||
| /// <value> | ||
| /// The previous user query. | ||
| /// </value> | ||
| [JsonProperty(PropertyName = "previousUserQuery")] | ||
| public string PreviousUserQuery { get; set; } = string.Empty; | ||
| } | ||
| } |
23 changes: 23 additions & 0 deletions
23
libraries/Microsoft.Bot.Builder.AI.QnA/Models/QnAResponseContext.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using System; | ||
| using Newtonsoft.Json; | ||
|
|
||
| namespace Microsoft.Bot.Builder.AI.QnA | ||
| { | ||
| /// <summary> | ||
| /// The context associated with QnA. Used to mark if the qna response has related prompts to display. | ||
| /// </summary> | ||
| public class QnAResponseContext | ||
| { | ||
| /// <summary> | ||
| /// Gets or sets the prompts collection of related prompts. | ||
| /// </summary> | ||
| /// <value> | ||
| /// The QnA prompts array. | ||
| /// </value> | ||
| [JsonProperty(PropertyName = "prompts")] | ||
| public Prompt[] Prompts { get; set; } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
tests/Microsoft.Bot.Builder.AI.QnA.Tests/TestData/QnAMaker_ReturnsAnswerWithContext.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| { | ||
| "answers": [ | ||
| { | ||
| "questions": [ | ||
| "Where can I buy cleaning products?" | ||
| ], | ||
| "answer": "Any DIY store", | ||
| "score": 100, | ||
| "id": 55, | ||
| "source": "Editorial", | ||
| "metadata": [], | ||
| "context": { | ||
| "isContextOnly": true, | ||
| "prompts": [] | ||
| } | ||
| } | ||
| ] | ||
| } |
32 changes: 32 additions & 0 deletions
32
tests/Microsoft.Bot.Builder.AI.QnA.Tests/TestData/QnAMaker_ReturnsAnswerWithoutContext.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| { | ||
| "answers": [ | ||
| { | ||
| "questions": [ | ||
| "Where can I buy home appliances?" | ||
| ], | ||
| "answer": "Any Walmart store", | ||
| "score": 68, | ||
| "id": 56, | ||
| "source": "Editorial", | ||
| "metadata": [], | ||
| "context": { | ||
| "isContextOnly": false, | ||
| "prompts": [] | ||
| } | ||
| }, | ||
| { | ||
| "questions": [ | ||
| "Where can I buy cleaning products?" | ||
| ], | ||
| "answer": "Any DIY store", | ||
| "score": 56, | ||
| "id": 55, | ||
| "source": "Editorial", | ||
| "metadata": [], | ||
| "context": { | ||
| "isContextOnly": false, | ||
| "prompts": [] | ||
| } | ||
| } | ||
| ] | ||
| } |
27 changes: 19 additions & 8 deletions
27
tests/Microsoft.Bot.Builder.AI.QnA.Tests/TestData/QnaMaker_ReturnsAnswer.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,25 @@ | ||
| { | ||
| "answers": [ | ||
| { | ||
| "questions": [ | ||
| "how do I clean the stove?" | ||
| ], | ||
| "answer": "BaseCamp: You can use a damp rag to clean around the Power Pack", | ||
| "score": 100, | ||
| "id": 5, | ||
| "source": "Editorial", | ||
| "metadata": [] | ||
| "questions": [ | ||
| "how do I clean the stove?" | ||
| ], | ||
| "answer": "BaseCamp: You can use a damp rag to clean around the Power Pack", | ||
| "score": 100, | ||
| "id": 5, | ||
| "source": "Editorial", | ||
| "metadata": [], | ||
| "context": { | ||
| "isContextOnly": true, | ||
| "prompts": [ | ||
| { | ||
| "displayOrder": 0, | ||
| "qnaId": 55, | ||
| "qna": null, | ||
| "displayText": "Where can I buy?" | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| ] | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.