0

I have been working with the Microsoft Bot Framework v4 and QnA Maker(GA). A problem that I have come across is when the user types a keyword like 'leave absence'. There are 10+ kind of leave absence questions. The QnAMaker will send back the one with the highest score no matter what kind leave it is (not the right answer).

I have a tree to answer question that looks something like this:

Leave of absence

  1. Parental leave
  2. Maternity leave
  3. Care leave
  4. etc.
    Each kind can have one or more related questions and a leave can also have a sub-leave.

When the user ask 'leave absence', the bot should answer: 'Which kind of leave absence' and after the user can ask a question about it.
When the user ask 'How many days can I have for a parental leave', the bot should answer straight from the QnA: 'You can have 10 free days'.

My question is, how can I implement this in v4 so the user can receive the right answer? Is LUIS a option for this? Any suggestions?

Thank you.

Tu Hoang
  • 13
  • 3

1 Answers1

0

Its difficult if you have question after question to ask the user. For this, you may need to have a separate Dialog class with a

List<string>

for the set of questions built on runtime of course. At the end it could return back to the original Dialog class. I have implemented something similar for job openings on different posts. Each post having its own set of questions. The control remains in this QuestionnaireDialog (the separate Dialog class) asking next question once the user answers the current question. I don't think QnA Maker will help on this. I have not seen QnA maker much nor v4. I have done the above on v3 and the intent-response mapping was in a database table. My suggestion is to flatten your structure if possible from multiple levels to just 2-level to avoid the tree.

For eg:

Leaves --> Care Leave --> Medical Care Leave
                      --> Family Care Leave

Change the structure to

Leaves --> Medical Care Leave
       --> Family Care Leave

So that you could manage it with LUIS entities. Simply asking about leaves will bring a response that will have all the type of leaves available and asking specifically about a leave type will bring a different response specific to the type. Again I have done something similar without QnA maker in v3. If you can't flatten the structure then you will probably have to bring in a mixture of the two approaches because you want to respond to user's specific leave type query (LUIS entities) and take user through a questionnaire.

Tony Thomas
  • 398
  • 7
  • 20
  • So the LUIS intents is: showLeaves (for type of leaves available) and specific leave intents like showMedLeave, showFamLeave etc.? If this is your solution, there is also a problem that i encounter because I have multiple question for each type of leaves – Tu Hoang Jan 02 '19 at 07:34
  • I was suggesting about creating an entity for leave types (https://learn.microsoft.com/en-us/azure/cognitive-services/LUIS/luis-concept-entity-types). So you could have same intents against the leave entity. So I could ask "Show my available [Family] leaves" or "Show my available [medical] leaves". Both will point to same intent – Tony Thomas Jan 02 '19 at 09:38
  • And in the intent you can get the entity for a specific answer which I understand. But if the user only types "family leaves", which has multiple question and answer, LUIS will return the highest score.. the answer will me incorrect. Now I have QnaMaker, this is an service like a FaQ where i use those specific question and answers. Is it possible to combine your suggestion with a link to QnA? – Tu Hoang Jan 02 '19 at 17:57
  • In my opinion simply "[family] leaves" should be an utterance for an intent (eg: LeaveTypeDescription) which should respond with a description of the leave type. Then the answer will be correct. This of course needs editing and training in LUIS. I myself am not familiar with QnAMaker but it seems possible to integrate it with LUIS (https://learn.microsoft.com/en-us/azure/cognitive-services/qnamaker/tutorials/integrate-qnamaker-luis) – Tony Thomas Jan 03 '19 at 10:15