How do I switch between QnAMaker and Waterfall Dialogs in Python Azure BotFramework SDK?

倾然丶 夕夏残阳落幕 提交于 2020-12-15 06:32:42

问题


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


回答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



来源:https://stackoverflow.com/questions/65086558/how-do-i-switch-between-qnamaker-and-waterfall-dialogs-in-python-azure-botframew

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!