AutoGen Agents with Unlimited Memory Using MemGPT (Tutorial)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome back we have another mgpt video in this video I'm going to show you how to get mgpt powering your autogen agents it is so so cool now again this stuff is Cutting Edge so there's going to be some bugs there's going to be some friction but it does work and they're constantly evolving these projects and soon these are going to be super mature projects so if you're watching this video You're are way ahead of the game so let me show you how to do it let's go so I have some code that was provided by the M GPT authors and I made some minor edits to it but I'll drop my code in a gist in the description below but the first thing we're going to do is open up visual studio code have a new file called app.py take the code from that gist file and paste it into app.py and this is what it should look like you will have to put your own API key in here and yes I am going to revoke this API key before publishing this video so with that said we obviously need to get MGP PT and autogen installed so let's go ahead and do that the first thing we're going to do is spin up a new cond environment cond create DN autom mem GPT python equals 3.11.0 hit enter and I have to remove my existing environment but you don't have to do that now that we're done setting it up we're going to activate the environment so cond activate autom mgpt hit enter and then in the bottom right make sure that you have the cond environment selected python 3.1 1.3 autom MGP Tonda it also shows it right here so we're all set up now we do have to install it now even with cond I still struggle with module management so I'm going to show you a little trick to make it even easier so with this next command I'm going to install two things I'm going to install pi mgpt and Pi autogen mgpt now comes in a python module which makes it super easy to use and the little trick that I mentioned is we're actually going to run python from this cond environment that I just created so you need to find the folder that represents this cond environment and it's right there and then now we know when we run pip install it's going to install to the right place so we resolve this location- m pip install pi mgpt and Pi autogen then hit enter okay so I had a little mistake I forgot the initial slash right there and that's why it said that there's no such file or directory so then I just hit enter and now it should install everything to the proper directory and that's just one less variable that we have to worry about when using python modules and there we go now it's all installed and all the yellow underlines went away so we know that it's going to import correctly amazing okay so now let me walk you through the code so we're going to import autogen and then we're going to import all these different parts of the mgpt library and again you should already have this because I dropped a gist in the description below so we import a whole bunch of stuff we're going to import open AI right here and this is where we're going to set our open AI API key then in the config list all we need to do is specify the model as gp4 we are going to be using GPT 4 here but we could technically use an open-source model plus autogen plus mgpt but that's a little too crazy for this video and so all this is like normal we have the llm config then we're creating an autogen user proxy agent but here is where the new stuff happens first we create this interface object and the authors has explained it to me as really the way that mgpt talks to autogen because mgpt has all of this dialogue that isn't necessarily inference and it needs to Output that to the terminal so this is how it knows how to do that and then the persistence manager helps us store all of the stuff we want to store in memory and then I'm going to Define my Persona and this is the persona for mgpt and then I'm going to Define what I believe is the system message so that's where human is human I'm a team manager at a Fang tech company and then we pass that all into this presets do use preset and we have a bunch of parameters that can be passed in but at the end what we get is a mgpt agent and right here what we're going to be doing is we're going to create a coder so we have the mgpt autogen mgpt agent we're going to name it mgpt coder and for the agent we're going to pass in this mgpt agent that we just created now here we have an assistant agent which is going to be a PM a product manager but this is just going to be a normal non- mgpt agent then everything else is like normal and we initiate the chat first send the message let's go Mario all right let's see if it all works we're just going to hit play right there and it's working first send the message let's go Mario and now it's running inference and we can actually see this is the mgpt coder and the cool thing is just like using mgpt we can actually see the internal dialogue happening with mgpt that's pretty unusual but they're the boss let's go Mario and then it says let's go Mario function success and now we're running more inference so now this should be on the chat manager which is a normal autogen agent all right here we go and now the product manager back to the chat manager has a bunch of ideas of different apps that we can create and now it's asking for feedback but I'm not going to continue There we see right here that it is using mgpt as an autogen agent how awesome is that and so that's it for this video if you want to see me do a deeper dive into using mgpt agents with autogen let me know in the comments below if you liked this video please consider giving a like And subscribe and I'll see you in the next one
Info
Channel: Matthew Berman
Views: 61,559
Rating: undefined out of 5
Keywords: autogen, memgpt, ai tutorial, ai, ai agents, ai agent, chatgpt, openai, autogen tutorial, memgpt tutorial
Id: VJ6bK81meu8
Channel Id: undefined
Length: 5min 31sec (331 seconds)
Published: Mon Oct 30 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.