1

I have a bot which uses LUIS and QnA Maker.

Now, I am able to send queries and get back response in my bot based on the search keyword. But in case my search keyword is used in multiple questions, QnA Maker just retrieves the first matching QnA pair.

Consider below QnA pair:

What is flexible working?   Flexibility to work from home
How to avail flexible working?  Get in touch with manager

If the user types the exact question and hits enter, the response would be the answer which matches the question. But, if the user types flexible working in this case the response would be just the first QnA answer. So in this case I would like retrieve both the questions and throw back to the user as a choice of questions to choose from.

I tried overriding the RespondFromQnAMakerResultAsync and also checked the QnA maker APIs. Unfortunately I didn't find any way to do this.

Any help on this please? Let me know if I can rephrase or clarify more on this.

Nicolas R
  • 13,812
  • 2
  • 28
  • 57
Souvik Ghosh
  • 4,456
  • 13
  • 56
  • 78

1 Answers1

3

in case my search keyword is used in multiple questions, the QnA maker just retrieves the first matching QnA pair

You can try to specify the top parameter for QnAMakerAttribute, which controls the number of answers to return.

The definition of QnAMakerAttribute:

public QnAMakerAttribute(string subscriptionKey, string knowledgebaseId, string defaultMessage = null, double scoreThreshold = 0.3, int top = 1);

In your QnaDialog, you can specify it like this:

public QnaDialog() : base(new QnAMakerService(new QnAMakerAttribute("{subscriptionKey_here}", "{knowledgebaseId_here}", "Sorry, I couldn't find an answer for that", 0.5, 5)))
{
}

Edit:

The above approach worked for me, it can promote questions and show the answer for selected question.

enter image description here

Fei Han
  • 26,415
  • 1
  • 30
  • 41
  • And it would also be great to look at the results and check the scoring – Nicolas R May 14 '18 at 09:24
  • Not the answers. I want to return all the **questions** which matches the search word, in case there are more than one matching question. – Souvik Ghosh May 14 '18 at 09:25
  • In order to return all the questions which matches, you have to use LUIS to recognize the search keyword as intent and then return the questions matching them. Have you tried it? – Jyo Fanidam May 15 '18 at 05:06
  • @JyoFanidam here the user is talking about QnAMaker, there's no need of LUIS to do that. QnAMaker can automatically display several choices as Fei Han showed – Nicolas R May 15 '18 at 07:39
  • May I ask about how to change to carousel ? – Eng Soon Cheah Mar 25 '19 at 02:08