Unlock the power of OpenAI's GPT with No-code AI Builder
Tags: beginners, promptengineering, powerfuldevs, azure
Published: 2023-07-04 12:00:52

As you know, Microsoft's <a href="https://learn.microsoft.com/en-us/ai-builder/overview?WT.mc_id=AI-MVP-5003464">AI Builder</a> now <a href="https://cloudblogs.microsoft.com/powerplatform/2023/03/06/build-solutions-faster-with-microsoft-power-platform-and-next-generation-ai/">supports prebuilt Azure OpenAI</a> models, allowing users to easily integrate powerful AI capabilities into their applications and processes without the need for <b>any </b>coding or data science expertise. In this post, we will explore the benefits and potential use cases of leveraging these prebuilt models with AI Builder.

Microsoft's AI Builder simplifies the integration of <a href="https://learn.microsoft.com/azure/cognitive-services/openai/overview?WT.mc_id=AI-MVP-5003464">Azure OpenAI</a> models by providing a user-friendly interface for connecting to the OpenAI API. This enables users to access advanced AI capabilities, such as GPT and incorporate them into their applications and workflows with minimal effort. By utilizing prebuilt Azure OpenAI models, users can add powerful AI-driven features to their applications and processes, such as natural language processing, text generation, and more. This can lead to improved efficiency, better decision-making, and more personalized user experiences.
<h2>Helpful conversational experiences with Power Virtual Agents</h2>
These latest capabilities of Azure OpenAI in AI Builder are native to Power Automate and Power Apps. This basically means that anything in Power Platform can utilise the capabilities of the GPT models without going to external sources. As a result of that, I created a Power Virutal Agents (PVA) bot using the <a href="https://arafattehsin.com/power-virtual-agents-get-the-biggest-update-ever/">unified authoring canvas</a> which calls a Power Automate flow to get the answers from Azure OpenAI 's GPT model.
<blockquote>Recently, I got the access to the prebuilt Azure Open AI models in AI Builder. You may not see this in your environment but you can always sign up for a <a href="https://forms.office.com/Pages/ResponsePage.aspx?id=v4j5cvGGr0GRqy180BHbR2LogRPRiTJDo1Rd8KnmcFRUMzlLTDZVQlJKSzNIWkVCMzE0VDFYVzk2QS4u">limited preview</a>.</blockquote>
In this post, we choose a use-case which normally does not get covered yet it is interesting and demanding. Hence, we will work on a <strong>Handyman Services</strong> business and build a bot around their tasks and related information. I've named this bot as a <strong>HandyBot </strong>and conveniently divided this blog post into two different use-cases. First one is fairly simple while other one is a bit governed. Both are useful in my opinion.
<h3>Power Automate with AI Builder's action</h3>
Let's create a simple flow that accepts a text input from PVA and then uses the latest AI Builder's action of creating a text with GPT on Azure OpenAI Service.

<img class="aligncenter size-full wp-image-31699" src="https://arafattehsin.com/wp-content/uploads/2023/03/AI-Builder-OpenAI-PowerAutomate.png" alt="Power Automate flow with AI Builder's OpenAI action" width="634" height="774" />

Coming back to our bot, we utilise the power of Copilot (Preview) and create a topic and plug it with the flow we created above. We know that our topic is simple but what it helps us in is, writing trigger phrases, which were on point. Below is the video example of it (<em>I try not to use heavy .gifs in my blog posts)</em>

