Botbuilder-samples: 49.qnamaker-all-features [nodejs]: make QnAMakerBaseDialog a component dialog again.

Created on 26 Nov 2020  路  12Comments  路  Source: microsoft/BotBuilder-Samples

Before #2289, QnAMakerBaseDialog was a componentdialog with a four step waterfall dialog. This allowed me for instance to start a dialog in stead of showing an answercard.

In the most recent version of this sample, QnAMakerBaseDialog is 'extending' QnAMakerDialog which is in a module called botbuilder-ai. As a result it is now hard (at least for me) to modidy the behavior of a Qna-bot.

Also, in the utils folder of the sample, there is a qnaCardBuilder.js. I do not think this specific file is used by the QnAMakerDialog in bobuilder-ai.

Bot Services Support customer-replied-to customer-reported

Most helpful comment

For requirements 1 & 2: Yes that sounds accurate.
wrt the designprocess: not sure yet. The waterfall helps me to understand what is actually happening and provides more room for customization (adding my own stuff). Guess that is part of the purpose of a sample: providing a head start.

All 12 comments

Just to clearify. Modifications that I need to be able to implement are for instance:

-1 In stead of providing an answer, startt a dialog
-2 Add the source to the answers given by QNAMaker
-3 Make adjustments to suggestions card

@mrivera-ms can you comment on this?

@HesselWellema could you clarify on the three scenarios you mentioned:

Just to clearify. Modifications that I need to be able to implement are for instance:

-1 In stead of providing an answer, startt a dialog
-2 Add the source to the answers given by QNAMaker
-3 Make adjustments to suggestions card

  1. Are you trying to start another dialog and then call QnAMaker? This should be possible through modifying the RootDialog
  2. I'm not sure I understand this, are you referring to modifying the answers provided by QnAMaker before forwarding them to the user?
  3. Unfortunately, the implementation of QnAMakerDialog doesn't provide a way to inject your own card builder or modify the suggestions card. You could create a SendActivityHandler to modify the outgoing activity.

Hi @stevengum,

Thanks for your reply.

wrt 1. For now I use QnaMaker for most of my bots. My customers usually need a qna bot with some additional, customer specific, dialogs. Lets say they need a complaint registration process). Working with the old sample, I would implement this by creating a question-answer pair for filing a complaint. The answer would be something like #complaint. In the checkForMultiTurnPrompt step I would check for this answer and start a component dialog from there (and end the QnAMakerBaseDialog. With the current sample, I don't know how to addres this. I tried to use the old sample with the new Managed QNA service (I need that because I am working on a multi-lingual bot)but that doesn't work. This results in an error as soon as this._qnaMakerService is called (I don't recall the exact error message).

wrt2. I implemented a chatbot to help people figure out what the latest measures are wrt to the Covid virus. Since the information is scattered over multiple websites anc changes a lot, this is a perfect usecase for QnaMaker. With the old sample, It was easy to add the source to an answer so people could check in the original source. With the new sample, I do not know how to do this.

wrt 3. Good one. I will look into middleware.

Hope this all makes sense.

Thank you for clarifying @HesselWellema.

For item 2, does it make sense to modify the QnA Knowledge Base or are you saying that the answers remain the same but the location of information changes?

For item 1, I'll have to investigate the new implementation to see if it's possible to do what you're asking for.

tnx. Wrt your suggestion for item 2. I'm afraid that will not work in my case. The bot is using 100+ different ur's and I retrain the database every three days (covid measures change a lot over here) resulting in over 2.500 qna pairs. This is not a hazzle-free process as you might guess (I can only train 10 url at a time). Adding the source to each pair manually takes to much time.

@HesselWellema at the moment I'm cleaning up the sample to _hopefully_ address some of the extensibility issues, but I fear a deeper rewrite of the QnAMakerDialog class in the SDKs is necessary. I'll keep you updated.

@HesselWellema, did the middleware/SendActivityHandler suggestion help with addressing the 3rd requirement?

@stevengum. Thanks for asking. I did not implement it but trust that I will be ok. Did something like that in another project

@HesselWellema, sorry for the back and forth, thank you for your patience and understanding.

For requirements 1 & 2 in your comment it sounds like you need an "QnAMakerDialog.onAnswer" hook in the existing QnAMakerDialog. This hook(s) would allow you to modify the dialog's outgoing activity/answer(s). Does this sound accurate

For requirement 3, passing in a custom QnACardBuilder to the SDK's QnAMakerDialog instead of the SDK using a static helper would suffice.

To aid in the design process, are there other specific benefits that you would get in your scenarios by having a QnAMakerDialog class that subclasses ComponentDialog rather than WaterfallDialog?

@sahithikkss FYI

For requirements 1 & 2: Yes that sounds accurate.
wrt the designprocess: not sure yet. The waterfall helps me to understand what is actually happening and provides more room for customization (adding my own stuff). Guess that is part of the purpose of a sample: providing a head start.

@stevengum Hi, do I need to create a feature request for the QnAMakerDialog.onAnswer hook you suggested?

Was this page helpful?
0 / 5 - 0 ratings