Power Automate: Create Text With GPT & AI Prompts

Power Automate: Create Text With GPT & AI Prompts

The Power Automate Create Text With GPT action is the easiest way to use ChatGPT AI models inside of a flow. There is no need to setup an Azure Open AI instance or sign up for an Open AI developer account. Simply create a prompt in the new Power Platform AI studio, define the input variables and the output format. Choose which model to use: GPT 3.5 or GPT 4o and then add a single action to your flow. That’s all it takes!

Table of Contents
• Introduction: Parse An Address String And Save To SharePoint ListWrite An AI Prompt To Parse An Address Into JSONAdd An Input Variable To The AI PromptChoose The Output Type And Select A ModelTest The AI Prompt To Parse An Address StringCreate A SharePoint List To Store Parsed Address String ValuesBuild A Power Automate Flow With A Create Text From GPT ActionRun The Power Automate Flow To Save The Address Values To SharePoint




Introduction: Parse An Address String And Save To SharePoint List

A marketing manager has a list of customer addresses that must be saved to a SharePoint list. The manager uses an AI prompt to parse the address into a street address, a city, a state and a zip code.



Then uses Power Automate to save the address details to multiple columns in a SharePoint list.




Write An AI Prompt To Parse An Address Into JSON

Open Power Automate and go to the AI Prompts menu. Start to construct a new prompt by selecting the tile named Create text with GPT using a prompt.



Name the prompt Parse Address String.



Then add this text to the prompt. It tells GPT to output the response as a JSON and which fields to include. Also notice that the State is formatted as a two-character state code.

Parse this single line address into a JSON:

The JSON should have the following fields:
- StreetAddress
- City
- State (This is two-character state code of the address)
- ZipCode




Add An Input Variable To The AI Prompt

We want to pass an Address as a text string into the AI Prompt. Open the Input section of the right menu and add a new input variable named varAddressString.



Include this address as sample data:

8245 James St. Myrtle Beach South Carolina 29577



Then insert the newly created variable into the prompt.



The varAddressString variable should be placed as shown here.




Choose The Output Type And Select A Model

There are two more setup steps we must do before testing the prompt. First, select the output type as JSON.



Then choose the model. The most powerful model currently available in AI Prompts is GPT 4o.




Test The AI Prompt To Parse An Address String

Before we can save the prompt we are required to test it. Press the test prompt button.



The prompt response will appear as a JSON.

{
  "StreetAddress": "8245 James St.",
  "City": "Myrtle Beach",
  "State": "SC",
  "ZipCode": "29577"
}



Then save the custom prompt and close the menu. The prompt now appears in My Prompts tab which means it is ready to be used.




Create A SharePoint List To Store Parsed Address String Values

We need a SharePoint list to store the address data in. Create a new SharePoint list named US Addresses and include the following columns:

  • StreetAddress – single line of text
  • City – single line of text
  • State – single line of text
  • ZipCode – single line of text




Build A Power Automate Flow With A Create Text From GPT Action

With the prompt created, and the SharePoint list setup, we can now create a Power Automate flow to parse an address from a text string string and save the result to a SharePoint list. Start a new flow with a manual trigger.



Add an input to the flow trigger named varAddressString. The user will input the address string text when starting the flow.



Next insert an AI Builder – Create Text With GPT Using A Prompt action. Select the Parse Address String prompt we built earlier and supply the trigger input varAddressString into the varAddressString field



Then use the Create Text With GPT output to create a new SharePoint list item. Add a SharePoint – Create Item action, select the US Addresses list and supply the StreetAddress, City, State and ZipCode.




Run The Power Automate Flow To Save The Address Values To SharePoint

Test the flow to ensure it works. Input a valid US Address into the varAddressString field and select run flow.



The flow uses the address string to create text with a GPT using a prompt…



…and saves the output to a SharePoint list.





Questions?

If you have any questions or feedback about Power Automate: Create Text With GPT & AI Prompts please leave a message in the comments section below. You can post using your email address and are not required to create an account to join the discussion.

Matthew Devaney

Subscribe
Notify of
guest

5 Comments
Oldest
Newest
Inline Feedbacks
View all comments
Arild Aarnes
1 day ago

Thanks Matthew, good example of using AI prompts in Power Automate. This is a really powerful tool that have a lot of different applications in Power Automate. Worth noting that using GPT 4o is 10 times more expensive than GPT 3.5.

Phil Nichols
Phil Nichols
1 day ago

How does the licensing work for this? Do you use your own ChatGPT API access or is it paid for through MS? Does a user need a premium license?

Phil Nichols
Phil Nichols
8 hours ago

Thanks for the info!