Skip to content

Power Automate

Power Automate: Create Text With GPT & AI Prompts

Power Automate: Create Text With GPT & AI Prompts Posted by - Matthew Devaney on - October 13, 2024 8 Comments The Power Automate Create Text With GPT action...

Matthew Devaney
Published
Reading time
5 min read

Before you start

Is this guide for you?

Best entry point
Power Automate
Time investment
5 min read

Imported reference from Matthew Devaney's blog for learning purposes. Original: https://www.matthewdevaney.com/power-automate-create-text-with-gpt-ai-prompts/. Author: Matthew Devaney.

Power Automate: Create Text With GPT & AI Prompts Posted by - Matthew Devaney on - October 13, 2024 8 Comments

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 List

Write An AI Prompt To Parse An Address Into JSON

“>Add An Input Variable To The AI Prompt

Choose The Output Type And Select A Model

Test The AI Prompt To Parse An Address String

Create A SharePoint List To Store Parsed Address String Values

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

Run 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 Code language: JavaScript ( javascript ) 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" } Code language: JSON / JSON with Comments ( json )

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. Did You Enjoy This Article? 😺

Subscribe to get new Copilot Studio articles sent to your inbox each week for FREE Enter your email address Sign Me Up 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 Power Automate

Save Docusign Document To SharePoint With Power Automate

Share this

Tagged

Power Automate

Have a Microsoft 365 topic idea?

Share article suggestions, community session ideas, corrections, or real-world scenarios for future nextM365 learning notes.

Suggest a topic

Keep learning Microsoft 365

Explore more practical guides for SharePoint, Power Platform, Copilot Studio, migration, automation, governance, and security.

Continue learning

Next action

What to do next

Browse all tutorials →