3

I'd like to have users input a single prompt, like "read me a poem," and have QnA give a different response every time. Ideally, QnA would rotate through a list of responses I've created. Is there any way to do this?

Tyler S
  • 65
  • 7

2 Answers2

2

yes, you can now: they added the param "top" to the JSON object for the POST:

e.g.

{
  "question": "Hi",
  "top": 30,
  "isTest": true,
  "RankerType":"QuestionOnly"
}

POST to QnAMaker API returns (max.) the top 30 answers.

See also https://learn.microsoft.com/en-us/azure/cognitive-services/qnamaker/how-to/improve-knowledge-base#use-the-top-property-in-the-generateanswer-request-to-get-several-matching-answers

electrobabe
  • 1,549
  • 18
  • 17
  • 1
    This answers the question of how to get multiple answers in a single call to the QnA Maker API, but those answers will be from different QnA pairs. Tyler S seems to be asking how to add alternate answers to a single QnA pair, in the same way that you can add alternate questions to a QnA pair. – Kyle Delaney Sep 06 '21 at 17:41
1

That's not really the best use case for QnA maker. QnA Maker enables you to power a question-and-answer service from your semi-structured content like FAQ documents, URLs, and product manuals. The QnA Maker service answers your users' natural language questions by matching it with the best possible answer from the QnAs in your Knowledge base.

What you are looking for can be done with a Chat Bot where you write the logic for rotating responses. Visual Studio has a echoBot sample pre-loaded that can help you get started and we have a good deal of documentation here:

https://learn.microsoft.com/en-us/azure/bot-service/bot-builder-dialog-manage-complex-conversation-flow?view=azure-bot-service-4.0&tabs=csharp

Ken W - Zero Networks
  • 3,533
  • 1
  • 13
  • 18