Use GPT in a Power Apps canvas app
Your task for this exercise is to create a question answering app by using the AI Builder action AI Reply.
Sign in to Power Apps.
On the left pane, select Apps.
Select New app > Canvas.
Enter Question Answering as the name and then select Tablet or Phone for the format of the app and select Create.
In the Data pane from the left menu, select the Add data drop-down. Search for
AI Reply
under AI models, select the AI Reply AI Builder action to connect it as a data source.From the top ribbon menu, select Insert > Text label. Repeat this step to have two text labels.
Now, Label1 and Label2 should display in your tree view. Move Label1 so that it's above Label2 in the canvas.
Select Label1 from the formula bar and change the Text value from
"Text"
to"Have your question answered"
, and change the font size to21
. Resize the label as needed.From the top ribbon menu, select Insert > Text input.
From the top ribbon menu, select Insert > Button.
Rearrange the controls so Label1 is above TextInput1, and Button1 is below TextInput1. Label2 should be at the bottom. Resize controls as necessary.
Select Button1 in the left pane, and change the Text value from
"Button"
to"Generate Answer"
.Select Button1 in the left pane and then select OnSelect from the dropdown menu.
In the formula bar, enter the following code:
Set(QuestionResult, 'AI Reply'.Predict("Answer the following question in less than a paragraph: " & TextInput1.Text));
With Label2 selected in the left pane. Change the Text value to
QuestionResult.Text
and resize the control as necessary.
Congratulations, you created an app that uses the AI Builder AI Reply capability. In the upper right of the screen, select Save to save all changes in the app, and then select Play to test the application.
Observe the app in action
The following example shows the result of entering What's the tallest mountain in the world?
in the Text input box.
Important
Make sure that AI-generated content is accurate and appropriate before you use it.