In this blog post, we will explore and understand the AI (Artificial Intelligence) driven Power FX functions in Power Apps / Canvas Apps. Before we begin, ensure that you subscribe to CRM Crate to stay informed about the latest developments in the Power Platform field.
Power FX formulas in Power Apps are the building blocks that allow you to create dynamic and interactive functionalities within your apps. They enable you to perform calculations, manipulate data, and control app behavior based on user input or system events. With Power FX, you can easily customize and enhance your app’s functionality without extensive coding knowledge, making it accessible and efficient for developers and business users alike.
Exploring AI based Power FX functions
Dataverse offers a range of pre-configured AI functions that are ready to use without needing to collect, build, or train data. These prebuilt AI functions can be integrated into your applications and workflows to enhance functionality and simplify processes. They are compatible with canvas apps, AI Builder, and low-code plugins, allowing for seamless integration into your solutions.
Below are the two requisites for leveraging AI functions:
- To incorporate the Environment data source, ensure that you include it in your setup (Add ‘Environment‘ data source in your application). The AI functions are part of the Environment namespace. For instance, instead of calling AISummarize(…), use Environment.AISummarize(…), as detailed in this documentation.
- When using these functions, the arguments should be named columns within a record, provided as the sole argument. Refer to the Syntax section for the column names corresponding to the parameters.
- The output of these functions is always a record containing a single column, as indicated in the Syntax section.
- Keep in mind that these functions are behavior-oriented and cannot be directly utilized in Canvas data flow, such as being inputted into the Text property of a Text control. To work around this, employ the Set function to store the result in a global variable, which can then be utilized elsewhere in your application.
‘AIClassify’ Power Fx Function
AIClassify categorizes text into predefined categories namely “Problem, Billing, How To, Licensing”.
AIClassify( Text, Categories )
Text – Required. A text sentences. The text to classify.
Categories – Required. Single column of table of text categories.
For canvas apps, the return value is in the Classification column.
Set( Result, Environment.AIClassify( {Text:"Your Text", Categories: ["Billing", "Food"]} ).Classification )
‘AIExtract ‘ Power Fx Function
AIExtract is designed to identify and retrieve specific entities, such as registration numbers, phone numbers, or individuals’ names.
AIExtract( Text, Entity )
Text – Required. A text sentences. The text to extract the data from.
Entity – Required. The entity to extract. The name of entity to extract.
For canvas apps, the return value is in the ExtractedData column, a table of zero or more rows of data matching the provided entity.
Set(Result, Environment.AIExtract({Text:"Your Text", Entity: "Organization"}));
Important Note: The AIExtract function is still in development and might not operate properly. We will remove this note when it is ready to use.
‘AIReply’ Power Fx Function
AIReply generates a response to the message you provide. For instance, it can create a response to a customer’s product review.
AIReply( Text )
Text – Required. A text sentence. The text to respond to.
For canvas apps, the return value is in the PreparedResponse column.
Set( Result, Environment.AIReply( {Text:"Your Text"} ).PreparedResponse )
‘AISentiment’ Power Fx Function
AISentiment analyzes the sentiment expressed in the text you provide. For instance, it determines whether a customer review’s sentiment is positive, negative, or neutral.
AISentiment( Text )
Text – Required. The text to analyze for sentiment.
For canvas apps, the return value is in the AnalyzedSentiment column and is “Positive”, “Neutral”, or “Negative”.
Set( Result, Environment.AISentiment( {Text:"Your Text"} ).AnalyzedSentiment )
‘AISummarize ‘ Power Fx Function
AISummarize condenses the text that you input. For instance, this function generates a summary of an email message or a passage from a document.
AISummarize( Text )
Text – Required. The text to summarize.
For canvas apps, the return value is in the SummarizedText column.
Set( Result, Environment.AISummarize( {Text:"Your Text"} ).SummarizedText )
‘AITranslate ‘ Power Fx Function
AITranslate is responsible for translating text from a different language. For instance, this function can translate a customer email or a product review. The source language is automatically detected and doesn’t need to be specified.
AITranslate(Text, TargetLanguage)
Text – Required. The text to translate.
TargetLanguage – The language tag to translate into such as “fr” for French.
For canvas apps, the return value is in the TranslatedText column.
Set( Result, Environment.AITranslate( {Text:"Your Text", Language: "fr"} ).TranslatedText )
In conclusion, the integration of AI-driven functions into Power FX formulas within Power Apps offers numerous benefits. Firstly, it enables enhanced automation and efficiency by automating tasks such as sentiment analysis, translation, summarization, and more. This automation reduces manual effort and increases productivity for app developers and users alike.
Secondly, AI-driven functions bring advanced capabilities to Power Apps, allowing for intelligent decision-making and data processing. This leads to improved insights, better data management, and more informed actions within applications. Overall, the incorporation of AI-driven functions into Power FX formulas significantly enhances the functionality, versatility, and user experience of Power Apps, making them powerful tools for developing modern and intelligent applications.