How to Use AutoGen & GPT-4 to Create Multiple AI Agents

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
so autogen is here and it is amazing autogen is actually a new state-of-the-art framework to create AI multi-agent teams because right now you can think of the AI assistance as a team of assistant or team of AI agents and when you think about it like AI agents are better than standalone L like CH GPT or basically GPT 3.5 and I talked about AI agents in my previous video so you can just have a look how to build your first AI agent with L chain and then you can take your AI agents to the next level by creating multiple AI agents working together and the results are almost always better because those agents like correct each other and and help each other improve the final results and right now the autogen it it has the edge over the other Frameworks to to build AI agents because mainly because of four features that it has and one of them is the complete flexibility so actually you can build the agents and they are so customizable so you decide on the size of the team and the roles and how the charts uh how the groups of uh agents that how the teams are created and how they interact with each other and so to summarize you decide how many agents you've got in your team how much autonomy they have and I I'll talk about autonomy later and what type of assistance do you need so what are the specializations of each um assistant and who can talk with so we can see it here and there is another example uh like here are some examples of how they can work together and different types of of uh joining uh the agents with each other and the other feature is the uh human participation so in other AI agent based projects such as Auto GPT or GPT engineer uh you just gave your agents initial instructions and they delivered the final results sometimes they asked for more clarification but it was always on the beginning of the conversation and then you were just waiting until the agents were done and you saw the final results and autogen has changed that and it's added the um human participation um thanks to this user proxy agent and you've got this human input mode you can set it to never or always or terminate but with autogen you as a user can give feedback to the partial result and by giving feedback I mean you can just correct suggest Improvement or ask for even ask for more features like you didn't think about something in your initial prompt but then you thought okay the your the the results will be improved if I add something new and you can always just give it to them to change the final results that you want to get and then this multi- the third feature is this multi-agent conversations as I mentioned with multiple AI agents working together the results are almost certainly better and they almost must be better and in autogen you you can create group chat and you can think of of it as a team of AI assistants and you can take it like to you can think of them as a team as a normal team that you see in a workplace but the set of human you've got powerful large language models such as gbt 4 so uh it's up to you how your team will be structured and how many members are they and what's the special specialization for each of them and then again you've got the fourth feature is this flexible autonomy and thanks to the user proxy agent you decide how much autonomy the agent has and and the just to clarify the user proxy agent it talks to assistants on behalf of you or and you are the user and it always gives the instructions to the assistants and as a cool feature it is able to execute python code and so then you you can decide again how much aut autonomy you give it you give to it and from the documentation you've got this uh human input mode and you can set it to always terminate or never and always it means that you don't give the autonomy to you to the user actually so um when assistants are finished with with something and they want to ask you for feedback they always ask you and with terminate you um it's conditional so sometimes um the user proxy agent will talk to the assistants without asking you for permission and some times they want it depends on the conditions that is set and there's never it means that uh you just give the full autonomy to the user proxy agent and it'll finish the task for you by cooperating with other assistants and it'll just deliver the final results and just to mention about assistant agents they are able to to write code they are able to write text so it's just like standard GPT alone but you can create as many of them as you want and then they can talk to each other and help each other to get the optimal results that you want and there are those group chat managers that um that is a leader of team uh of the team of assistants and just to double down or even triple down on that AI agents working together give the best possible results that we can get to get today from large language models these four features combined have created this amazing framework that is Cap capable of generating Next Level applications and that's what they claim here and I mean if you go to auto gen to the documentation it says uh enabl speing next gen llm applications based on multi-agent conversations with minimal effort so I hope uh I hope you're excited to see how it works and just so we know autogen is on GitHub so you can easily install it on your computer and I will provide the link in the Des description and now I want to show you one of the examples and it is actually taken from from the documentation and I will also give you the link but you've got the examples here and when you go here you see uh many many examples and you can run them in col not notebooks and I'm using the first one and I just clicked on it and then you can click on opening collab and that's what I did and it explains step by step how to uh how to run autogen and you and I've just decided to use a slightly different uh example to differentiate slightly from what everybody's showing because everybody's showing these stock prices but let's let me just uh go through the uh collab notebook uh with you maybe I will increase even slightly more so pretty much uh the first thing you need to do is just to install autogen and then uh you need to set up the config this is how you can do it uh this is one example of uh how you can do it using uh this file because uh the autogen automatically looks for this file or maybe first for the N variable called oi um sorry called oi config list when it's not found it looks for the file and that's how you can set it up uh but in my example I'm just using the config list um like is directly in my python code this is the my model gbt 4 and my API key uh but then yeah then you just again as I mentioned you work with uh mainly with two types of agents and those will be uh user proxy and AI assistant again they are shown H here assistant agent and user proxy agent and and again you just uh generate it like this you say it's assistant agent you give it a name and then you apply your H config list and this is the config list uh I gave it here and this SE and temperature are here only to make it make this call up notebook reproducible and maybe what's important to mention I'm using uh GPT 4 because the results are much better and uh gp4 is uh much more capable than GPT 3.5 turbo but it has a huge huge downside I have to say it immediately I've run multiple tests today and I'm already at four over $4 only for today for running the code like 15 times so you can use GPT 3.5 to make it like 40 times cheaper but uh but the results won't be as good or maybe it even won't be able to solve uh the task that you give it but there is a work around to that you can just create like several agents several assistants and each of them would specialize with something else and for this project we just have our user proxy agent and one and a single assistant uh in the user proxy agent we've got this uh human input mode to uh set to never so I just want uh my user proxy agent and AI assistant working together to to give me the results that I'm expecting and without my participation and then there is like how many uh repes maximal repes there can be and this is this termination uh message which usually ends with terminate and then there's this code execution config and the directory is called coding and as you can see um it's generated I didn't create this folder it's called coding uh so when I got the result I got the uh it's created this uh coding directory and use Docker to false and they really advise to use uh to set it to true because you execute python code Okay cool so let's move to the example and I've just I just thought thought about this like what date is today it is this question is here only to help the agents realize it's not 2021 anymore and plot the dollar to euro exchange change price this year every day and I really really wanted to work with some weather data to also show something on a like time series but it failed so I just used this uh this example so give me dollar to your Exchange price and how does it work so my user proxy H has taken my message and pass it to the assistant and the assistant just starts working and first uh it goes to the current date using Python and it's generated a short python script to get today's date uh but again assistant isn't able to execute code so it just passes this code to assistant and it just says okay when you run it it will print today's date and next we need to get this this historical exchange rates from USD to Euro for this year and it's decided to use this Forex python library and it wants us to run to install this library and then it generating the python code so it's getting those currency rates and then set some dates and so on and here car where what it's uh try plot uh this time series I asked for and right now it returns this it says what this code should do and it Returns the code to my user proxy and user proxy has is able to execute code again so it's tried to execute and it's got some uh execution fail failures first it's generated this today's date so the first part uh no not this one um so it's uh run it's executed this code and it got the results okay today is um 11th of October which it is and then it's collecting the Forex python because our code says install Forex python is done without my interactions so uh the user proxy does it all for me and when the packages are installed it runs the code and it says uh date is not defined and then the user proxy just says to assistant okay H just fix this problem and assistant says okay I apologize for the oversight and it figures out why this uh problem occurs and it says okay the dat function was not recognized uh and it says okay the date function was important in the first part of the code but not in the second part so it's basically forgotten about the date and it's corrected this mistake by importing the date and it's run the code again but this time there was another problem like there was this uh dat data was not available for some dates uh and it run to the errors and the assistant decided to modify the code to skip dates for for which the exchange rate is not available and that's uh the improved code again and it it's returned the code and my uh proxy user proxy has run the code and it's got some results okay and the assistant says cool the code executed successfully thank you there are so missing uh missing dates I want to stop here for a second because I I think I don't want to overlook how amazing it was because look all of this happened without my interactions and there are really failures in code and there are some mistakes and the assistant and my user proxy have together figured out how to fix the problems and they ended up with the code that actually worked I mean I don't know yet if it worked but uh let's assume it worked because the output of the final code was here so no M no errors and this is this kind of selfhealing process and you can see here for example like there's this us proxy agent and assistant agent and they just interact with each other so give me the code here is some code here's the execution result and the assistant says okay based on this results I need to improve or something and like the assistant figures out that something was wrong what wrong and tries to uh fix the problem and then the user proxy executes the code again and yeah if there are mistakes like assistant improves again and if not it it's final and in my example there were like it was twice like first there was this no date error okay I will fix it and then uh user proxy executed the code again and there was this error okay I will exe I will improve it again and this are your final results so this is the mindblowing part and I wish I could express this better but it's all happened without my interactions and that's what I mean when I say that multiple agents working together give always better results because without those AI agents like doing it only with gp4 you would have to run the code yourself and then paste this errors to to chat GPT and right now everything is done for you by the your user proxy agent and your AI assistant yeah so this was already amazing and if it's not amazing enough a very cool feature is that you can just follow up the previous question like you can follow up the conversation ation by saying user proxy send and because now this user proxy remembers our uh our conversation you can just add like modify it slightly so I just ask to like give me this USD to switch Frank price and then because I couldn't see the plot I wanted to save the plot to this file and yeah and you user proxy has given the same message to the assistant and the assistant say says sure and it's figure out what I want although I made some type a typo and it's uh adjusted code and it's uh and it says that this code will print today's date and create a plot uh and then the plot will be saved to this PNG file okay and then uh my user Pro is actually executing the code and they say great okay the code executed successfully okay let's see and so if it's saved in this d uh with this file name as I as I specify f it should save in this coding uh directory and just to remind you uh here in the third cell we said uh the for this code execution config work here was coding and as I mentioned this coding uh folder is here and if I open it I can see Exchange price here to date and this is exactly how I how I wanted it because that that was what I specified and then with this file I just uh open this I go to coding and this file and I actually can see the plot and I didn't do even anything and just to Quick uh to quickly review this is uh there are some problems but those are those dat that were missing actually like look third 7th and and they they have a slightly damaged our our plot so probably the code needs some uh further Improvement but I hope that you see how powerful this tool is already and I hope you are excited just as much as I am and uh I think I will that's enough for this video it's already long enough I just want you to tell you that I'm already working on some other project with uh autogen where where I took it to my computer and I let it modify my obsidian my second brain and it's already generating uh summaries based on the URL I provide and it actually saves markdown file files in my second brain but that's the topic for the next video so just stay tuned And subscribe to my channel to see how how I took it how I really customized this uh autogen how I used um function calling which autogen and you can expect this video in the uh following days in the next several days so thank you for today and have a great [Music] time
Info
Channel: Kris Ograbek
Views: 9,199
Rating: undefined out of 5
Keywords: autogen, autogen tutorial, autogen microsoft, autogen tutorial for beginners, ai agents workforce, ai agents explained, ai agent, ai agents python, autogen ai agents, ai agents examples, ai agents tutorial, autonomous ai agents, autonomous gpt, ai agents gpt 4, gpt agent tutorial, openai agent autogen, how to build ai agent, openai agent tutorial, gpt 4 agent autogen, ai tools, how to use autogen to create ai agents, autogen colab, ai agents framework, multi agents
Id: nnbjOJkQ7sg
Channel Id: undefined
Length: 25min 28sec (1528 seconds)
Published: Fri Oct 13 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.