Coze | How to use Workflows

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
so you've been using codes to create an AI chatbot that means that you've given your Bot a Persona using prompts some extra skills or plugins and then also intelligence using knowledge bases however you want to customize it even more so that your Bot knows how to really complete task tailor towards your specific needs so in this video I'm going to show you how to use workflows so that your Bot knows how to complete multi-step task let's head over to the CO's workspace so I can show you how workflows can really enhance your B [Music] all right so I'm creating an NBA bot and the purpose of this spot is to give me the latest information the statistics and the scores of all the NBA games that are happening this season and not only that I'll be able to look at games that happened in the past and previous seasons and also games that are happening in real time so the spot is pretty powerful and workflows are going to help us get there so there's actually no need for me to really even look at ESPN anymore because I have my own personal assistant so if we look at our Persona impr prompts I have a character set with some skills and constraints and over time I'll be able to add more to this to enhance our bot even further so if we look at the skills here we don't have any plugins or workflows right now so the reason why is because we haven't created it yet and also because I want to show you the difference between how this operates without a workflow versus towards the end of the video how it operates when we do add the workflow so let's ask this bot what the scores were for January 20th 2024 and we'll see the difference later on so let's see how this bot generates a response so I do remember watching games on this day and I don't remember any of these games happening the Warriors never played the Rockets and the Lakers did not play the Milwaukee Bucks on this date so this is where workflows are going to come into play we're not sure where this data came from however with workflows we'll be able to set up a multi-step task in order for us to get the most accurate data and deliver it to our user in a uniform way so what we'll do now is we'll go over here to add workflows and we'll create our workflow and we'll name our workflow MBA workflow for now and the description box is a place that you can describe your workflow of course however it uses a large language model to help our workflow understand how it needs to be invoked so we can just say get the latest NBA scores okay so the first thing to understand about workflows are nodes and nodes are the basic unit of what make up workflow and nodes connect to one another in order to get an end result so think of a node as a step that it takes in order to give our user the specific answer that we want so we have our starting node here that it comes with and this starting node is where the user puts an input or the question that they're asking and then the other node that uh the workflow gives us is the end node here and the end node is what produces our output and Returns the value that we're looking for here so that would be our answer now there are a few other nodes that go in between the start node and the end node and if we bring our attention here to the left side we'll see that we have basic nodes so we have our large language model node which invokes a large language model and it can gener generate a response based on the input that we give it and then we also have a prompt that we can have to specify our answer even more and I'll show you how to use that too we also have our code node here which allows you to process an input variable and it will generate a return value so with work flows just keep in mind you don't need to know how to code however it does help a lot if you do have this knowledge because being able to get these specific answers from things like plugins or apis you're going to be required to know how to code or at least understand what's going on to get the results that you want now the next node that we have here are the knowledge nodes and this is a node that uses the knowledge bases that you create and matches information based on what you're asking here and what your inputs are then we also have our if condition and our variable nodes here which are a little bit more related to coding however these are to help with logic so our if condition here will allow us to um actually make some type of decision if something's happening then do this and our variable node here is to help us read and write values so that we can store things and pass them on when we need them to be um so not only do we have these basic nodes we also have plugins that can be nodes and workflows that can also be nodes so you can also use another workflow that you you created as a node itself but in this video we're not going to cover that but uh we're actually going to talk about plugins here so with plugins we have plenty of plugins like Reddit Microsoft Outlook slack Google search you name in however these plugins right here aren't really going to specifically give me what I want so I took my time to create my own plug-in and this plugin connects to an NDA API that I'm able to grab the data that I want so this data consists of games that happened in the past or even games that are happening right now in real time so I'm able to grab the scores and stats and also even see who even officiated the game now I might not need all that information to create this workflow however we're going to use bits and pieces of it all right so let's add our MBA node here from our plugins and we'll just drag it here to the middle now what we'll do is actually name this starting input that we have here and we're just going to name the starting input date because this is where the user is going to be asking their question um so this question is based off of the date that we're going to be sending to this NBA API node that we have here as well so our description we'll just set this simply as what this is going to do it's just going to be taking a date in by a format and the format doesn't really matter because it's going to be running through an llm anyways so it's going to be able to determine the date based on how we rewrite it now the next step is we're going to connect our starting node to our NBA Daily data node that has our NBA plugin in it right so this plugin is already created and it's already looking for this game date here so we're using the game date to determine where uh what games are being played now this game date we're going to reference this to the input that we have from the start node on the date so we're connecting this date this question of what games happen on this date to this NBA node that's actually a plugin that connects to an API and this API has all of the data that we need for games that are happening in real time or games that happened in the past based on the date that we ask now when we use this plug-in here we have this payload with all this data and so for the next step what I'm going to do is I'm going to add a code node here so you can see what it looks like when we connect all this to code and we start to parse out this information the code node requires the most amount of complexity here but it's not required for you to make a workflow I'm still going to show you how to do it anyways because it is important to know the power that this code node can actually bring to your workflow that will then be presented in your Bot so we'll go ahead and we'll connect this daily data node to our code node and I'll use a block of code that I've already created and I'll explain it and go down each line but before we do that let's take a look at these input puts I want to make sure that I am getting the inputs that I need from this NBA Daily data node so I'm going to need a few things let's look through this uh payload that we get so we look through here through date and I definitely want some games all this data from who was the away team to the profiles of the players all the way to the game count as well so let's take this input and we're going to name it games and then we're going to have this reference our NBA Daily data payload and we'll look for here in date and we'll get games and then I'm going to add another input here for the games count so I want to be able to tell my user how many games happened on that day as well because every day is different so I'll take this I'll go to NBA Daily data and then I'll also go to my payload my dat and game count and it's just great because I can go through all these different fields here and customize my response how I want it to look so now that I have these inputs here let's take a look at this code block a bit now this code block all it's telling me is to go through the uh list of games that we have inside of our payload so it'll tell me all the games that are happening create a new array of these games and bring me back the profile the box score who the home team was and who was the away team and here all I'm saying is bring me back the city of the home team and bring me back the name of the home team and the same thing for the away team as well so I'm just going through all this information that's being taken from this node and pass to the code and I'm just splitting it into little tiny chunks so I can only get the information that I'm actually looking for and not a bunch of other things that are not necessary now for this output what I'll do now as well is I'll set up my out outut so that my things that I'm getting as my input from here are going to be passed on to the next node which would be my large language model so I want these same inputs these answers for what were the games and how many games happened and then within that same uh information we're getting from this node we'll get the profile the box score who the home team was and who the way team was and so forth so let's go here and add our games and we'll keep this as a type string right because it's just a text and then we're going to add another one here for game count and we'll change this to a number because just the number of games that we're going to be presenting to the user so the next step is to create a large language model node and put it here in order to connect to our code node because this large language model node is going to be able to take this information that we have in this unreadable format and make it more legible for our user to understand so what I'll do now is I'll take this large language model prompt that I've already created as well and I'll put this inside of our large language model node so let's move things over to the side and we'll connect our nodes together right and let's connect this to the end node here and what I'll do now is change my GPT model to GPT 4 and I can keep the temperature the same but the things that are different is I'm going to this input right is actually going to be referencing our input of the games so I'm going to put games here and then I'm going to reference what I'm getting from this code node it's being passed down so this input that I put here for the games that's getting from the plugin and then it's spitting back out here through this output I want to pass this output all the way to this large language model so let's go here and take from our code I want the games now I have a prompt that I've already written as well and this prompt is just describing what I want this workflow to do with the data that I'm passing to it from the code node now this is just going to be able to tell our uh large language model exactly what we want and it's going to be able to Output inside of our end result a lot better than how it would without this larger language model so for this output I'm just going to custom make this to game results and I'll just do game res for short and I'll keep this as a string because this is just going to be a text again that's going to hold all the information that I want and I'll just say that this is the results of the games okay great so now I have everything ready to go and it's connected to my end node here now my end node is pretty much how I want my result to be formatted here right so I'm already have all the information information that I need and now I'm just being able to present it to the user the way that I want to with this end node and I'm going to take this game result that we have and I'm going to have that as an input but before I do that let's add an answer with a direct answer content as well and this is where we're going to be able to format our response the way we want it to be so we'll take game results let's do game res and I'm going to reference that to what we're getting from our large link model all right I'll also take my date that I'm going to be taking from the user from the beginning right so I have to reference my date from the start and then I also am going to take my game count right so we have our game count because we want to have our amount of games that we're going to present to our user as well and we have our game count is coming from our uh our code all right so now all we need to do is create some type of answer content and we're going to customize how this answer is going to look so um we're going to use these same input fields in order to do that and I've already have this written out here so that when it does print out to the user and they ask hey tell me the scores for this specific date it's going to list it in a way that we have this formatted here so the bot's going to say there were blank amount of games on a certain date here were the results so now we have all these notes connected and let's give it a test run and see how it works so we have this date here we'll submit for the 20th of January and we'll submit it and let's zoom out a bit and we're going to see how this workflow is being used here so we have our starting node is already having a success and our start node again is just taking in our input so we can display our result here and you'll see this just taking in the date right and then we also have our NBA Daily data node and this here is taking in our our game date and it's giving us back this payload and it's letting us know we had eight games on that day here's some highlights here's the away team and all this other information that we're going to need but if you look at how much data is in here there's a lot and we really don't need all of this now this then gets passed to our code node and this is where we take care of truncating that data and making it a lot smaller because we're only asking for the profile the box score who the home team was who the away team was and the amount of games that did happen on that day so we have our display result here and we'll see that we have this input given from this API and look how much longer this is from this input that we're getting from the API or this node and how much shorter it is now when we run it through this code because we're only taking out the information that we want now this is being passed to our large language model node now this large language model node is taking this information from this output and running it through this prompt to make it more readable for us and we show this display result here and we take this input this same output that we get from here it turns into an input and an outputs here are the game results uh the NBA games that happen Milwaukee Bucks Detroit Pistons it shows all these games that happen on this date and notice how this list is a lot shorter now it's only showing these eight games so when we pass this large language model node inputs and outputs to our successful end node we're going to only take out this information that we do want to present to our user the game results the game date and the game count and if we display our results here you'll see that we have it custom made on how we've written here in our answer content and it says there were x amount of games here on this date and it's going to present it in the way that we wanted to so let's go right here and publish our workflow after a successful run that we just have and we can go over here to are bot currently there's no workflows or plugins in this bot it's just powered by a Persona impr prompt at the moment so what I'm going to do now is just compare how this bot responds without a workflow versus how it will respond when we do add the workflow so let's just ask this spot the same question we had before what happens on January 20th tell me the scores and let's see so right now I can already tell you off the bat this Warriors versus Lakers game did not happen on this date and either did this Heat versus 76ers game so I'm not sure where this information is coming from and it doesn't mean that these Bots are not intelligent it's just that it's not tailored for our needs yet and that's where the workflow is come into play so let's see how this looks when we add a workflow now if I go to I created and add my workflow to the space I'll ask this bot the same question again and then we're going to see how this response is completely different now so as you you can see here it's going through the workflow just remember all those nodes that the inputs are being passed from one node to the next all the way to get to the end result and as we look at how this response is we'll see that this is tailored to how we wrote it in our workflow remember we wrote in our workflow that there were going to be a certain amount of games on this date that's how we formatted the text to be and now this workflow is going through the API and the also the code node the large language model all the way to the end to give us the accurate information and the accurate scores that happen on the state so that's the power of workflows right I can specify how I want things to look and tailor make it for my users all right so that's how you use workflows with codes now it's the most advanced feature when it comes to using the platform however you can really see the difference in the quality of the answer your Bot gives when you implement a workflow now if you want to learn more check out our documentation and also join us on Discord keep a lookout for more videos and I'll see you next time
Info
Channel: Coze
Views: 16,128
Rating: undefined out of 5
Keywords: AI, Bots, Discord
Id: kRAObpzYH9g
Channel Id: undefined
Length: 19min 9sec (1149 seconds)
Published: Thu Jan 25 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.