Exercise - Use AI Builder actions in Power Automate

Completed

In this section, you'll discover and use AI Builder actions in Power Automate through the creation of a simple flow.

Prerequisites

  • Access to Power Automate.
  • A license or trial of the AI Builder.
  • An environment with a Microsoft Dataverse database. (Applicable only for work or school accounts).
  • A Microsoft Office 365 account with access to OneDrive for Business and Excel Online (Business).
  • A basic understanding of Power Automate and experience with creating a flow is recommended.

Create a flow from a solution

Start by signing in to Power Automate and then following all instructions in this section.

To add AI Builder actions in a flow, create the flow from a Microsoft Dataverse solution.

  1. Go to Solutions from the navigation bar on the left.

  2. Create a new solution called My AI Builder solution, select a Publisher, and then select Create.

  3. Now select the My AI Builder solution solution to open it.

  4. Select +New > cloud flow in the action bar on the top of the screen. The flow designer screen appears and asks you to choose the trigger action.

    List showing all connectors and triggers.

  5. In the Triggers section, select Manually trigger a flow > + Add an input > Text. Name your input My Text, as shown in the following figure.

    Manually trigger a flow called My Text, and Add an input.

  6. Select + New step. You'll now add an AI Builder action.

Search for and add an AI Builder action

In this example, you'll add the AI Builder action that allows sentiment analysis. Choose one of the following options to help you accomplish this task:

  1. In the search field, enter "Analyze sentiment".

    In Choose an action, search results for Analyze sentiment on the Actions tab.

  2. Open the AI Builder action group.

    Choose an action with A I Builder selected.

    This action group lists all available AI Builder actions. You can pick the action from that page.

    In A I Builder, on the Actions tab, a list of actions includes Predict and Recognize text in an image.

  3. From the available actions, select Analyze positive or negative sentiment in text.

Configure the AI Builder action

Each AI Builder action has different parameters, depending on the underlying model requirements.

For the AI Builder sentiment analysis model, Language and Text are the two mandatory fields to fill in.

  1. In the Language field, select English as the language.

  2. In the Text field, select My Text, which is defined in the trigger action.

    Analyze positive or negative sentiment in text.

    The My Text value will be provided during flow testing, so you don't need to focus on it right now.

  3. Select Save. Your flow is now saved with an autogenerated name. You can change it by selecting the generated name on the upper-left corner of the flow designer screen. Name your flow My AI Builder flow.

Use the model's inference

For this exercise, you'll use a Microsoft Excel file in OneDrive to store the text sentiment that is detected by the AI model.

  1. Create an Excel file named AI Builder results.xlsx in your OneDrive.

  2. In this file, insert a table with two columns and then save the file (make sure that you use the Insert > Table function of Excel).

    Excel file showing inserted table with sortable Column1 and Column2.

  3. In My AI Builder flow, select + New step and then add the Add a row into a table action from Excel Online (Business).

  4. Complete the Location, Document Library, and File fields to point to the Excel file on your machine.

  5. In the Table field, select the name of the table that you created in your Excel file.

  6. In the Column 1 field, add My Text, and in the Column 2 field, add Overall text sentiment.

    Add a row into a table shows My Text in Column1 and Overall text sentiment in Column2.

  7. Select Save.

Test the flow

Before productizing a flow, it's always a good idea to test it during design phase.

  1. Select Test on the upper-right corner of the flow designer screen.

  2. Select Manually - Perform the starting action to trigger it. and the select Save & Test.

  3. Provide the value of the My Text field from the trigger action. This text is what you want to analyze the sentiment for. For this example, we'll enter It was the best sandcastle he had ever seen.

    My text field for trigger with text It was the best sandcastle he had ever seen.

  4. Select Run flow. If your flow ran successfully, you would see all steps shown with a green checkmark.

    Green steps complete. Your flow ran successfully.

  5. You can expand the actions to view the running inputs and outputs of each action, which is a good way to debug your flow.

  6. Check that the line has been correctly added in the Excel file.

    Records appear in the table in the Excel file.

Congratulations, you've successfully created your first AI Builder flow.

For more information, see Use AI Builder in Power Automate.