0

Dear Community,

Please help with the Azure BotFramework Python SDK flow implementation I have described below.

Step 1 : I need my bot to ask a question initially when members are added i.e

async def on_members_added_activity(
    self, members_added: [ChannelAccount], turn_context: TurnContext
):
    for member in members_added:
        if member.id != turn_context.activity.recipient.id:
            await turn_context.send_activity(
                "Welcome to the Sample Bot! May I help you with something?"
            )

*This is the 'Welcome Prompt' - "Welcome to the Sample Bot! May I help you with something?"

Step 2: If the response from the user for the 'Welcome Prompt' is 'Yes':

  • I need to call QnAMaker and let the user ask a question. After QnAMaker should answers the question from the Knowledge Base, I need to prompt the user again and check if the user needs another query answered. (This is the 'More Help Prompt')

Step 2: If the response to the 'More Help Prompt' is 'Yes':

  • Repeat Step 2

Step 3: else if the response to the initial 'Welcome Prompt' or the 'More Help Prompt' is 'No':

  • I need to run a Waterfall Dialog and prompt the user for getting various inputs in a sequential manner. Ex: Name, Age etc.

I don't mind if the flow isn't exactly as described above. The prompts can be anywhere or structured differently and I just need the QnaMaker and Dialog triggering and switching to work.

Any help in calling QnaMaker from Waterflow Dialog will also be appreciated.

I found these implemented in the C# and JavaScript SDKs but, couldn't get a reference code in Python.

Thanks in advance for the help.

Edit:

Adding links of C# and JS references which may help.

How to call QnA Maker on a waterfall dialog using C#?

https://github.com/microsoft/BotBuilder-Samples/tree/main/samples/csharp_dotnetcore/49.qnamaker-all-features

https://github.com/microsoft/BotBuilder-Samples/tree/main/samples/javascript_nodejs/49.qnamaker-all-features

Swishonary
  • 93
  • 1
  • 6
  • 1
    Could you link to the C# and JS implementations? – Kyle Delaney Dec 01 '20 at 19:25
  • Done. I've added the references as an edit. Thanks! I'll keep updating if I find more. – Swishonary Dec 02 '20 at 05:42
  • I can see that you linked to sample 49 as an example of a solution to your problem in C# and JavaScript. Ram pointed out that the sample is also in Python. Does that answer your question? – Kyle Delaney Dec 19 '20 at 00:26
  • I believe this example doesn't fully demonstrate how to switch between QnA and a dialog flow. A little help with some explanation on this or a better example would be very helpful. Thank you. – Swishonary Dec 22 '20 at 08:52
  • Can you explain what problems you're having trying to use QnA Maker in waterfall dialogs? As explained in the answer you linked to, there's no trick to this. It's easy to run a QnA Maker dialog, and it's easy to run a waterfall dialog, and if you can do both of those separately then it's easy to put them together. I don't really know how to answer your question since it sounds like you're just asking us to write your bot for you. Please show us what you've tried so far so we can an idea of what the problem is. – Kyle Delaney Jan 01 '21 at 01:07

1 Answers1

1

The Bot Framework SDK v4 is delivered as an open source SDK on GitHub, targeting .NET, JavaScript, Python, and Java.

Reference code using python SDK: https://github.com/microsoft/BotBuilder-Samples/tree/main/samples/python/49.qnamaker-all-features

Ram
  • 2,459
  • 1
  • 7
  • 14
  • Hi @ram-msft Thanks for your response. This particular example has the QnA Maker being called from the app.py file and it doesn't really demonstrate switching back and forth between the QnA Maker and the Waterfall dialog. Please correct me if I'm wrong. A little more explanation as to how that can be done or even the mechanism used in this example would be a huge help!. Thank you! – Swishonary Dec 22 '20 at 08:47