Check out the video [here](https://arafattehsin.com/wp-content/uploads/2023/03/Topic-Creation.webm).

In case you want to test it. You just have to click on the Test button and write your query (just like I did).

<img class="aligncenter size-full wp-image-31706" src="https://arafattehsin.com/wp-content/uploads/2023/03/Test-OpenAI-PVA-e.gif" alt="PVA test with OpenAI's GPT native integration with Power Automate" width="1864" height="962" />

That's how simple it is to integrate GPT without writing a single line of code and connecting to the external sources using Custom Connectors.

One could now argue the use-case, exploitation or vulnerability of this as there's no check and balance in creation and may point at its practicality. <em>I still think it is practical but I will take their point for the sake of an argument. </em>
<h2>Approvals for the social media posts in Teams</h2>
Let's suppose you run a marketing department of a business called <strong>Handyman Services. </strong>Just like any other business, this also needs some social presence, we need to build a Power Virtual Agents bot that'd take a topic from the internal staff in Microsoft Teams, generate a text with GPT and send it for approval before showing it to the internal staff. Once the department lead approves it then the internal staff gets a private message from a Power Automate bot with the generated text. <em>Yes, it could have been improved but you get my point, right?</em>

So first of all, we'd build a flow again. This time, it is going to be a bit different (not a lot) from the last one.

<img class="aligncenter size-full wp-image-31707" src="https://arafattehsin.com/wp-content/uploads/2023/03/SocialHandy-Flow.png" alt="Social Media Post Generation with AI Builder's GPT-3" width="1202" height="899" />

You may notice one obvious hack here that we are using a fixed (or hardcoded) Recipient. Ideally, we should have got the email address from the Power Virtual Agents bot and we should use that email here. Despite the fact that my video walkthrough below shows you that I am passing an email address to the flow, there's a <a href="https://powerusers.microsoft.com/t5/General/If-I-add-user-system-variable-in-PVA-Chatbot-is-not-working-in/m-p/2019583">known bug</a> currently in the authentication part which would restrict us to perform that operation. That is the reason we may go with the hardcoded email address.

Now as the flow is ready, let's see what how we build the Power Virtual Agents bot. We utilise the Copilot feature again as it helps us setup some trigger phrases quickly then we have to just tweak a few things to make it work. You can check the video below for everything I did in PVA.

Check out the video [here](https://arafattehsin.com/wp-content/uploads/2023/03/SocialMediaPostCreation.webm)

Once the bot is created, we may have to go to <strong>Settings ➡️ Security, </strong>choose Authentication and select <strong>Only for Teams. </strong>Now publish the bot.

<img class="aligncenter size-full wp-image-31710" src="https://arafattehsin.com/wp-content/uploads/2023/03/Security-Teams.png" alt="Authentication for Microsoft Teams in PVA" width="1852" height="769" />

&nbsp;
<h3>Internal staff request for social media post</h3>
You have an internal staff named Adele. She works for a marketing department. Now we have this capability to use GPT model for post generation, Adele asks this question to the <strong>HandyBot.</strong>

<img class="aligncenter size-full wp-image-31711" src="https://arafattehsin.com/wp-content/uploads/2023/03/Post-generation-AI.gif" alt="Social media post generation by AI" width="800" height="450" />

Once the post is requested. Your marketing lead receives an approval request.

<img class="aligncenter size-full wp-image-31712" src="https://arafattehsin.com/wp-content/uploads/2023/03/Teams-Approval.png" alt="Teams approval for the social media post generated by AI" width="1411" height="811" />

After the post is approved, Power Automate bot sends a message back to <strong>Adele </strong>with the GPT generated content by AI Builder's Power Automate action.

<img class="aligncenter size-full wp-image-31715" src="https://arafattehsin.com/wp-content/uploads/2023/03/AI-Generated-Content.png" alt="AI Generated content posted by Power Automate bot" width="1492" height="953" />

The integration of Power Virtual Agents with AI Builder (using Azure OpenAI's GPT) marks a significant step forward in the world of chatbots and AI-driven customer support. By leveraging the advanced natural language processing capabilities of GPT, businesses can create chatbots that provide more accurate, context-aware, and human-like responses to user queries. This leads to improved customer satisfaction, reduced burden on support staff, and more efficient operations. As we continue to explore the potential of AI and machine learning, it's exciting to see how innovative solutions like this will shape the future of customer support and user experience.

Until next time.