JSON text for multiturn QnA Pairs in QnA Maker

QnA Maker supports multiturn question and answer pairs. These are follow-up prompts that the user can click on to find out further information.

Within an assistant the user will be provided with an answer and then following on actions.

Multiturn question and answer pairs can be created via the QnAMaker GUI or via REST web services.

When using the REST method the JSON that is passed to the method needs to be formatted in a specific way. An example of the JSON required for a multiturn question and answer pair with follow ups is shown below.

$Questions is an array of questions that relate to the answers in the QnA Pair

$ShortAnswer is the text of the short answer.

$LinkForMultiTurnAnswer is the text that is shown in the multiturn prompt. Not that this is limited to 50 characters.

$FullAnswer is the longer answer that is returned when the user clicks on the multiturn prompt


            {
                ""add"": 
                {
                ""qnaList"": [{
    ""id"": 0,
    ""answer"": ""$ShortAnswer"",
    ""source"": ""Editorial"",
    ""questions"": [
      $Questions
    ],
    ""context"": {
      ""isContextOnly"": false,
      ""prompts"": [{
        ""displayOrder"": 0,
        ""qnaId"": 0,
        ""qna"": {
          ""id"": 0,
          ""answer"": ""$FullAnswer"",
          ""source"": ""Custom Editorial"",
          ""questions"": [
            ""$Question""
          ],
          ""context"": {
            ""isContextOnly"": true,
            ""prompts"": []
          }
        },
        ""displayText"": ""$LinkForMultiTurnAnswer""
      }]
    }
  }]"

More information about multiturn question and answer pairs and the JSON required can be found at

https://docs.microsoft.com/en-us/azure/cognitive-services/qnamaker/how-to/multiturn-conversation

Leave a Reply