Utilizing AI Sentiment Feature in Power Apps: Step-by-Step Guide

In this tutorial, we'll explore step-by-step instructions and empowering you to unlock the full potential of AI prompts for Sentiment Analysis within Power Apps

AI prompts serve as clear instructions that we can provide to Large Language Models (LLMs) yielding improved outcomes. The Power Platform offers a range of prebuilt AI prompts which can be utilised within Power Apps and Power Automate solutions.

The list of pre-built AI Prompts available are,

  • AI Summarise (Summarise text)
  • AI Sentiment (Sentiment Analysis)
  • AI Classify (Classify text)
  • AI Reply (Respond to a complaint)
  • AI Extract (Extract information from text)
  • Custom Prompt (Create text with GPT using a prompt)

Now, let’s explore how to utilise the Sentiment AI prompt within PowerApps to identify the sentiment for given sentence and return the desired the result.

  • To begin, access Microsoft Power Apps studio at https://make.powerapps.com
  • Create a new app in Tablet view and name it as Sentiment Analyzer
  • Once your application is created, navigate to the “Data” option in the left menu.
  • Next, select “Add data” and search for “AI Sentiment” under the data sources.

Since I have activated the Modern controls in PowerApps application, proceed by adding the following controls,

S.NO  Control  Property 
1 Text Canvas Name: lblmInput Text: Enter Sentence to analysis
2 Text Input Name: txtmInput
3 Button Text: Identify Sentiment , Name: btnIdentifySentiment
4 Text canvas Name: lblmOutput
  • In the OnSelect property of a Button control (btnIdentifySentiment), add the following expression,
Set(gbResult,'AI Sentiment'.Predict(txtmInput.Value))

Initiate a global variable named gbResult using Set function and invoke the Predict function of “AI Sentiment” connector. This function fetches the result ans stores it in the newly created variable.

  • Then, choose the Text Canvas control (lblmOutput) control and assign the variable (gbResult) to its Text property by updating the below expression.
If(gbResult.Text = "Positive", "😃 - Happy",If(gbResult.Text = "Negative", "😞 - Sad","😐 - No Idea"))

In conclusion, we can input a sentence into the provided input box and then click the “Identify Sentiment” button. This action initiates the AI sentiment. Prompt model, which subsequently displays the response result in the lblmOutput control.

Shantha Kumar
Shantha Kumar
Articles: 280