How to Integrate ChatGPT in Power Automate: Step-by-Step Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
using chat DPT in a browser is great but to implement it in Microsoft power automate is awesome here I'll show you how to do it using a rest API call my name is Anna Jensen and I come from I Love Automation in Microsoft power automate we click create we will choose an instant Cloud flow as that is the most simple flow and we want to understand everything about connecting to chat DBT and not necessarily setting it up in an advanced flow so here you click instant Cloud flow and don't worry we can easily build more advanced flows once we understand this here we will call it chat DPT demo and we will manually trigger our flow and we'll click create up here you'll click the trigger click add an input here we will choose text and here we can say something like chat DPT prompt over here we can say ask chat TPT about something and let me just delete this one here so it looks like this then we will use the output of this trigger in our rest API call so click new Step here you will search for an http and go down here and choose this one the method that we want to use that is post since we want to send some data to chat DBT or in our case openai we need a URL and I prepared a helping document for this video you can download it by using the link in the video description below it looks like this let me open it so to get the URL you will mark this address here that is get the newest URL copy that one here the reason is that this URL changes a lot so open up a new tab and paste it in what we're going to do is this URL down here go market control C to copy it back to Power automate Ctrl V paste it in here and just do a backspace so it's not multilined then we need a header here we will put in the authorization so here I write author Rye session like this be careful if you don't write it like this it will not work over here in the value you write Bearer and then space and now we need an API key to get the API key you navigate to this URL up here under API key open a new tab and paste it in here we need to either log in or sign up in case you don't have an account simply just click sign up it's free and you even get free credits once we are logged in it looks like this click create new secret key and copy the key from here back to Power automate so after Bearer and space Ctrl V paste in the key now we need to fill in this body here you can find that in the document as well this is the body that I find worked the best so the configuration that works the best I'll explain what it stands for in a little while now just copy it including this curly bracket in the start and in the end and go back here Ctrl V paste it in here what this is is that we have the model that is text DaVinci 0 0 3 that is a DPT model it's not chat DPT per se but it's built on the same engine then we have a prompt this prompt is the output from our trigger and it could be any trigger we want it or even another action so I delete this input here looks like this then I go over to Dynamic content in case you don't see it it might looks like this so simply just click it again and we will scroll down we call it chat DPT prompt remember otherwise if you haven't named it it will be the input so we're using this output here in our body Max tokens that's a thousand that stands for how many tokens chat DPT should use from your account a thousand tokens is about 750 words you have about 900 000 tokens for free so that is around 700 000 words that's a lot and the temperature is zero that is Randomness in output that can range from 0 to 1 where 0 0 is very low Randomness in output we are very strict chat DPT is not very creative or it doesn't allow chat DBT to be very creative n equals one that is how many completions to generate for each prompt the higher the more completions and the more token you use so be careful I recommend one finally you can Define some words up to four words and if chat DBT face them it will stop using more tokens now let's go test it it's that easy to connect to chat DPT so I save I test manually and then I click here I need a prompt so I'll ask him what's a Json and then I'll run the flow I click done it will usually take like five seven seconds there you go four seconds if I move into this this HTTP here I go down to show row outputs this is the output that we get back it's in the Json format and you can always see this because the curly bracket in the start and in the end the interesting part for us that is in the body here then we move further down tree into choices these choices is an array you can see this by this hard bracket here and here we only have one element in so we want to look in the choices array the first element and then we want to move into text because here we have our result you can see here Json JavaScript object notation is a lightweight blah blah blah so this is what we're going to extract when we want to handle the response from chat DPT it will look like this let me close it and let me click edit here so we choose a new step here we will find a compose and we want to do something with this HTTP in case you want to rename it we could for example click these three dots and click rename then it's more easy that you do it now it could be for example we'll say chat GPT 8 TTP because we will use the name of this one here to grab it so we could of course print out the body but that will print out the entire body here we want to move in and only get the text response from jet DPT we need to create an expression by clicking here then we write to get the output of this chat GPT HTTP I write outputs and here we have the intellisense so I can just press tab then a parentheses a single quotation marks and now we write the name of this action up here so that will be chat DPT we don't use spaces we use underscore like this HTTP like this then we wanted to move into the body and then the choices so I go out here press a question mark have a hard bracket single quotation marks and then I say body forward slash choices like this I want the first element in choices so I go out again and since this is zero indexed we will say 0 to grab the first element if we had two elements and we wanted to grab the second one that would be one and so fourth then we want it to go into text so another hard brackets single quotation marks and then text I can click OK here power automate will sometimes tell you that this is invalid this is just a bug in power automate you can press OK press OK once more it will work now let's go test it and here we click test we will manually test it here I can say what capital in India let's run our flow it will usually run in three to seven seconds now you can see here it took one second for some reason the compose takes a little bit longer oh zero seconds click here and now you can see the capital is new daily but as you can see we have some white spaces unwanted here in the beginning let's go trim that before we're done by handling the output so I go in here what I will recommend here is that you type in trim parentheses start press end on your keyboard or simply just navigate to the end of this expression any parentheses end since power automate oftenberg here what I recommend when you edit these Expressions is to control a control C delete this one over here press the expression again Ctrl V yes I know it sounds silly click ok now we have updated it then we click save we test it here we can ask watch the three most important skills to learn in power automate and you could of course now we just do it manually what you want to do might be to pass emails from customers send it to chat DPT write it into your system called desktop flows or whatever you want the possibilities are endless here we have run it if I go into compose there you go learn more advanced power automate join the I love automation Discord Community with more than 6 000 automation developers it's free and your invitation is right up here
Info
Channel: Anders Jensen
Views: 10,085
Rating: undefined out of 5
Keywords: anders jensen, chatgpt, power automate, microsoft power automate, tutorial, how to use chatgpt in power automate, setup chatgpt in power automate, chatgpt integration with power automate, power automate and chatgpt, invoke an http request power automate, http chatgpt request power automate, http request in power automate, openai
Id: Lyfx3u407q8
Channel Id: undefined
Length: 10min 50sec (650 seconds)
Published: Wed Feb 22 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.