๐Ÿ™ Lunch & Learn: Learn To Use Assistants API

Tina Huang ยท Intermediate ยท๐Ÿง  Large Language Models ยท2y ago

Key Takeaways

The video teaches how to use Assistants API for building GPT apps, with a focus on intermediate level learners who have completed CS and Programming levels 1 and 2, and have knowledge of how LLMs work. The video is a homework session for an upcoming livestream on the same topic.

Full Transcript

Hello friends how are you doing no Pikachu scavenger hday Hello friends you guys probably haven't seen this background in Forever CU I haven't been back here for about like a month or so now I think so Hello friends how's everyone doing is my stream quality really or is it just me is it really bad it looks really bad from my side yeah can someone tell me if my quality is okay can I get also get a sound check please sound check hello Ibrahim welcome to another episode hello Ken thank you please press the like button that helps me allegedly if you appreciate me doing such things I need yes all right well we can get started today huh waiting and anticipation audio is good it's pxy Tina F it's Furious fur fierce fierce if anybody's watched that video it's really bad right let me okay give me like one minute I'm G to try to fix it if it doesn't fix itself then I don't know what to do we cry I'm just kidding let's not do that it's like really bad dang maybe it'll get I'm like if I refresh it repeatedly maybe it'll get better I don't think that's how it works it says that it's okay [Music] though let me see if I can fix it I've never done this before H I said is it just my internet is really [Music] slow going try doing manual Auto 7 20 I don't know what's happening it's still really bad right dang it well okay well shall we just begin and hope because thankfully today is not really my face maybe make it like super duper small nobody can tell because it's mostly um through screen so why don't I just open that up SEC yeah we can like pretend that my face is not pixelated yes that's why don't we do that okay well for anybody who has not done so there's a link that's there on the that I pinned please click on that because that's what we're going to be using and I hope you guys did the homework which was Cs and programming levels one and two as well as hell lburg so I do hope that y'all did the homeworks if you did not or if you know how to do such things already that's fine too but if you didn't do the homeworks um you look greaten okay yeah I'm just going to share my screen so that we can pretend that my quality is not terrible because I don't know why the quality is so bad it really is quite strange okay let's share my screen um just do this one you guys should see this there since I'm like very small now does it look better okay cool well okay yes so anybody who has not please go and make a copy of the link that I sent um on the live stream so it's supposed to be it should be the pinned comment that's on the live stream and then also um just a reminder if anybody's interested in getting like the resources afterwards like the coding notebooks as well as alerts and things like that you can sign up for this over here um we'll email you once a week with resources from last week and whatever is happening for this week that's it completely free nothing else nothing else um is going to be there can be a camera problem it could be right yeah but now we're really small so you know wipe this we're gonna pretend that there's no problem okay cool also I do give you guys a live API key so as promised um I did get brilliant to sponsor like test sponsor a live stream from last time so I am able to I gave you like a live API key um please don't blow up the API key because I do I I did set a limit so don't ruin it for everybody I'm going to use it for everybody who's here live on stream we're going to be using it um throughout the entire process so you don't have to pay for it but yeah please be mindful don't use it unless you know we're actually doing something important not like keep on spamming it because then you're going to ruin it for everybody um yeah because it does cost me money every time somebody goes and calls something using the assistance API all right are we okay any problems um where can we should we get started I shall wait one more minute any questions comments uh text is readable though okay text is fine yeah I'll just make this a little bit bigger it's the pin comment for anybody that cannot see looks like okay audio good Hello friends hello Conrad hey Ken hello Ashley crypto invest earn hey hey hello Jose um I didn't do work I'm sorry it's okay okay well today we're going to be using the assistance API from open AI so I gave you guys homework which is Link in the description from last time in case you don't know how to code um so I just said like go do that on brilliant um before we get started but I'm going to walk you guys through how to use the assistance API and we're going to actually build something today as as well if you guys like it let me know because I could like eventually turn into a series or something like that where we can build like swarms of Agents potentially um but yeah like all of these is really dependent on your feedback so if you like it just please like let me know about these things because that's how I'm doing these like free weekly lunch and learns um yeah very open to suggestions as well okay cool um so what is assistance API let me know how many of you guys have used assistance API before show of hands in the chat what we're going to be doing today is an open AI assistance API to create a text summarizer for scripts books articles and papers so what we did last time we already um made a GPT from last time um using the default one like using kind of what is that called like the I guess you want to call it like default GPT maker so now what we're doing is you we're creating so an assistant actually let me back up a little bit so like a GPT where an agent is an AI task and you can give it like very detailed instructions you can give it archives you can give it like different functionalities like browsing the internet um doing like code interpreter like running code uh accessing things like dapier ordering food for you connecting to like smart devices so it's very very powerful and this like specific agent you can think about it as like a person who does a very specific role in a task so last live stream if you guys haven't checked it out you should do that we did a script architect and we're using the interface that is um directly on chat gbt directly on the inter directly the UI that's directly there but you're pretty Limited in terms of actually if you want to incorporate that into your own product um and there's just a lot more powerful things that you can be doing if you use the assistance API So today we're going to be building something using the assistance API and hopefully you guys can have a look at how powerful this can be so we're starting off pretty simple today um just building it up and going through like step by step from the very beginning uh so bear with me a little bit just want to make sure that everybody has an understanding of how this works and as always please just leave in the chat any questions that you have I'll be checking the chat um and answering any questions along the way sounds good okay let's get started so let's first take a look at the assistant API oh yeah sorry so today we're building an assistant API U to create a text summarizer for scripts books articles and papers if you guys have ever like had um like books articles or scripts you just like PDFs where like documents of things and you're just like I don't really want to read this or you're trying to do research for something and you want to get like that information from it um we're going to be building an assistant like an agent that's able to do that for us so we're doing like the base functionalities of that today so in order to do this U I'm going to first just walk through the assistant API so you guys have an understanding of how all of these things work let me just check the comments to see if anybody has any questions questions concerns thoughts yeah there's a link um if you look at the link can yeah if you look at the link that's the pin comment that's going to be the thing that we're going to be using so I'll just copy it and paste it here again whoops oh no yeah does it let you do that oh no it's a 404 okay let me just paste again but it is it it is the um Whatchamacallit it is the link that is pasted on the pin comment there you go all right cool so let's look at the assistant API so what it is is this is a way for you to create your own assistant through the software that they've created so that's what an API is this is the kind of the architecture of how it works don't worry if it doesn't make that much sense as we're building it it'll make a lot more sense generally speaking like the documentation um there's like a law documentation I get bored reading it but we'll just go over to very Basics first okay so for example um you have an assistant say it's like a personal finance bot that they're building and then for each of these there's certain objects that are within it the assistant is kind of like the overarching um object that's there and um within it you can have a thread so a thread is a conversation between an assistant and a user threads store messages and automatically handle truncation to fit content into a model this is like when you're having a conversation with Chach BT you're opening up a single conversation window so that's what a thread is and the assistant is obviously the personal finance bot in this case and then the user is going to be you or your application that's going to be communicating with your assistant the message is a single instance of a message that is being created uh and that's going to be between the assistant and the user so that's how it is that you communicate messages can include text images and other files messages store as a list on a thread so messages have to be associated with a single thread that's there and a run object is a way uh a run object is a way for you to actually like run the conversation so the assistant uses his configurations and the threads messages to perform a task by calling models and tools as part of a run assistant pends messages to the thread so every time you have a thread you asset something the assistant will go and run that um using the tools that it has and then a run step is a detailed list of steps assistant took as a as a part of a run so this can give you information about what's going on during that conversation okay so that's like a really really brief overview don't worry too much about it um that's kind of just the architecture the pieces that we're working with so now instead of just going like we're going to write out the entire thing uh we're actually going to build it from scratch it's not going to be the most efficient method but I just want you guys to see how the parts all relate to each other okay so coming back over here what is happening here so from open AI in Port please everybody run this along with me um you know gave you guys the live API key I'm going to be disabling this after so it's just only for people who are live today and then here's going to be the assistant ID um I already created the assistant ID because I didn't want you guys to create like a hundred different assistants that are there but I'm going to walk you through the process of how to create the assistant there's actually like two ways of doing it one way is that you can do it through code we if we have time I can show you how to do that too but you can also do it through the playground um with open AI as well so let me just show you how to go about doing this all right so this is whoops that was not it where's the playround ground so I have a whole Army of assistants that are already here like a bunch of things that I've been personally using um so this is the content researcher so let's open up this over here and this is the assistant ID so this is the thing that we pasted over here oh no it disappear so this is the thing that we pasted over here so that that we're able to access this assistant so when in this case we're calling a Content researcher so you're a Content researcher that answers questions based on the content that you're provided with right and the model that we're using here is GPD 4 November 6 preview there's a bunch of different models that choose from this one has is one so that's why um I just chose this one under here are tools that um your assistant can use code interpreter some of you may know this it allows it to write and run code code it's useful if you're trying to like generate things like graphs and things that you might be doing like you want to analyze some data files you want to be generating graphs from it you might want to be doing like math or something like that you can use code interpreter and then retrieval is when you're giving a knowledge Bank of information um and once you upload that information the assistant is able to get that talk about things in this case what I did was I uploaded um it's called Speed Learning transcript is one of my own videos so this is how I know that can I actually open it to show you guys um I can open it to show you guys what that looks like let me I think I can just put it here yeah so it's just a transcript of one of my videos that I've done um so this is a way of you can have that information coming in it's able to go through that and ask and answer questions about it obviously this can be any sort of text it can be books it can be articles it can be anything that you want but chose to use a transcript for this example here so that's the information that it has you can also Define like other functions within it um for example there's stuff like getting the weather getting stock prices there's things like browsing um browsing the internet and like generating images and Dolly and things like that so that's something that's going to be they're they said that they're going to be implementing were so so that should be like a default functionality in the future but for now you can also add other functions to it so you can like access a lot of different other tools that are out there so it's you I hope yeah I hope I can kind of like I was able to illustrate how powerful it can be because you're able to give it so many different tools that it can use so I am going to stop for now and see if there's any questions um do you need open AI premium subscription yes you do but because I gave you guys um yeah cuz because I gave you guys this already with the which is the API key uh you should be able to just use it right now it's I'm paying for it so don't worry about paying for it as of now um yeah kind of just for you to test it out hope to be AI expert soon just save it to your drive because that's mine yeah uh save it so just copy it like copy you don't have like you can't you can't change it directly but just copy it into your own drive and then you can edit it as much as you please uh the only link that you have to open is currently the collab link that I just sent earlier yeah I'm going to um things related to the tutorial a little bit later I PARTA so yeah just want to make sure that we are kept on track for all the people live she's providing API key for free for duration of Life yes thank you shabam yes so now's your T you has your chance to test it out even if you don't have premium don't worry about it so I just want to make sure is everybody able to access everything did everything make sense any questions so far yes no maybe can this also manage private secure docs where only public what you can do is you can um upload that document uh and it won't be shown to other people so it can be like secured dos uh that you're putting there so right now I showed you guys the thing I'm uploading because it's not anything secure but you can always upload it directly through your own code um or through your if you're creating creating an agent through your playground so nobody else will be able to access it although um if you're using for your company purposes definitely check to see like what it is that they allow or don't allow is open AI itself does have access to it even though they said you can like toggle out uh them being able to use the things that you provide so that's possible but definitely see if your company goes like oh like you can't upload it to certain things especially if you work in places like healthcare and stuff they tend to be more strict it's all good on my end you are very clear yay I'm glad to hear that um the Google Doc link is not responding it should be a collab link I'm at of collab but I'm not at a playground don't worry about so I'll send you the link for the playground as well you know I'm just going to like like the playground if you don't have um like this is just me showing you how how it is that you can per you can create one of the one of the assistants through the playground I don't know if like I don't think me giving let me check I don't think if me giving you this link yeah you do need to log in yourself to be able to access this because this is something that I created with these files so it's not sharable um I just wanted to show you how you can do it yourself if you want to just like make your own and you do do have like an access um Whatchamacallit like if you do have um your own see your own account and you have paid for it you can play with the playground and I'll ask I'll just put the link on the file as well so don't worry about being slow like this is like a chill we're doing a chill time so don't worry about it so yeah let me actually just put that there playground you need to have access you need to pay for this yeah if doing your own okay cool all right so after we were able to create this assistant we can test it out here um it's going to be very similar to chat GPT let me see uh yeah it's going to be really similar to chat TBT like for example we can ask a question like what um um I don't know what is the file what is the speed learner transcript talking about you can ask this question and here are the log so it shows you the end points that it's hitting in order to in the back end in order to be able to get you to response that's here so it might take a little bit of time while that's running I'm just going to go back back to here and explain what's happening here so the client here's the API key please make sure that you're using this one and the assistant ID is the one that we just put over here okay and then for creating a thread so we talked about earlier how assistants work first you need to create a thread which is a conversation session between an assistant and a user um a thread store messages and automatically handle truncation to fit content into a model context we need to create a conversation between us as well as [Music] the assistant so in order to do that what we need to do one second we need to create it so I'm going to just copy this so you guys don't have to like watch me type over here and again if you're on this doc you should be able to see it directly so I'm just going to say thread so we're creating a thread is equal to client. beta. threads. create um and you're printing out we can like take a look at what the thread looks like for example I might actually have to run this again yeah I think I need to run this again oh no okay so might have to run this part if it's not installed so let me just do that okay so it's doing it's things right now I feel like my internet is super slow for some reason today I don't know why okay so it's creating the thread um it did this and then now we can create a thread is that working wait a second my thing is being very very very slow give me one second did it work yes okay so this is a thread that's being created thread is equal to this just kind of a gibberish created at this time metadata is going to be a thread so kind of like a little tip for you guys if you don't like like I don't know what this means uh you don't want to read the entire documentation um the documentation here I would say it's decent it's not the best but we can go through it does tell you like how some of these things work so threads and messages it has information about here and then it tells you what it is that's contained within the thread um D object so yeah it does tell you like this is how it is that you're going through creating This Thread over here so if you have any if you like at some point you get lost and you don't know like what's happening um just check out the check out the documentation it does give you decent information about what's happening cool all right so after we create a thread okay so after we have created a thread what we're going to have to do is create a message within the thread so I'm going to do that and explain how that works too so message you're going to be calling this and then you have the thread ID which is the ID that's going to be here so we just have to do thread. ID because this object has um the ID field here and then the role is going to be user and the content is going to be us asking it what does the script talk about so I'm going click that let me see if anybody has any questions or concerns right now now my channel is not for professional developers okay let me know seriously just let me know if you have any questions like Ser like this is very chill time don't worry I also made sure that we'll have enough time to get through things if if we have extra time we can build out something more fancy but if we don't we can just go through this and we can continue next time I was oh yeah my apologies um for some people like if you uncommented out it should be able to run so I just want to make sure it's everybody able to run what is the thread just trying to understand what y'all are doing so uh you mean okay so we're creating a thread which is a conversation between the agent and the user so you need to create a conversation that's all we're doing right now something similar than it looks just got to know where to find info yeah like I said just ask questions don't worry about it um there are no dumb questions if you actually see like the stupid things I've done while coding like trust me you'll be like oh my God how does this person even know how to code like I don't know either okay so does that makes sense we're creating a message um that's telling it it's okay here's the ID of the thread the role is the user and the question we're asking is what does the script talk about so we created a message instance of the message object okay now we have a thread and we have a message now we actually have to give that information to the assistant that we have over here which is the um content researcher or the analyzer so that they're able to answer your question to do that we need to create a run whoops like this so explaining it here client . beta. threads. run. create we're creating a run and then your thread ID is going to be thread. ID which is again the thing that you just created over here and your assistant's ID is equal to assistant ID so remember how over here we Define assistant ID is equal to like the thing over here uh which points to the assistant that we created earlier in the playground makees sense yeah um I will in the end if we have time I'll run through how to create the assistant using Code the reason why I didn't I think I mentioned this earlier actually is because I didn't want you guys to all like create a bunch of new assistants and just like completely spam my spam my playground that's literally the only reason um but I can show you guys how to do that later as well so you can do it through code too okay cool so now we've created a run the thing is like when you do create create the Run um you have to right now it's a little bit sketchy U so this is just the function that was defined in order to wait on the run because it takes a little bit of time for the assistant to go and do certain things like figure out what it is has to like scan through the document stuff right and get you the answer for the question that you ask which is what does the script talk about just checking the status of the run if you want to see what it looks like you can always check the object uh you can see like what's defined within the object here right like what are the fields within it um so over here it just instructions your content creator so it's giving you all that information started thread ID tools like the assistant right now has the code code interpreter tool um and it also has the retrieval tool which is its ability to understand to get that information from the PDF that we gave it so status is is cued right now right so it's not actually been executed so we're creating this function so um while it's being cued and it still hasn't finished yet we're just going to keep waiting until it does and when it does we're going to return to run so now we have to actually run um this thing that we have defined the function that we've defined right so it in it takes the run and the thread so we already defined a run over here and then the thread we also previously defined as well so we're just going to run this oh no we on run is not defined okay now it should be fine okay great so the run is now done and what we can do next is that we can get the messages now that the run is done we asked the question now fingers crossed and cross my fingers it actually works never know these days but this is how you get the messages on the thread and nothing comes out because we need to print the messages that come out so I just want to show you guys first and then we'll go through and actually run through what each of these things mean so the question we asked it is what is the script talk about and the assistant says provid a script appears to be a transcrip of a video sponsored by RQ which is true to presenters the script discusses the challenges of focusing in class and the significance of self-study which help them prepare for a data science interview at meta for part of Facebook pres was able to teach themselves sequel in 11 days passed interview despite having no prior knowledge and then it goes on to talk about like blah blah blah like all the other things that oops sorry yeah and it goes on to talk about all the other things I talk about in the video so it gives like a nice little summary it's like oh like here's the things I talked about self testing and retention learning techniques experimentation obviously it had to go and reference the information that we provided the assistants uh through retrieval because if it did not uh it would have no idea what I would be talking about right because I asked it the question um what is the script talk about be like what script is it so clearly was able to retrieve that information and get it so I first just want to show you guys the entire kind of flow of what's happening and now let's actually go back um through this and we're going to like type everything like not type everything we're going to go through each of these things um so we were here and waiting on the run and run is equal to wait on run print run so I'm going to stop over here does anybody have any questions regarding this specific part I came in very late I don't know what's going on I've only been coding for few years um if you just click the link the collab link that's on the pin comments you would be able to access everything that I'm talking about right now so it would actually show you um it should be showing you I just double checked again it should be showing you everything that I'm talking through and explaining as we're typing it so again this video is going to be here forever as well hopefully forever as long as YouTube is around as long as I'm around um so you can always go back and look through it I think we'll make more sense around with yourself so uh can you please record a live broadcast on a channel I can't understand it right now because I can't watch it with subtitles do I need subtitles is it because of the way that I speak she's using chat GPT for to build an assistance yes I'm using the assistance API in order to build an assistance and in this particular case our assistant um is one that's able to go go through and read the transcript of something I provided it and then it's able to take that information um and then have a conversation so we just created a thread and then we created a conversation between the user which is us and the assistant which is the AI okay what is the weight on run aspect okay great question all right everybody ask questions please ask questions because I can't I can't mind read I'm going through this and that's why I there's so much time right this is all the code this is like the base amount of code that I'm going to be writing today we can add on more things if we have more time but that's why we're only at 12:30 38 we have 22 more minutes left because I want you guys to ask questions play around with it yourself and I'll just be sitting here and doing things with you guys so don't ask questions I can't answer them please ask questions don't worry about sounding stupid okay this question that we have over here is weit on run aspect okay great so weit on run aspect the reason why we have it where did it go okay the reason that we have it it's like a little kind of Quirk that they have right now um because just like not polished because as you can see it's still in beta testing right now so it's just not as polished which means every time we do a run and the assistant goes and does its thing and gets you a response it won't automatically give you the response back you have to keep checking it so this is why you're checking like while the status of the run is cued or it's in prog is able to come back and give you an answer to it we're just going to keep checking it um we're going to keep trying to retrieve the response for it and then just kind of do this continuously until it's finished and this is this part time. sleep is going to be 0.5 seconds so this Loop is going to keep going and then it's just going to um it's just going to keep going and keep going keep going and waiting and then it's wait runs the loop again until this entire process is finished and drun status is going to be finished then we're able to get [Music] does that make sense I talk too fast okay I'm sorry also this is please give me a feedback as well this is literally the first time I've ever done like live thing that has to do with code like I've done like videos where I do tutorials and stuff but I've never done a live tutorial before ever um let me know if you guys have feedback like maybe what I can do next time is I can actually like just because I thought it would be really boring if you guys just like watch me type but we can do that too would you guys prefer that just like literally watch me type and misspell things along the way you just follow along on the link okay yes uh okay okay got it got it all right makes sense well I mean what we can do if you guys want we can do it all over again and then we can go like literally write everything step by step do you want to do that why don't we do that actually here okay does every does to this point run is going to be equal to wait on run run and thread so we're running everything here right so next step that we have to do is going to be getting the um messages right so let me actually share the documentation with you guys as well so you're able while we're doing this see if I can split my screen so I can show you guys again I appreciate you guys giving me feedback as well never done live coding before so this is definitely a first for me too I promise I will improve as time goes on um let me just pull up the documentation Okay cool so here's the documentation for it we're after waiting okay do you guys I'm going to wait do you guys want me to go through the entire thing and just like type everything down where or do you want me to just here let me know in the comments please I don't want anyone who I think that we'll be happy to pay what is WebEx I actually have to check that out I go live every week what language are you using here I am using did you practice this in advance or are you just making it up as you go along I have not been here the whole time I did try this out like 30 minutes prior so I have been like making um I I've been like doing some assistance like I've made my own for for a while now um a lot of it to do with like content research and like searching a searching a web for me to make videos and stuff so I've used this for a little bit of time now but this like specific uh tutorial I just made it like like a little bit prior to this live stream okay so I wanted to like pull up over here this is what it looks like right each of these objects so for example we can kind of go through it and then go where we left off so we can start all the way from the very beginning when we when we talk about what an assistant is right the assistant object So within an assistant object there's ID uh which is what it is that you're identifying with identifying it's it's what's referenced in the API endpoint so this shows you what's contained within the object um the assistance object so what it is the object type is going to be assistant uh when it's going to be created the name of the assistant the description of the and the model of the assistant and instruction and tools and file IDs as well as metadata so this is the assistant that you can create using code in our case we already created it using the playground that is over here so I'm not going to confuse everybody more right now to create it using Code but let's just assume that it's already created for now and then that's why on the code that I showed you guys from the very beginning um I gave you the assistant ID so this is where we defined the assistant and told it what its instructions are what the name of it is which is going to be to summarize information that's provided in the PDF format or some sort of document document format so does that make sense for what an assistant is and then these are like the things that you can do using de using D assistant obviously you can create an assistant through the code you can also retrieve your assistant um and this over here explains to you how it is that you can get your assistant and you can print out what the object will look like you can also modify your assistant like for example maybe you want to change um the model that you're us right now but maybe you want to use something else like you want to use gpt3 or some other model um instead so you can change your assistant using using um this function delete your assistant if you don't want anymore goodbye assistant you can also um returns a list of assistants so we can actually do this right now we can copy here you can try that out right now here let's add see what kind of assistance that we have and it shows us that we have these this these are all the different assistants that we have and it tells you that it's a Content researcher object assistant tools and all this information here and then I also have a book bot so these are all the assistants that are available to us so I'm actually going to just comment this code print out different and assistance that are available okay when we're creating a thread assistance file creating files this how has to do with the assistance I think we can go oops that did not work I was going to say like can we look at stuff that's not the assistant um okay threads great so this is a thread object which is the thing that we created over here like thread is equal to client. beta. threads. create and we're printing the thread so that's the information that we're referencing um like that's the conversation that we're referencing so why does it say client. bet. threads. create did that come about so a thread op object it shows here within a thread you have an ID in object created at and the metadata and then you can create the thread which is what we did over here and it gives you the code for this right so Mt thread is equal to client. beta. threads. create print empty thread so the code that we have that I wrote here is very very similar so we just instead of calling it empty thread just call a thread is equal to client. bet. threads. create so and then we can print the thread to see what's happening here so that's also how you know like what you can do with it tells you what the methods are like what the object looks like and what the methods are that you can do using that object so again if you haven't done your homework it's listed in the description this is why I told everybody to please go do the homework so you're able to understand like what it is that we're talking about today all right cool um and similarly here for the message this is also another object so that's that's why we have the messages which is another object that's listed here which has ID object created at thread ID and roll content assistant ID run ID all of this information is related to a message and very similar again we created a message with the role of the user saying what it is that we want to ask the assistant which is what is the script talk about I'm going to check the stream and see what you guys are thinking I'm okay with watching you type and explain the process then I'll do it later okay cool all right in that case next time you guys just see me I'll just type everything through probably take a little bit longer um but if you guys want me to do that I can do that as well and all honesty though a lot of these things it's like I'm not going to go and rewrite all the code myself s right like we saw from the documentation so much of it is already shown to us how it is to do things so I pretty much just copy pasted a lot of these things I just copy paste it like a that's how you create a thread so I just I just copy this and then I kind of tweak it a little bit um based upon the question I want to ask it obviously here I don't want to ask about how does an AI work I just want to ask it about the content that's being produced so um just want to make a point there like people don't write code from scratch like it's very rare for people to just write everything from scratch these days there's a lot of stuff that's already [Music] available create thread box has no errors thank you if you don't know python this is the go-to language for for AI um they also do have JavaScript but if you don't know python that's again that's what I have that's why I left the homework so you can learn python um to doing this what you need to know is going to be like introduction to python as long as you get to objectoriented programming you should be fine so I would say if you spend at least like 40 I would say like four to eight hours um two to three weeks Max you should be at a level where you can be doing these things yeah um thanks for the reminder Andy uh change your API token yeah I'm disabling the token after this live stream is over so don't worry I'm disabling everything it's only going to be live during the duration of the live stream is this helpful by the way can somebody let me know like do you want me to keep going on and then going through the documentation and showing you how it works or n let me know guys I need some feedback how is it that I should conduct these um coding tutorials that is the most helpful for you guys yeah you know what let's do this only one I'm going to leave I'm just going to delete all of this we can just type everything out again okay so creating the messages which is thread. ID and then what we want to do is create a run whoops we want to create a run right so what I do is I just go here and I'm like okay I need to create a run so I go to threads modify messages so you see this is like literally the process now I'm showing you like the full process of doing this it's going to be really B seeing me like going through docum documentation um but that's how it is I usually code okay so I see here MD thread is equal to client. Beta threads so this is uh I think I already created that thread didn't I yes okay no sorry I'm trying to create a run right [Music] um oh I don't know where it is so I'm going to just look it up create a run okay well it looks like to create a run I will need to do this so what I do I just copy this I don't really want to copy that part and then I will go over here and then copy that here so obviously like the thread ID is going to be different so in this case we're going to be putting thread. ID is of the thread that we I ID is also going to be different because we previously defined that variable which is the what did I Define it as system ID and then we can print the Run yeah and that's how we created a run so to um that's how we're creating a function to do this so we can do let's like open up why it is first we need to see like how it is that we're supposed to get the run right so to retrieve run we know that this is the thing that we need to retrieve so we copy this part um we copy this part whoops oh no ignore that um thread ID again we're going to change this to thread. ID and run ID that to run. ID so the that it's not going to actually it like we need to continuously check for it um where else it's it's just going to like you know we don't know when it is that it's going to be come back right so that's how we need to Nest this to say um while like we know the run here [Music] completed canceled at um status is equal to cued right so while status is equal to cued oops cannot spell right so we know that if it's equal to Q or it's or it's being in progress or status is [Music] equal in progress you need to keep on running it until it's over right so that's how we're going to Nest everything that's in here we're going to keep running well my God okay so we're going to keep running this and then we don't want it just to like continuously run around run and run so we're actually going to do um take we're going to take like5 seconds every time before it runs run5 here and we have a problem stus is not theine okay yes so the S is not defined because you have to reference the object over here which is the run so whoops wrong number of hey there that should work maybe yes and now we actually want to run it which we did so instead of defining a function here I just ran it instead um and then let's actually try printing the Run cool and then it was [Music] able to print to run like this next up in order to get the messages um now like everything is done right but we have to actually get the messages where else we don't know like what the messages are going to be saying so let's actually look at how it is that we can get messages so we come over here call like get messages maybe it's call like list messages list messes messages yes we need to see like what the message information is contains so we'll copy paste this and we'll put this over here again we need to Define this c. ID and we need to Define run ID to run. ID so run is equal to that um and then the thre oh wait no this is already retrieved sorry uh list messages I think it should be it once it's being retrieved the response is going to [Music] be I think you can get you should be able to get the messages as a list so maybe it is less message files okay yes here so it should be like [Music] this thread. ID and then messages. ID like is it I think it shouldn't be do file this is live coding for you guys I think it shouldn't be oh I don't think it's listing message just file I think it should just be like listing it by themselves messages I think it should just be able to list them not the files okay yeah you should be able just to list it directly so never mind that it should be this directly messages call out messages um we'll just do my thread the ID and we should be able to see the data that is being contained like that yes so it's giving us all the information that's going to be here obviously this is very ugly so we don't want to just directly do that so that's why we want to actually print the messages um that's available for Loop so for message in messages out [Music] so I cannot type so how you spell message really don't know how to spell it roll we want to roll to be um I oh no we want the role to be is it like the user or is is it going to be the um assistant that's talking and then we also want to print the message content so we can look at what the message content contains okay so it's within here we see the data that's happening here so we want to print the rle and we want to print the content I we want to print the text of the content so so I want to do do message. content content and this is the object that's listed here so we want to put the first item that's going to be there and then we also see that this is the text that's available so we want to get the text right um and within the text we want to get the value of the Tex so the thing with this problem the problem with this is that it's printing everything out which is great but it's in Reverse chronological order so which is why we want to actually reverse everything does that make sense like we want to reverse it think the function is reverse oops there we go so the user comes first and then the assistant talks about stuff after all right so we coded through everything now I want to see if did everybody just leave I hope nobody is anybody still here after I went through all of that does that make sense hey Mickey how's it going okay I was like too concentrated on figuring out the [Music] documentation all right so I want to talk about what it is that you can do after this point so we finally this seemed like a lot of effort uh we were able to do all of this uh afterwards if you actually want to like make an app or something like that right now we're running this on um collab so it's easy to step by step step by step but what I would do is I usually after I do like whatever it is that I'm doing here I would go and actually make go on vs code for example um and then make it into an app so I'm able to call the functions and have a conversation directly instead of having to type every single thing like every single type in order to have that conversation and then some other things that you can do um is that you can let's go to the playground again there's other functions that you can add to it right now it's just able to get the information and tell you about what's happening within that file but you can Define things like being able to research stuff online you're able to find things like looking at the stock prices getting the weather uh like a bunch of different things that your agent can have access to depending on the kind of agent that it is also I'm want to see if I can can stop sharing the screen and if my face is still super blurry also I hope you can notice how powerful it is to have one agent to do something like this but now imagine the fact that you can have a Content researcher who's doing like this stuff right but maybe you can also have a manager AI That's able to manage all of the different assistants under it you could have like a Content uh researcher you can also have somebody who's writing a script for example who's able to take that information and make it into a YouTube script right you can have a thumbnail or like maybe you're on IG or something so creating the content itself and then maybe like the thumbnail producing the pictures from Del that you can be using and you can have like a um social media manager that's able to take all of those pieces and then post them on to all the different types of social media like YouTube LinkedIn whatever it is as well so all you can have these like with these are called Agent swarms so a collection of different agents that come together in order to do like a more complex purpose that you want to set out to yeah let me know again if you have oh no I'm still super blurry aren't I but let me know in the comments if you have any like um suggestions maybe like not be so blurry next time but except for that you know I'm just going to put my screen back on so that it looks like I'm not just being blurry um so let me know if you have any suggestions for what we can be doing next time like live coding maybe I'll just code it directly next time instead of just copying it um are you guys interested in creating more of these agents and building out a swarm like is that something that people would be interested in learning about um or any other suggestions for what it is that you want to learn for the next live streams I want to create a calendar that makes sound on scheding as a reminder help in planning your day and time absolutely you can do that you can connect that with zapier for example um which is able to connect with your Google calendar and a lot of other like apps out there as well and be able to coordinate these things you can have an agent like you can just make a personal assistant that's able to do all those things for you um absolutely doable I like to learn at least the basics but since there's too much information on it it could be quite difficult for me to see what I should I do first any advice well complete the if you don't know how to code at all I do have the um courses that I recommend just go brilliant you can also use other resources if you want brilliant is great if you're into more Interactive Learning just learn that and then you can start building out like watch this tutorial again um watch like a live stream I think I might like condense it should I like also condense it and then just make a video of it as well I don't know let me let me let me know what you guys think um yeah I can also condense it and then just watch a tutorial again and then as you keep on building things you'll figure figure out how to do a lot of these things as you build them yeah that's like a good way to start still here thank you like I does anybody still want to hear me talk I must be so annoying yeah I'm j

