Create a QnA Bot with a Personality Using Power Virtual Agents in Teams

Bots & AI QnA Maker

Power Virtual Agents are a fantastic tool for creating both simple and complex bots that perform various tasks. Using “Topics” and the intuitive authoring canvas it’s easy for almost anyone to create a bot. Throw in the use of Power Virtual Agents for Microsoft Teams and you can create and use these bots at no additional cost.

However, if you need to create a Question and Answer bot similar to QnA Maker, Power Virtual Agents become cumbersome and slow to build and not ideal to maintain long term. Also, how would you do something like a personality to your Power Virtual Agent similar to what you get with QnA Maker?

Let me explain the potential problem. Power Virtual Agents have “Topics”. A Topic is a workflow performed by a bot that is triggered by specific phrases a user types in. For example, a simple topic is the built-in “Greeting” topic. When a user types in “Hi”, or “Hello”, or any other number of “greetings” phrases the Power Virtual Agent executes the specific greeting workflow (Topic) which simply responds with a greeting to your user.

A QnA bot like one created by using a QnA Maker knowledgebase could have hundreds of questions and answers. Also, with QnA Maker you can give your bot a “personality” meaning it will respond to well over 100 random conversation questions a user might ask. It’s a neat feature and adds a lot of depth to your bot, however, translating this directly to Power Virtual Agents could mean you would have to build and maintain hundreds of Topics to get the same functionality. I mean, every question that has a unique answer would theoretically need to have a Topic? You might be able to pair it down by combining questions and doing some conditional logic, but then you’ve got very cumbersome topics that will be a nightmare to maintain. Plus, if you ever want to update a question or an answer you have to republish the entire bot? Power Virtual Agents at first glance lose their luster.

Not so fast!! There is a super awesome feature in Power Virtual Agents in preview called the “fallback” topic. When enabled, this Topic executes whenever a Power Virtual Agent isn’t sure what the user asked. So, using this fallback topic you can send almost EVERY phrase a user enters to one topic and then handle that phrase using any number of tools to generate and display a response. This adds an amazing amount of power (and value) to your Power Virtual Agents. Now you can create a Power Virtual Agent that handles the complicated process of ordering a product using a “Ordering” topic with complex conditions and prompts AND you can send every other random help question to the fallback topic. This fallback topic can then pass this unrecognized question to a Power Automate flow and the flow can generate the response.

You can actually use the Power Automate flow executed by the fallback topic to call the QnAMaker.ai service! You don’t have to use the QnAMaker.ai service though. You can create the exact same functionality by sending all your questions to the Language Understanding service (LUIS) and then store all your responses for questions in some other platform like maybe…. SharePoint? This would make it super easy to get a powerful QnA bot with a personality AND store the responses in a location where any user with the correct access can maintain the responses. The possibilities just kind of explode from there and creating Question and Answer bots just continue to get easier and easier.

In the videos below I’ll walk you through the steps of using a fallback topic and both QnAMaker.ai and LUIS to create a super cool QnA Bot with personality using Power Virtual Agents. I hope it sparks some ideas for you and your organization!

Create a QnA Bot Using QnA Maker and Power Virtual Agents in Teams
Create a QnA Bot Using LUIS, SharePoint, and Power Virtual Agents in Teams

As mentioned in the second video you can download the files I used for the LUIS Application and the SharePoint List here: https://aka.my/6xY and if you need help setting up LUIS check out: https://docs.microsoft.com/en-us/azure/cognitive-services/luis/sign-in-luis-portal

So, after viewing all of that you may be wondering why you should use Power Virtual Agents (PVAs) at all and not just deploy QnA Maker as a bot in Teams? I mean, you could totally do that. However, here are few reasons I really like the PVA approach:

More bot options. You can create complex “non-QnA” workflows (Topics) as part of your bot using PVA. If you use QnA Maker you are pretty restricted to Questions and Answers (and prompts).

Easier deployment. Using PVAs you can easily publish and deploy your bot without having to mess with Azure Resources. With QnA Maker you still need to host your bot somewhere (typically Azure) and deploy that bot which will be more complicated, and depending on your organization much more red tape.

More control. Using the PVA approach you can enhance your Power Automate flows to log and analyze how your bot is performing, display different results for the same question depending on who asked the question (audiencing), and so much more.

Finally, I like the LUIS/SharePoint approach over the QnA Maker approach for a few additional reasons:

Abilities. LUIS has a lot more functionality when you start digging under the covers (like Entities) and it has a better interface for training your bot to use the correct responses (in my opinion).

Maintainability. Maintaining the bot responses is as simple as updating a SharePoint list item.

Potential Cost. Both QnA Maker and LUIS have free SKUs associated with them, however, should your bot become wildly popular, LUIS is more cost-effective.

Multiple Responses. By storing your responses in a SharePoint list you can actually store multiple responses for the same question and then use metadata to specify the audience for your response. Then when you query the SharePoint list for the correct response you can further filter the query by additional metadata. This is exceptionally cool when you have multiple offices across the world and responses vary by which office the employee works for.

There are just SO many layers to these bots when you really start digging in. I very much hope I’m giving you the tools and knowledge to get started building a bot for your environment today.

Comments are closed.