Use GPT in a Power Apps canvas app

Completed

Your task for this exercise is to create a question answering app by using the AI Builder action AI Reply.

  1. Sign in to Power Apps.

  2. On the left pane, select Apps.

  3. Select New app > Canvas.

  4. Enter Question Answering as the name and then select Tablet or Phone for the format of the app and select Create.

  5. 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.

    Screenshot of the Data pane with Add data selected and the Select a data source dialog with focus on the AI Reply data source AI model.

  6. From the top ribbon menu, select Insert > Text label. Repeat this step to have two text labels.

    Screenshot of the Insert menu expanded to show the Text label option.

    Now, Label1 and Label2 should display in your tree view. Move Label1 so that it's above Label2 in the canvas.

  7. Select Label1 from the formula bar and change the Text value from "Text" to "Have your question answered", and change the font size to 21. Resize the label as needed.

    Screenshot of Label1 with the text value changed.

  8. From the top ribbon menu, select Insert > Text input.

    Screenshot of the Insert menu expanded to show the Text input option.

  9. From the top ribbon menu, select Insert > Button.

    Screenshot of the Insert menu expanded to show the Button option.

  10. Rearrange the controls so Label1 is above TextInput1, and Button1 is below TextInput1. Label2 should be at the bottom. Resize controls as necessary.

  11. Select Button1 in the left pane, and change the Text value from "Button" to "Generate Answer".

    Screenshot of the button selected and its text value changed to Generate Answer.

  12. Select Button1 in the left pane and then select OnSelect from the dropdown menu.

  13. In the formula bar, enter the following code:

    Set(QuestionResult, 'AI Reply'.Predict("Answer the following question in less than a paragraph: " & TextInput1.Text));
    

    Screenshot of the formula in the button's OnSelect option.

  14. With Label2 selected in the left pane. Change the Text value to QuestionResult.Text and resize the control as necessary.

    Screenshot of Label2 selected and the formula filled in.

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.

Screenshot showing the Play and Save buttons in the menu.

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.

Screenshot of the app answering the question of the tallest mountain in the world.

Important

Make sure that AI-generated content is accurate and appropriate before you use it.