Original Description

Homework for upcoming livestream on building GPT apps using Assistants API Complete CS & Programming levels 1 and 2 (minimum requirements) How LLMs work (recommended!) Sign up for free here: https://brilliant.org/TinaHuang/ โ€”---------------------------------------------------- ๐Ÿ‘จโ€๐Ÿ’ป LeetLLM: https://www.leetllm.com/ ๐Ÿค– Sign up here to get accompanying workbooks, summaries, and notifs for future lunch & learns: https://www.lonelyoctopus.com/email-signup โœ‰๏ธ NEWSLETTER: https://tinahuang.substack.com/ It's about learning, coding, and generally how to get your sh*t together c: ๐Ÿ™ Lonely Octopus: https://www.lonelyoctopus.com/ Check it out if you're interested in learning AI & data skill, then applying them to real freelance projects! ๐Ÿ”—Affiliates ======================== My SQL for data science interviews course (10 full interviews): https://365datascience.com/learn-sql-for-data-science-interviews/ https://365datascience.pxf.io/WD0za3 (link for 57% discount for their complete data science training) Check out StrataScratch for data science interview prep: https://stratascratch.com/?via=tina ๐ŸŽฅ My filming setup ======================== ๐Ÿ“ท camera: https://amzn.to/3LHbi7N ๐ŸŽค mic: https://amzn.to/3LqoFJb ๐Ÿ”ญ tripod: https://amzn.to/3DkjGHe ๐Ÿ’ก lights: https://amzn.to/3LmOhqk ๐Ÿ“ฒSocials ======================== instagram: https://www.instagram.com/hellotinah/ linkedin: https://www.linkedin.com/in/tinaw-h/ discord: https://discord.gg/5mMAtprshX ๐ŸคฏStudy with Tina ======================== Study with Tina channel: https://www.youtube.com/channel/UCI8JpGrDmtggrryhml8kFGw How to make a studying scoreboard: https://www.youtube.com/watch?v=KAVw910mIrI Scoreboard website: scoreboardswithtina.com livestreaming google calendar: https://bit.ly/3wvPzHB ๐ŸŽฅOther videos you might be interested in ======================== How I consistently study with a full time job: https://www.youtube.com/watch?v=INymz5VwLmk How I would learn to code (if I could start over): https
Watch on YouTube โ†— (saves to browser)
Sign in to unlock AI tutor explanation ยท โšก30

