top of page
Writer's pictureEd G.

Hungry Teams v2.0 (Power Virtual Agents)

I had submitted a version of this post as a session for Power Platform World Tour in Portland, with the idea that it would be an excellent way to introduce chatbots, natural language concepts, and adaptive cards to the code-averse. It was instantly outdated, however, when Microsoft announced Power Virtual Agents during Ignite.

Power Virtual Agents offer a mostly no-code solution for chatbots, and incorporate natural language, conversational threading, all through an easy-to-use user interface. The setup was so simple, I couldn't avoid pivoting my original talk to focus more on Power VA.


Let's get started.


When you log in to powerva.microsoft.com for the first time (using your regular credentials), you'll be asked to give your bot a name. Charles Sterling and Brian Dang both agree this is the hardest part about creating a Power Virtual Agent. I just go with days of the week, so today's bot is "Saturday". While you're waiting for your bot to build, we'll talk about the different aspects.

Message showing "Creating your bot" - Usually hangs out for about 5 minutes.
You'll see this in the top right for a little while.

Topics are the equivalent of LUIS.ai "Intents". These are the individual tasks or questions you would work within. A bot can have multiple topics, and each topic can follow many conversational paths, so you can see there is room to do some very robust work.

The bot will come pre-loaded with a few "User Topics" and a bunch of "System Topics". Each of these will have a series of "Trigger Phrases" which will fire off the Topic or intent.


(note that you can't add your own Topic until your bot is done assembling itself)


Trigger Phrases look to be the same as "Utterances" in that they are the words and phrases used to indicate which topic should be triggered. Because Power VA is asking for 5-10 examples, I believe it is using the same natural language understanding engine as LUIS and will improve as it is used. The piece I haven't been able to find yet is where I can help train the model by assigning unassigned utterances to a topic/intent (something you can do in Luis).


Entities are a way for the bot to understand the context of the conversation. The example in the documentation cites "I tried to use my gift card but it doesn't work" and the bot is able to route the user to the topic related to gift cards not working—even if that exact phrase isn't listed as a trigger phrase. The piece that allows this to function is the relevance of entities. "An entity can be viewed as an information unit that represents a certain type of a real-world subject, like a phone number, zip code, city, or even a person's name."

 

Your bot should be ready by now, and we can start building a new topic. Click New Topic at the top and give it a name and some sample phrases.

From there, click on the "Go to authoring canvas" to start building what will happen if this topic is triggered. You can see that your trigger phrases are pre-defined at the top, and it's up to you to add the next action. Because I am rebuilding my "Eat Like Ed" flow, I'll want to find the user's location to determine where to search in Yelp. If we hover over the line coming down from the trigger, a + will appear and we can have Power VA "Ask a question".

Under "Identify", you'll be able to select the appropriate entity for the expected response. This helps Power VA determine the correct value even if the response includes more than just the city name. For example, if the bot asks where to look and the response is "I am in Irvine, CA right now", it will know that "Irvine, CA" is the thing to pass through, not the rest of the sentence.

You can even rename the variable it assigns the value to by clicking on the "edit" pencil at the bottom. I renamed this one varCity. Now the fun part: Integrating with Power Automate... Hover over the line out of your Question step, and this time select "Call an Action" and then "Create a Flow". This opens up a window in Power Automate with some prefilled steps.

 

When you kick off building the flow from inside Power VA, it has templates in there to help you with inputs and outputs. Since our flow will need a city as an input (string) and push out a restaurant name (also a string), we can edit the suggested schema to accommodate that (totally not as scary as it sounds). In the trigger, the suggested schema includes a string and a number. We only need the string, so we are going to delete the bit about the number (blue selection), and then rename the string part (yellow highlight) to "CityName".

I won't need the variables, so we can delete both of those. And then immediately after the trigger, I'll add the HTTP GET and Parse JSON from this flow. This will return a multi-level array which we will use to pull out the restaurant name, using a simple expression inside a Compose action. Here is the flow so far, with the expression in the comment of the Compose:


first(body('Parse_Yelp_Results')?['businesses'])?['name']

The default output from the flow template also includes a string and a number. I spent a BUNCH of time editing the Body of the output before realizing that I needed to click "Show advanced options" and make changes to the schema before anything would show in my bot.


Clicking on that, and removing the output number and renaming the output string to be "RestaurantName", you should end up with this as your schema:



You'll also still want to edit the body so that it just has the basics as shown to the right.


Once you're done, we need to add the flow to a solution so Power Virtual Agent will see it, so save your work and then click on Solutions along the left rail of the Power Automate work area.

 

Adding a new solution is simply a matter of clicking "New Solution" at the top left, filling out the basics (use "default publisher for <environment>" for now) and 1.0 for Version. This will create a solution space where you can now click on "Add Existing" and then "Flow", then "Outside Solutions" to find and select the flow you just built. Back in your Power VA authoring canvas, when you go to add an action, you should now see your flow that is inside the solution. Note that it lets you know ahead of time how many inputs and how many outputs the flow has.

Dropping that in, you'll be able to assign the variable "varCity" to the input to pass to Power Automate and then serve a response with the output.








Adding a final step to end the conversation with a survey should allow users to let you know how the bot is working. Finish by publishing your bot on the Publish screen (left rail) and then test it on the demo website (you can also test your bot in real-time from within the authoring canvas).

Here is the demo website with an exchange already in there. I triggered this one with "Let's Eat" and the natural language was able to recognize that and offer the correct topic. I also assume the survey at the end is taking the place of the Luis intent corrections and helping to improve the model.

In the next article, I'll show how to integrate this bot into Microsoft Teams for further testing.

Even though there were a few expressions and some JSON editing, I think this is well within the reach of the code-averse. It took more time for me to figure out the formatting of the First() function than it did to build the rest of the bot. I think you'll have fun previewing this new feature, and hope you'll get in and make some mistakes. Try. Fail. Learn. Repeat.

467 views0 comments

Comments

Rated 0 out of 5 stars.
No ratings yet

Add a rating
bottom of page