Use your prompt in Power Automate
You can add a prompt as an action in a Power Automate flow so it's possible to generate text from it inside an automated process.
Important
- AI Builder prompts are running on GPT 4o Mini and GPT 4o model versions powered by Azure OpenAI Service.
- This capability is limited to some regions.
- This capability might be subject to usage limits or capacity throttling.
Use an existing prompt in a flow
Prerequisite: You created a prompt named Task Identifier that has one input called Text, as described in Create a custom prompt.
Sign in to Power Automate.
Select +Create > Instant cloud flow.
Name the flow Task ID.
Select Manually trigger a flow > Create.
In the designer, select manually trigger a flow.
On the Parameters tab to the left, select +Add an input.
Select Text, and then enter a name.
In the designer, select +Insert a new step after Manually trigger a flow.
On the left pane in the Search field, enter GPT and select the action Create text with GPT using a prompt.
On the left pane in the Name field, choose your custom prompt from the dropdown menu.
The following example uses Task Identifier as the custom prompt. Task Identifier is a custom prompt that was previously built.
On the left pane in the Input Text field, select Input Text from the Dynamic content list to the right.
Create a new prompt in a flow
Sign in to Power Automate.
Select +Create > Instant cloud flow.
In the designer, select +Insert a new step after Manually trigger a flow.
On the left pane in the Search field, enter GPT and select the action Create text with GPT using a prompt.
On the left pane in the Name field, select New custom prompt from the dropdown menu.
To create your prompt instructions, follow the instruction from Create a custom prompt.
Save your prompt and follow the instructions to use your prompt in a flow.
Use the output of the GPT action
The Create text with GPT using a prompt action generates a flow variable called Text, which represents the output of your prompt generated by the GPT model. You can use this variable at your convenience in downstream actions.
For example, let's send a Teams message that encompasses the Text variable:
In the designer, select +Insert a new step after the Create text with GPT using a prompt action.
Search for the action Post message in a chat or channel and select it.
Fill in the parameters, making sure you select the Text variable in the body of the Teams message.
Once you're satisfied with your flow, you can save it and select Test on the top right corner.
Make sure to enter values for the input variables that would be used in your flow, and then select Run flow.
Visualize the message received in Teams.
Incorporate human review
Having humans review the output generated by the GPT model allow an organization to ensure that this output is of high quality, aligns with ethical standards, and meets specific requirements. This combination of AI and human oversight optimizes processes and enhances overall outcomes. Learn why human review is important.
This section explains how to add a human review step after the prompt action in a flow.
In the designer after the Create text with GPT using a prompt card, select +Insert a new step.
On the left pane in the Search field, enter Approvals.
To the right of the Approvals heading, select See more.
Select Start and wait for an approval of text.
Fill in the following Approval parameters:
- In the Title field, enter a title.
- In the Suggested Text field, select Text from the dynamic content list.
- In the Assigned To field, enter an email address.
In the designer after the Start and wait for an approval of text card, select Add an action.
On the left pane, search the control Condition and fill-in the following parameters:
- In Condition Expression, select Outcome from the dynamic content list.
- Next to Outcome, select is equal to from the dropdown list.
- Next to is equal to, enter Approve.
In the designer under Condition in the True branch, select +Insert a new step.
On the left pane, search Teams and select Post message in a chat or channel.
On the Parameters tab, do the following:
- In the Post as field, select Flow bot.
- In the Post in field, select Chat with flow bot.
- In the Recipient field, enter an email address.
- In the Message field, select Accepted text from the dynamic content list.
Select Save.
Once the flow runs and an approval is generated, the assigned reviewers can check the text generated by the GPT model from the Approvals menu in the Power Automate portal:
From the left pane, select Approvals, and then select the Received tab.
Open the approval to review and edit the text if needed.
From the dropdown menu, choose your response.
Select Confirm.