Playlist

Uploads from Tina Huang ยท Tina Huang ยท 0 of 60

โ† Previous Next โ†’
1 How to choose between software engineering and data science | 5 Key Considerations
How to choose between software engineering and data science | 5 Key Considerations
Tina Huang
2 How I got Software Engineering and Data Science Internships | Computer Science Job Search Part 1
How I got Software Engineering and Data Science Internships | Computer Science Job Search Part 1
Tina Huang
3 How I Became a Data Scientist | Computer Science Job Search Part 2
How I Became a Data Scientist | Computer Science Job Search Part 2
Tina Huang
4 3rd Year Statistics,  Data Science, Computer Science Resume | Reviewing Your Resumes Ep. 1
3rd Year Statistics, Data Science, Computer Science Resume | Reviewing Your Resumes Ep. 1
Tina Huang
5 How to learn SQL for data science interview (the minimize effort maximize outcome way)
How to learn SQL for data science interview (the minimize effort maximize outcome way)
Tina Huang
6 3rd Year CS Resume (and asian drink) Review | Reviewing Your Resumes Ep. 2
3rd Year CS Resume (and asian drink) Review | Reviewing Your Resumes Ep. 2
Tina Huang
7 Are you a student? If yes, this is the best data science project for you!
Are you a student? If yes, this is the best data science project for you!
Tina Huang
8 The Ultimate Guide to Land a Data Science Internship | schedule and time management survival guide
The Ultimate Guide to Land a Data Science Internship | schedule and time management survival guide
Tina Huang
9 Upenn MCIT Program Details and Real Student Experiences - Dr. Arvind Bhusnurmath
Upenn MCIT Program Details and Real Student Experiences - Dr. Arvind Bhusnurmath
Tina Huang
10 Real Data Science SQL Interview Questions and Answers # 1 | Data Science Interview Questions
Real Data Science SQL Interview Questions and Answers # 1 | Data Science Interview Questions
Tina Huang
11 3 More Unique and Impactful Projects to get a Data Science Job
3 More Unique and Impactful Projects to get a Data Science Job
Tina Huang
12 Real Data Science SQL Interview Questions and Answers # 2 | Data Science Interview Questions
Real Data Science SQL Interview Questions and Answers # 2 | Data Science Interview Questions
Tina Huang
13 THANK YOU FOR 1000! | Proper intro | Random facts about myself
THANK YOU FOR 1000! | Proper intro | Random facts about myself
Tina Huang
14 A day in the life of a data scientist (FAANG data scientist remote)
A day in the life of a data scientist (FAANG data scientist remote)
Tina Huang
15 SQL Data Science Interview Questions and Answers (interview style walk-through) | Question 3
SQL Data Science Interview Questions and Answers (interview style walk-through) | Question 3
Tina Huang
16 Biology to Data Science (data professor's tips on how to get a data science research position)
Biology to Data Science (data professor's tips on how to get a data science research position)
Tina Huang
17 SQL Data Science Interview Questions and Answers (interview style walk-through) | SQL Sundays #4
SQL Data Science Interview Questions and Answers (interview style walk-through) | SQL Sundays #4
Tina Huang
18 Data Science SQL Interview Question Walkthrough | SQL Sundays #5
Data Science SQL Interview Question Walkthrough | SQL Sundays #5
Tina Huang
19 Data Science Resume Round-Up With @KenJee_ds  - Episode 2
Data Science Resume Round-Up With @KenJee_ds - Episode 2
Tina Huang
20 SQL Data Science Interview Question Walkthrough | SQL Sundays #6
SQL Data Science Interview Question Walkthrough | SQL Sundays #6
Tina Huang
21 Data Science vs Software Engineering Interview | 3 Key Differences
Data Science vs Software Engineering Interview | 3 Key Differences
Tina Huang
22 Data Science SQL Interview Question Walkthrough (real interview style) | SQL Sundays #7
Data Science SQL Interview Question Walkthrough (real interview style) | SQL Sundays #7
Tina Huang
23 The data science resume that got me my FAANG (MANGA?) job (entry level data scientist)
The data science resume that got me my FAANG (MANGA?) job (entry level data scientist)
Tina Huang
24 Data Science SQL Interview Question Walkthrough (real interview style) | SQL Sundays #8
Data Science SQL Interview Question Walkthrough (real interview style) | SQL Sundays #8
Tina Huang
25 Interview with a quant trader
Interview with a quant trader
Tina Huang
26 How I chose my masters degree (as an international student)
How I chose my masters degree (as an international student)
Tina Huang
27 The software engineering resume that got me into FAANG and Goldman Sachs (internship)
The software engineering resume that got me into FAANG and Goldman Sachs (internship)
Tina Huang
28 3 tips to avoid debt for a masters #SHORTS
3 tips to avoid debt for a masters #SHORTS
Tina Huang
29 A hard work day (ft. new NLP project) | FAANG data science isn't chill | vlog 1
A hard work day (ft. new NLP project) | FAANG data science isn't chill | vlog 1
Tina Huang
30 The comments sections are WILD | YouTube sentiment analysis - Data science project for beginners
The comments sections are WILD | YouTube sentiment analysis - Data science project for beginners
Tina Huang
31 Do you have what it takes to be a great data scientist?
Do you have what it takes to be a great data scientist?
Tina Huang
32 How to learn data science in 2022 (the minimize effort maximize outcome way)
How to learn data science in 2022 (the minimize effort maximize outcome way)
Tina Huang
33 A productive day as a data scientist | day in the life of a data scientist vlog #2
A productive day as a data scientist | day in the life of a data scientist vlog #2
Tina Huang
34 How to learn math for data science (the minimize effort maximize outcome way)
How to learn math for data science (the minimize effort maximize outcome way)
Tina Huang
35 Internship that made me rethink my career...(technology summer analyst at Goldman Sachs)
Internship that made me rethink my career...(technology summer analyst at Goldman Sachs)
Tina Huang
36 How to get a data science job
How to get a data science job
Tina Huang
37 cake and big sister advice ๐Ÿ–ค
cake and big sister advice ๐Ÿ–ค
Tina Huang
38 the most underrated data job in 2021
the most underrated data job in 2021
Tina Huang
39 My career changing computer science masters degree in 15 minutes (Upenn MCIT)
My career changing computer science masters degree in 15 minutes (Upenn MCIT)
Tina Huang
40 Data science interview tips (product and technical interviews)
Data science interview tips (product and technical interviews)
Tina Huang
41 Needed to learn javascript in 3 hours - would not recommend
Needed to learn javascript in 3 hours - would not recommend
Tina Huang
42 from management consultant to software engineer | Humans of MCIT
from management consultant to software engineer | Humans of MCIT
Tina Huang
43 Overview, Review and Study Tips - Google Data Analytics Professional Certificate
Overview, Review and Study Tips - Google Data Analytics Professional Certificate
Tina Huang
44 Overview, Review and Study Tips - Google Data Analytics Professional Certificate (condensed version)
Overview, Review and Study Tips - Google Data Analytics Professional Certificate (condensed version)
Tina Huang
45 Watch this video before applying to Georgia Tech OMSCS
Watch this video before applying to Georgia Tech OMSCS
Tina Huang
46 How to self study technical things
How to self study technical things
Tina Huang
47 What's the best certificate for data analysts? Google vs IBM Data Analyst Certificate
What's the best certificate for data analysts? Google vs IBM Data Analyst Certificate
Tina Huang
48 FAANG Data scientist reviews: Datacamp, Dataquest, 365 Data Science
FAANG Data scientist reviews: Datacamp, Dataquest, 365 Data Science
Tina Huang
49 How I would learn to code (if I could start over)
How I would learn to code (if I could start over)
Tina Huang
50 The quant trader interview guide
The quant trader interview guide
Tina Huang
51 We code a trading bot live! @jacobamaral
We code a trading bot live! @jacobamaral
Tina Huang
52 Why you should have a portfolio website
Why you should have a portfolio website
Tina Huang
53 60k cooking and Q&A (ft. Uncle Roger fried rice)
60k cooking and Q&A (ft. Uncle Roger fried rice)
Tina Huang
54 How to self study using MOOCS (Udemy, Coursera, and other online courses) | self study online
How to self study using MOOCS (Udemy, Coursera, and other online courses) | self study online
Tina Huang
55 Data Science SQL Interview Question Walkthrough | SQL Sundays #9
Data Science SQL Interview Question Walkthrough | SQL Sundays #9
Tina Huang
56 Watch me build my portfolio! | How to create a portfolio website
Watch me build my portfolio! | How to create a portfolio website
Tina Huang
57 How I stop myself from burning out
How I stop myself from burning out
Tina Huang
58 How I take notes - Tips for efficient note taking that speeds up learning
How I take notes - Tips for efficient note taking that speeds up learning
Tina Huang
59 How I design effective study plans for ANY SUBJECT (and stick with them) | trading, coding etc.
How I design effective study plans for ANY SUBJECT (and stick with them) | trading, coding etc.
Tina Huang
60 How I'm learning to trade (forex swing trading)
How I'm learning to trade (forex swing trading)
Tina Huang

This video provides a comprehensive introduction to using Assistants API for building GPT apps, covering the basics of LLMs and API development. Learners will gain hands-on experience with building GPT apps and integrating LLMs into their applications. The video is designed for intermediate learners who have a solid foundation in CS and Programming.

Key Takeaways
  1. Sign up for Brilliant.org
  2. Complete CS and Programming levels 1 and 2
  3. Learn how LLMs work
  4. Get familiar with Assistants API
  5. Build a GPT app using Assistants API
๐Ÿ’ก To build effective GPT apps, it's crucial to have a solid understanding of LLMs and API development, as well as hands-on experience with Assistants API.
๐Ÿ”’ Pro feature: Ask AI to explain this lesson โ†’

Related Reads

๐Ÿ“ฐ
Build, Observe, Fix: A LangChain Agent Walkthrough
Learn to build and fix a LangChain agent to improve its accuracy and reliability
Medium ยท Python
๐Ÿ“ฐ
Build, Observe, Fix: A LangChain Agent Walkthrough
Learn how to build, observe, and fix a LangChain agent to improve its performance and accuracy
Medium ยท LLM
๐Ÿ“ฐ
I measured every millisecond of my real-time AI pipeline. The LLM was the fast part.
Optimizing real-time AI pipelines reveals that LLMs are not the bottleneck, and measuring every millisecond is crucial for performance improvement
Dev.to ยท G
๐Ÿ“ฐ
The Token Ledger Digest โ€“ 2026-07-19
Learn about the latest price reductions for MoonshotAI's Kimi models and how they can impact your large-scale code or reasoning workloads
Dev.to AI
Up next
5 Levels of AI Agents - From Simple LLM Calls to Multi-Agent Systems
Dave Ebbelaar (LLM Eng)
Watch โ†’