OpenAI is now available in the Power Platform! The new OpenAI model is part of AI Builder and currently in Private Preview!
Anyone can sign up to join the Private Preview. Note that you will need a sandbox environment and the environment/tenant details to join the Private Preview. Once you are added, you can see the new connector within AI Builder then add to Power Apps or Power Automate.
We are going to use the OpenAI Service in AI Builder to build this app to talk to Hashtag!
Check out this video to see the full functionality:
Now, let’s talk about how this app was built. We do not have time to walk through each piece step-by-step but we can cover the highlights. You can also check out the Learn content on using OpenAI in Power Apps.
Prerequisites: Environment with an AI Builder Trial and the OpenAI Preview enabled.
Within your Canvas Power App, you will add new data and Select the OpenAI model under AI Builder. This will allow you to reference the model in Power Fx.
Now you can add a text box to input data and another box to show the response. I created a button to run the model and get the response. Here is a sample formula:
Set(Response, 'Create text with GPT'.Predict(TextInput1.Text))
This will set a new Variable Response to be the GPT Response to the prompt written in TextInput1. Then you can display this.
Next up, we want to synthesize the response so that we can hear Hashtag talk! To do this we are going to use the IBM Watson Text to Speech connector. We could do this with Azure Cognitive Services as well but there was not an existing connector.
To use the IBM Watson Text to Speech connector you will need to create an IBM Cloud Account and enable the free speech synthesizer plan. When you do this you will get an API Key and URL that will be needed when using this connector.
I put this logic in Power Automate. This means that our Power App will call a Flow to generate the audio. Then the audio file is returned and played from the app. We can also use the AI Builder Translation service to translate text in this Flow before we create the audio file.
Here are some screenshots of the Flow in Power Automate:
The code to generate the Audio looks like this: (onSelect for the “Generate Audio” Button)
Set(AudioResponse, 'HashtagSpeaks-GetAudio'.Run(Dropdown1.Selected.Value, Response.Text))
Then the code on the Audio Play bar looks like this: (onSelect for the Audio control)
This is just a quick, fun use case for trying out OpenAI, Independent Connectors, and other AI Builder models! I hope it helps you get started with your Artificial Intelligence journey in the Power Platform. Let me know what other content you would like to see!
One thought on “Ask Hashtag! OpenAI in the Power Platform”