CHATGPT INTRO - Silicon Dojo Seminar

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome back as you know I am Eli the computer guy and this is silicon dojo silicon Dojo is a thorialist gatekeeperless free to end user Hands-On technology education here in Asheville North Carolina that empowers our students to do whatever the hell it is that they want to do now I will remind you that free to the end user is not actually free right our classroom costs money to rent every month uh computers cost money big screens cost money lots and lots and lots of stuff cost money so if you want to support what we're doing here we do work for tips there's a link down in the description for donor box if you could click on that link and throw in a few dollars a month and to support this project that we're trying to do and that would be awesome so the seminar that we're going to be doing today is the chat GPT API so I did this seminar here in Asheville North Carolina a couple of days ago and as things go uh open AI uh came out with their Jackie pt4 API literally two two hours two hours before I did this particular seminar so if you're about to watch this and you're wondering about the cat gpt4 API all I've got to say is yeah I don't really know how the API works because one of the important things to understand is that for most people we do not currently have access to it so the chat kpt4 API came out now large Enterprises large organizations they may have access to that API but most of us we are on a wait list and we may be on a wait list frankly for quite a while so when we do we're talking about the chat KBT API AI today I'm going to be showing you how to use the DaVinci model so chat kptpt 3.0 I'm going to be showing you how to use the 3.5 model that's the one that everybody has been using for the past couple of months I'm also going to be showing you how to use Dolly that's the image creation model that they have and I will be showing you how to use whisper and Whisper is the the audio tool where basically you can upload an audio file and turn it into text now I know you may be sitting there and be thinking well buddy Eli but Eli if you're not going to be teaching chatpt 4.0 why why should I watch this video when it's already obsolete the reason that would be good to watch this particular seminar is because the old models don't actually go away one of the interesting things that I'll show you in the seminar is that the answer is given by The DaVinci model and the answer is given by the 3.5 model are actually very different and there's reasons why you might want to use an older model versus a newer model when you're trying to create your particular project right so all the models that have been created they're good at doing specific things they actually have a way of speaking again one of the things that I'll show you a way of speaking that may be important for you when you try to parse the text coming back right so again when we talk about an API it's important to understand you're actually going to be creating a program that programming is going to be sending a request to chatpt the chat GPT is then going to send back a response and then that text response that you get you are going to have to parse and format into something that the end user is going to care about one of the things that you'll see is with the the turbo model the 3.5 turbo model is it's a little bit more verbose and kind of weird I hate to say politically correct ways it's kind of like the AI is trying to be politically correct and it doesn't really understand how to do it so you just get like lots of sentences that are basically worthless but basically what chat kpt is is doing is it's like don't blame me I'm just an AI and why that's important it's a little bit funny to when you when you actually take a look at it but why that might be important to you is if you're trying to parse that response um the 3.0 model doesn't have all that weird politically correct AI crap and so it actually can be a lot easier for giving a cleaner response to give your end user versus the 3.5 model has all this disclaimers attached to it and then for you as a coder you're gonna have to remove all those disclaimers and so it might be easier to use an older model so that's the thing like when the chat kpt 4.0 comes out when you're actually able to use it one it's actually going to cost more money to use because a more powerful model so it may not matter for whatever it is that you're trying to do and also it's manner of speaking um might be such that you realize that it's actually easier to parse the responses from older models so that's that's just something to keep in mind with this particular seminar okay so I'm going to tell you a secret I'm going to tell you a secret and to be honest this might get my geek card taken away so so take this to heart one of the ways the technology professionals like me continue to get paid a lot of money many times for doing slightly stupid tasks is because average people people users think what we do is much more complicated than it actually is and so they go I could never do that here take a lot of money and solve my problem right this is important we start talking about things like artificial intelligence because there's a lot of people out there and they're like Eli Eli I could never do artificial intelligence I'm not good at math I don't understand statistics you know all that fancy coding I just can't get it through my head Eli I'm Gonna Leave AI to other people well here's the thing I'm gonna tell you I'm going to tell you a secret I'm not actually that great with math I did take a statistics course in college I will say I passed it I think I passed it with a c but here's the deal it doesn't actually matter right we're not really dealing with AI we're not really dealing with artificial intelligence we're dealing with an API apis are not AI apis give us access to Ai and what this means is basically we can write 10 lines of code in Python and get all the power of AI while having no clue how we actually get the response that's the amazing thing with the modern world it's something we call serverless architecture the modern architecture system is great basically you write a few lines in Python you then make a request up to a server the server does something fancy don't get me wrong the open AI people the people that created open AI they are smart they have worked hard they're brilliant and what we're doing is we're just connecting to their infrastructure and simply getting a request back and so all of this is a lot easier than you probably will realize all we're doing really all we're doing is we're figuring out a query to send up the chat GPT like what's the best query we can send basically what's the best question we're setting that up then we're literally getting a response we're getting a text response ASCII text response and then we simply have to parse ask you text right that's not hard a nine-year-old can parse ASCII text so just kind of keep that in mind when we're dealing with these types of systems um is even though artificial intelligence itself yes that is a very complicated uh field of study what we're going to be doing with dealing with ap with uh with AI through apis as you'll see is many times it's somewhere between four to ten lines of code and I swear to you you will be able to follow along so here's the point in the seminar where I have to say a warning Will Robinson warning this is where I have to pretend to be a professional for a couple of minutes and talk about the things that professional technology professionals should really focus on right one of the big issues we have in the tech industry right now is you know Tech professionals they want to focus on apis and they want to focus on databases and blockchain and all kinds of stuff like that and they don't want to focus on laws and regulations and maintenance contracts and licenses and that type of thing and what I'll tell you is when you become a real technology professional you know sometimes most of your day is wrapped up in figuring out licensing schemes and that type of deal and very little of it might actually be writing code is a big thing to think about why this is important when we start dealing with artificial intelligence is because in the United States with our legal system our legal system system grants copyright protection to humans right so copyright protection if you draw a picture if you write a script or a book right you basically have a monopolistic ownership of that material unless you sell it or license it to somebody else the human the human that created the material gets a copyright the human if an a i creates a material the a i does not there is no copyright it's not only that AI doesn't get the copyright nobody gets the copyright so I think about this with um there was the monkey picture have you seen the monkey selfie picture one of the cutest pictures you're ever going to see right so there was like there was a photographer flew off to Australia or Valley or somewhere anyways had his camera had his camera sitting on the ground and a monkey came up literally picked up the camera flipped it around and the monkey did a selfie of itself and the amazing thing was it was an amazing selfie because it was right in the monkey's face the monkey was a beautiful monkey the monkey was having a fun time it was one of the greatest pictures to ever be taken right so anyways so the photographer who owned the camera and had done everything up until the point the monkey had picked up the camera in order to make this happen basically took that picture and then started licensing it out right for posters and mugs and all that kind of stuff well somebody actually took that person that photographer to court to say that they did not have a copyright because the monkey took the picture so even though the photographer had to go there even though it was a photographer's camera even though even though the photographer had to take it and actually sell it to the world because because the monkey took the picture there was no copyright a monkey is not able to have a copyright and since the human did not take the picture therefore a copyright did not exist um there was a there is currently a court case that just went through and there was a comic book that was created and it came from the court it came from the judge that the script for the comic book is copyrightable but because they used an AI Graphics generator in order to create the pictures for the comic book those pictures are not copyrightable so this is an important thing to think about because a lot of folks you know when you're thinking about creating material blog posts or whatever else a lot of folks right they're thinking well if I can get a blog post you know created for two cents or something that's worth it but realize you're not going to own the copyright on it so if you do anything creative right and you create again something like a comic book or something like that you will not own the copyright on that material so if anybody else in the world wants to copy what you're doing and slap it on t-shirts or coffee mugs or whatever else they will be able to do that one of the things in the content world is that many times the merchandise the amount of money people can make for merchandise is actually more than the original product that they created so imagine if you use AI to create a comic book character or AI to create a book and it creates some kind of amazing character for the book If you publish that you don't actually own that character you don't actually own that material somebody can literally copy and paste everything that you published from the AI somewhere else and you have no legal recourse so be very careful about this I can see this being a very big problem let's say with startup company so imagine you have a startup company you don't want to pay a graphic card it's 100 150 an hour to create buttons right so you have your little iPhone app or whatever else you know you need Graphics you need buttons you need logos you know I need all that stupid stuff imagine if you use AI basically to create the entire look and feel of your app and you do not own the copyright to it you you think piracy is bad now you think copycats are bad now imagine when when people are copied truly copying what you're doing copying pasting what you're doing and you can't even pretend to have legal recourse against them this is something that you really have to think about paying a graphic designer a hundred and fifty dollars an hour may actually make a hell of a lot more sense than having Dolly come up with something for two cents if at the end of the day you can out and out own the copyright for the material that's created so just kind of keep this in mind as far as Dolly and uh most of the stuff that comes out of chat GPT is concerned uh you can you can create the images you have the right to reprint them sell them put them on merchandise the whole nine yards so if you do create something with dolly or whatever else you have the right to put it on merchandise just realize somebody can take a picture of it put it on their merchandise and uh and make money off of what you feel like you created this is something to keep in mind so now let's talk about tokens so tokens are the currency of the chat GPT world and you're sitting here and you're like well wait a minute why do we need a currency for the the chat GPT World why don't we use just normal currency dollars or Euros or whatever else the reason is is because that would make too much sense remember the modern world of the technology business is to confuse the customer to such a degree that they're not even sure what they're buying anymore and I really do bring that up with this whole thing with tokens because tokens are weird so a token as far as documentation is concerned might be four characters a b c d it might be four characters I looked at the documentation trying to figure out what a token actually the value of a token within the system and it may be four characters or maybe three characters or maybe two characters or maybe a couple words it kind of depends on how the AI breaks down the token count it doesn't really matter tokens are incredibly inexpensive it costs you uh a fifth of a cent for a thousand tokens but again remember in the Enterprise world in the production world where you're just you're just churning through and basically hammering the hell out of the API understanding that the pricing model is a bit wonky you know that that might that might help you out for making sure you don't go bankrupt from using this API uh the other thing with the tokens just to keep in mind is that tokens are used both for the query and for the response right so many times whenever we use apis we think that we're only going to get charged for the response so like send an SMS message send an email so we know we're going to get charged for that email sent we know we're gonna get charged for that SMS set the important thing to understand with chat GPT is you get charged for the query in tokens and the rest bonds so if you say please tell me a story about unicorns and clowns that query will cost you tokens and then the response one day a clown ran into a unicorn blase blase blase blase that will cost you tokens and then there's a total token cost that you'll be given when you get the response back from chat hept so this is just an important thing to think about this gets uh even more significant with the chat Ki bt4 model again even though we're not really getting into it because with chatgpt4 you can actually give 8 000 coins per per query so you can put up with 16 pages of information into the query and then ask for a very simple answer so most of the cost may actually come from the query and a very small amount of the cost may actually may come from the response and so this is just kind of one of those calculations you have to be thinking about again in the Enterprise world to be clear with these tokens the prices we'll talk about the prices a little bit more in a second these queries are so inexpensive onesie twosy it doesn't matter so when I when I created my account and I got the the API key they give you 18 of free credits when you first start out with everything that I have done so far I've spent like two bucks and so that's with all of my testing all of my playing classes the whole nine yards I've spent like two bucks maybe so that's one of the things with this it is still pretty inexpensive but again if you're thinking about that Enterprise world you're having a hundred thousand users a day hit your infrastructure a very small small small costs can get very large very quickly okay so pricing okay as we talked about the tokens so what is what is the actual dollar value of this stuff so coming coming from kitbt multiple models each with different capabilities and price points prices are a thousand tokens you can think of tokens as pieces of words where a thousand tokens is about 750 words so that's where they're saying now maybe it's 750 words this paragraph is 35 tokens right so this paragraph right here would cost 35 tokens to write out now when you first hear that you're like oh wow 35 tokens kind of expensive but again they're weird model for tokens and all that if you come down here and you look at it so the chat GPT 3.5 turbo model it costs two or I'm sorry it costs .002 dollars so it costs one-fifth of a cent one-fifth of a penny not five pennies not a penny a fifth of a penny because a fifth of a penny for 1 000 tokens so if this is 35 tokens and it's a fifth of a penny for a thousand tokens then I don't know this isn't very much money right so again that's where we we talk about we're trying to try to figure out how much this stuff costs uh can be a little bit confusing because each query or response actually costs so little but then it builds up the more and more queries that you hit the system with but this kind of gives you an idea here where you will get hammered so do be careful about this right so when you're dealing with track EPT The DaVinci model the the turbo model or even the gpt4 model it's not going to cost you a lot of money where you can get into trouble though is the dolly model so the dolly or is it where you give a query and then it spits out an image for you so there's different image sizes resolutions 1024 512 and 256 a 1024 image comes out to 2 cents per image a 512 image comes out to 1.8 cents per image and a 256 image costs you 1.6 cents per image now that still that still seems incredibly cheap why are we even talking about it it's so inexpensive well the reason is is when you ask a chatgpt dolly to give you an image it's going to give you a very weird image right really when you're using Dolly what you want to do is you're most likely going to do is you want 10 images you want it to produce 10 images and then you'll pick the one you want when we go through and we look at the python script I'll show you this there's actually a variable that allows you to put a number of images you want Auto created and many times you'll put that to 5 or 10 just because you're going to get so many bizarre images that you need to get 10 out to find one that might actually be useful well that's where this can get expensive if you're doing 10 24 images at 2 cents a piece if you do 10 images per run of the script that's now 20 cents right 10 times 2 is now 20 cents per run of the script if you run it once don't really get images you want like you run it again you run it again you run it again all of a sudden Dolly can run through your budget shockingly quickly so that's one of the things just to keep in mind here is Dolly might actually get pretty expensive for for you or chat GPT the actual text should be rather inexpensive these are the things just to keep in mind uh in order to pay for the pricing basically when you go to China GPT you set up an account you get your free 18 you know to play around with within the settings menu there's actually a little link down by billing so you click on billing and there's a place to put in your credit card information from there you can put in your credit card information and then you can actually you know you can buy as much Service as you want one of the things that I will warn you though is there there are limited so you can set like a monthly limit for how much you want to spend per month for chat qpt and I will highly recommend that you do that the reason being is right this is an apis you're going to be using python in order to connect to the API process what comes back well what happens if you or one of your employees or interns does a while true Loop while true continuously Hammer the hell out of the API and get a response right might not be thinking about or they do a loop that will never be true right they they screw up the uh the greater than or the less than thing so basically it never gets to never gets to true and so all of a sudden you're literally hammering the API literally as fast as your computer can run all of a sudden you know that that fifth of a cent for a thousand tokens might wind up to be hundreds or thousands of dollars if somebody does something truly stupid if if you do that with Dolly some kind of that you know wild true Loop that could be brutally expensive so when you put your credit card information in as soon as you do that go over and set your monthly cap just to make sure this thing doesn't make you go bankrupt so let's talk about the different models for a second again can't keep pt4 is now out we do not have access to that particular model the models that I'm going to be showing you today are GPT 3.5 turbo and DaVinci zero zero three uh now there are some differences when you use these models right so with a 3.5 it's the most capable 3.5 model is optimized for chat at one tenth the cost of DaVinci will be updated with our latest model iteration one of the important things with this is whenever you're looking at the models and which model you're going to use is look at when the training data has been updated until right so if you're going to ask a question you want to make sure that it actually has learned about that particular period of time so we can see here the training data goes up to September of 2021. so if you ask about 2020 something that happened in 2022 or 2023 it is simply not going to understand uh you know what you're asking about so it'll fail out if we go down here and we look at DaVinci can do any language task but better quality longer output and consistent instructions following better than Curry Babbage and Ada model so there are other models that you may play with with this the the training data comes up to June of 2021 right so these are the two models that we're going to be dealing with today now one of the important things is you're going to have this model endpoint compatibility so 3.5 turbo gives you V1 chat completions so when you're actually parsing the response that comes back there's one way that you do that with the turbo and with DaVinci zero zero three you're going to see the endpoint is V1 completions I'm going to show you a little bit more about those endpoints in one of the next slides but it's just one of those things to keep in mind when you switch models not only are you switching the training model but you're also going to be switching how you ask how you actually input the query into the API and when the response comes back you actually have to format uh the the how you parse the response the response properly or you're not going to get the text that you're looking for now one of the things again what's very important here is again this is just a whole bunch of verbig so you may not fully understand the difference between the models and again why you might want to use DaVinci versus like one of the latest models and for that let me actually go show you some code to show you how the turbo model is much more weirdly verbose than the DaVinci model is to kind of give you the idea of a practical difference between these two models so here's some code that I've written up in vs code and basically what we're going to be doing with this code is we're going to create a query so the query that we're creating today is does God exist and then what we're going to do is we're going to feed this query first to the chat GPT 3.5 turbo model and then we're going to feed it to The DaVinci model now I know some of you are going to be like look look Eli Eli is showing us the API key he's dumb um no I'm just gonna delete this API key afterwards that's how it works right uh so if you are going to be doing this in the real world just to be clear you would actually put your API key into something called an environment variable and then you would call the environment variable and the reason that you would do that is so nobody can just simply screen capture what your API key is the reason that I put my API key here is to make this more understandable to you again please do realize whenever I do classes whenever I do seminars I always try to simplify this to make it as easy for people to follow along as possible and so getting into environmental uh variables and all that is an extra step of complication so I just want to show you how you can do this very very simply but if you go when you try to copy and paste this API key it'll be deleted long before long before you're watching this particular video so anyways again this is python so in Python you always have to import the module that you're going to be using so import open API or open AI uh so with open AI in order to install this onto your computer you'll use pip so it'll be pip install open AI and then the package is installed and then you can call the module so first you're going to call the open AI module then you're going to feed the open AI module the key and so this is going to be the key whatever key that you have then for us we're going to create a query so the question is going to be does God exist I'm going to print out question and what the question is just again it's kind of like a troubleshooting things we know what question that we're sending then we're going to have the response so this is the function for chat EPT uh 3.5 turbo open AI chat completion create we're going to use the model we're going to talk about this later basically this is how you send the question the query to this model and then we're going to print out turbo says and then we're going to print out the response so this this right here is the text that we're going to print out then we're going to go down to the DaVinci model right and The DaVinci model you'll notice is a lot different so response equals open AI completion create we're going to give it a model we're going to give it the prompt The Prompt is that question we had there's temperature so temperature is a way to kind of dial in the quality of your answer um if you're if you're really doing this for the Enterprise world or whatever you can play around with temperature for most people they don't have to worry about it Max tokens so this is important so you'll notice with an eventually model and ask you what are the most number of tokens you want to use for this this can be very important because it's going to use those tokens to spit out a response and if you do not give it enough tokens it will literally stop in the middle of the response and it'll still cost you however many tokens it gave you right so when you cut when I copied and pasted this code when I was originally playing with this the max tokens was 60. so many times when I ask a question remember the query cost tokens and the response cost tokens so many times when I'd ask a question it would literally get halfway through a sentence and just fail so that's just kind of one of those things to keep in mind so with this I'm giving it you know 500 tokens so that it can uh oh you know actually spit out a decent response for us we got frequency penalty and presence penalty again that's that's stuff to worry about later then we're going to print out DaVinci says and then this is a different so for DaVinci you actually have a different format for how you print out the the response the responses choices as zero index at text and that's going to spit out a response for us and so we can go over here to our nice little command prompt hopefully that's big enough for you folks to see um I'll do up up so python compare hyphen test dot py so this will compare I will hit enter so question does God exist and again I'm not I'm not getting into any stupid stuff I'm just I'm just showing you their response don't lose your minds please um and we'll notice so this is actually connecting the API and this is taking a couple of seconds to run again one of the things to be thinking about with whatever uh program that you're creating is how fast does it need to run um so different models have different speeds so that's one thing to keep in mind uh and so here we go so turbo says turbo says this is 3.5 turbo again and this is where I say we get this weird political correctness it's like come on turbo come on anyways as an a an age model I cannot answer whether God exists or not as it is a matter of personal beliefs and opinions different people have different beliefs about the existence of God and it's a subjective talk topic that varies with individual perspectives right so that's 3.5 that's one of the newer models DaVinci says the answer to this question is a matter of personal beliefs right so what you have to be thinking about as a technology professional as a coder is which one of these answers do you want to parse which one of these answers do you want to have to create code to dissect and then spit out a response that the user is going to care about right because again with this as an AI language model I cannot answer right like you're going to want to strip that out right so if you're if you're a user asks a question let's say about God or whatever and it gives you this you're actually going to have to code to strip that garbage out because nobody wants to see that garbage they just want the the last sentence so this is where like with DaVinci it might actually make a lot more sense to use that older model because it gives you a much more concise and clear answer right so this is one of the important things again when we're thinking about that difference so many times people think oh the latest model is the greatest that's the one that we should use but sometimes you know the newer model actually gives you a lot of extraneous information that actually is a pain to deal with as a coder now let's take a moment to talk about the end points and how to parse the response that you're going to be getting back versus when you're using a chat TPT 3.5 versus chat GPT 3.0 and again this is something to keep in mind when you're trying to figure out how to deal with 4.0 right so again I talked about before the end points and basically the end points is how the information the response is sent back to you so when you're dealing with the python World whenever you have like a named key array or what you would think about like a named key array in PHP or something like that that is called a dictionary in the python world and a standard array that you might deal with again in something like PHP is called a list in the python world so when you have a dictionary you call a key by its name and when you have a list you call by the index number right so when we're trying to print out the text right I'm going to try to print out the text hello there how may I assist or this is indeed a test what you're going to have to do is you're actually going to have to be able to print that out and understand how to get to that level so if we look at the the 3.5 model right we can see that this opens up as a dictionary so let's see if we come over here you would put so uh it's a response and then you do double quotation marks and then you would do choices so choices is where the content is right so then we do choices and then we close that and then we'll notice under choices we open up a list so we open up a list there's actually only one item in that list so that would be at index number zero so we'd use index number zero then we come down and then we see message so there's a dictionary for message message and then we come down again and we see content and there's a value for content so if we're using chat GPT 3.5 when we're going to print out the text for a response we would do response choices at index 0 message content and that would print out this text right if we go back uh to chat uh GPT three uh 3.0 so text defensory DaVinci 03 right so we can see here uh we have choices again so we have choices like we have before oops uh so we do response and we do choices and then we come down and we look at choices okay we have that index zero so this is this is a list that bracket means we start a list so that would be at index 0 of that list and then we come down and we see text so then it would be a text so if we're printing out from a cat GPT 3.5 this this is how we would format it in order to be able to print out the text if we're going from 3.0 this is how we'd format it so that's just one of the things when you're getting that response just to understand how lists and dictionaries work so you can actually get down to get at the value you want that's just an important thing to understand again it's not too hard it's not too complicated if you can just sit there and you just very slowly you're like okay so this is where it opens so we go to choices choices we go to index 0 index 0 we go to message then we go to content that gets us what we're going for we come here it's like okay so go to choices we go to index 0 we go to text that gets me what I'm looking for uh if you're going to be coding something more complicated maybe you want the total number of tokens maybe you want the the created time stamp or something like that and so basically you would go through and you would basically go through this process in order to figure out where the value is that you're looking for but when we're talking about the endpoints and how to print out the text that you're looking for from these endpoints this this right here is what we're discussing so we've done a lot of talk talk talk let's actually start doing some some demonstrations so you see how these different models work so first we're going to start off with the DaVinci model so you get an understand of the response that chat chat kptpt 3.0 can give you and we'll go through some examples we're going to tell it well we're going to have it tell us a story we're going to have it write some code we're going to have it right like a blog post with HTML formatting and we're going to have it communicate with an employee just to show that it can do all these tasks surprisingly well so here's the code for DaVinci this is what I kind of showed you before but we'll talk about a little bit more here right so we're going to import the open AI module as we do we are then also going to add the API key again this API key will be deleted by the time you watch this video then we're going to have a response right so the response is going to equal the open AI completion create function right so this is going to send our prompt to chat GPT and then the result we get back is that big endpoint mess that I showed you before and then we're going to pull out the text that we want so the model that we're going to use is text DaVinci zero zero three we're going to give it a prompt so we're going to do that in a second a temperature again we're not going to worry about here a Max token so we're going to give it a thousand tokens that's right we're balling we're going to give it a fifth of a cent in order to do this we're not going to deal with a top P or the frequency penalty or the presence penalty or any of this again the temperature and the top P frequency and presence you should only play with those if it actually really matters to you for the most part it generally doesn't past that what we're going to do is I'm going to print out the entire response so you see what the entire response looks like and then we're going to print out just the text from the response so you can see that so let's see here so what is the prompt so the first thing that I want to do do is tell a story tell a story so um tell me a story about a frog and a unicycle because that's the kind of person I am I mean if we're going to do this we might as well make it interesting we're going to do control s so we're going to save we're then going to go to the prompt hopefully this isn't too big so it um goes through anyways uh so what was that DaVinci test d-a-v-i-n-c-i test oops open AI DaVinci uh okay uh python three it's good if you remember the uh the names that you name stuff open AI DaVinci okay so this is going through it's coming up it's coming up with a story about a frog and a unicycle let's see what it's gonna give us it's gonna take a little bit there we go there we go so we got our response if we scroll up if we scroll up uh so what we're going to see here is the response right so choices as I showed you before choices um then we come down to index 0 and text so choices index 0 text and then this is all the text that's printed out uh then we can see when it was created we can see the total tokens that were used so the completion tokens it was 306 tokens to complete the task The Prompt tokens were 11 the total tokens were 317 and then the story that we get once upon a time there was a frog named Fred named the Frog who lived in a pond near a small town Fred was very adventurous frog and he loved to explore the world around him one day Fred decided to take a walk around town as he hopped along he noticed a unicycle parked outside a store Fred had never seen a unicycle before and he was fascinated by it he hopped closer to take a better look suddenly the unicycle started to move Fred was so surprised that he jumped back in shock the unicycle was being ridden by a small girl who was laughing and having a great time Fred watched an amazement and anyways we're gonna keep going look at that pretty good that's that's my kid if I had a kid and my kid asked me for a bedtime story they would be cat GPT all the way no more Walden books No More Barnes and Noble I mean look at the quality of their writing Fred was a natural he hopped onto the unicycle and was soon riding around town like a pro everyone was amazed at how well he could ride the unicycle so it literally just completely invented this story which is an amazing thing if we wanted to write some code so this is a big thing right you know with what I do one of the issues that I run into is I deal with so many different Technologies many times I deal with different coding languages and so I don't need to be an expert in all these different coding languages many times I just need to solve a problem so I can literally just ask it how to solve a problem for me um how do I turn a query set into a dictionary in Django right so I've been playing around with Django Django is the web app framework for python when you query the database you get back something called a query set that query set isn't a dictionary so sometimes you need to be a dictionary so my question here is how do I turn it into a dictionary so that I can I can fuss with it if need be right hit Ctrl s to save it I then go here python open AI DaVinci dot pi it's processing again 67 tokens uh we're done so you can use the dot values method on a query set to turn it into a dictionary so my query set equals model dot objects all my dict equals my query set dot values and so then we can plug it in to Django and see if it works generally this code does work what I'll find what I'll say is kind of interesting when it gives you these code responses is as I've talked about before there's 20 ways to scan a cat in the technology world and what's kind of interesting is almost every time I ask you this question it gives me an entirely different response but this can be very valuable again you know I think about this you know I've got these little robot cars and things and so the back end of it they use Python right they use Python but for the front end we need JavaScript sometimes to do certain things and so I don't know certain things in JavaScript basically I just need I need how do how do I trigger a python script from java a script doing something right and so it's kind of cool here is you can just come in and ask it and it's not like Google like when you ask Google a question you get a thousand responses then you have to click on different things and then you have to you know you have to scroll through banner ads and pop-ups and whatever the hell the person is talking about what's really great with this is it just spits out an answer if you don't think this answer is right you can run it again we'll see if it gives me a different answer this time yep and it gave me the exact same answer oh well but again you could try to run it again or you could ask your question slightly differently to try to get a different response so this is again actually getting those code examples is great now one of the things too which is cool with this is that you can actually tell it to format the text in HTML so one of the uses you know for chat PPT is to automatically write blog posts or write articles if you get back pure text one of the problems is is that a web browser doesn't print out pure text most of the time how you want it to be printed out right you need the HTML tags so what's kind of cool here is you can actually tell it to do something with HTML tags tell me how to pour a cup of milk and format answer in HTML all right we hit Ctrl s complicated things like pouring milk and then we're gonna go here we're gonna do this we're gonna see what the response is I have no idea I I just pull these kind of questions literally out of my buttocks and we see what happens there we go okay so P two pour a cup of milk um ordered list so numbered list number one list item gather a cup close list list two open the carton list three list four close uh close the order list down here so that actually gives you the full description on how you can pour yourself a glass of milk again all completely formatted in HTML so you know if you're trying to do like a history blog and you want to do the Battle of Hastings for some reason I keep thinking about the Battle of Hastings for some reason anyways you want to say hey I want you to create a blog post about why the Battle of Hastings occurred and format it with HTML right you get back this response and then you could literally dump this response directly into your database and then call it from WordPress or whatever else to print out on the screen and that's your automatic web page for you right that's one of the cool things that you do one of the other things you can do is do communication this is what we're going to see more of oh I used to like Salesforce I used to like Salesforce I think I might hate them very soon so Salesforce has talked about this they feel that cold calling is a low value task for their sales people Lord help us Lord help us spaghetti monster help us so anyways they want their sales people to be on High level tasks not low level tasks so what they want to do is they want to have chat hept automatically create like cold email emails cold call emails to potential clients in order to try to get them as clients and so you can actually have cat EPT create these emails um you know spam is only going to get worse oh my golly spam was bad before we had AI we are now going to have ai driven spam um so um create okay so we can do is create an email to Sue Perkins and so this could be a variable value to just dump in there and and ask her if her if she wants to buy my ice cream maker for ten dollars right yeah pretty simple task control s then we're going to go hear the terminal we're going to clear we're going to print that out open AI DaVinci and dear Sue Perkins I hope this email finds you well I am writing to ask if you would be interested in buying my ice cream maker for dollars it is an excellent condition and I think it would be a great addition to your kitchen if you are interested please let me know and I will be happy to arrange a time for you to come and pick it up thank you for your time and I look forward to hearing from you sincerely your name yeah a lot of people a lot of people ask me am I excited about AI no no and I'm not I am not scared of Terminator I am not scared of War games I am scared I'm the sheer Deluge of spam that we are about to get but anyways this shows you what DaVinci can do and to be clear DaVinci is the 3.0 model this isn't even the 3.5 model or the newest 4.0 model so now let's talk about the 3.5 turbo model so the coating for the 3.5 model is different than the DaVinci model but it's you know it's five different lines of code it's not too complicated one of the interesting things with the turbo model though is that you actually assign roles to kind of nudge the model in the direction you wanted to go so one of the big things to be thinking about as a coder as a technology professional is reusability is one of the most important things whenever you create any kind of technological product how can I Re-Use this code as much as possible and so one of the nice Parts with the turbo model is you can like write a question and then with these roles you can nudge it into the particular direction that you want it to go so with the example that I'm going to show you in a minute is going to ask basically you know who who was the leader in the year 2000 right well so think about this from the from the user's perspective the leader depends on where they're from are they from the United States are they from the UK are they from Brazil the answer that should be given will depend on what country they're in so what you can do is with the roles you can nudge it into that direction so it basically answers the question for a Brazilian or foreign American or foreign English person right and that's one of the useful things we can do with the turbo model so here's an example of the code for the 3.5 turbo model as always we import the open AI module uh as always we have the API key and then what I'm doing here is I'm creating a variable with a value so that we can tweak the answer that we're going to be receiving so this variable value this could be coming from a database this could be coming from a some kind of value in a form this could be getting pulled from anywhere I'm just doing a static value here to make it easier for you to show you show your folks so response equals so the response we get back is going to equal open AI dot cat completion create function we're going to ask it for the the model GPT 3.5 turbo and then the message is right these are going to be the messages that are going to be sent to chat GPT 3.5 to try to refine the answer that we're going to be getting back when we look at roles there are three roles with chat GPT 3 3.5 there is the system role so the system role is basically where you tell Cat EPT what kind of character should they be playing so basically like here I say you are an advisor so basically you could say as as a per you know as some famous person answer this question or as the president of a country answer this question or as a three-year-old right what character profile should you be using to answer this question that will that would change the grammar and basically how things are how things are said then we have the assistant and basically what the assistant is when we do the content here is how we we want to not and nudge the the question in a particular direction so we're going to say answer as a and then we have the variable value so answer as a USA citizen so when we're answering this question I want you to answer this on behalf of an American citizen or again Brazilian or UK when we show you those examples and then finally we have the role of user and so the user is the actual question that you're asking so who was the leader in 2000 that's the actual answer so you will have one role we will have one input for the role of system so you foreign advisor you are whatever you put that in you'll have one for the role of user that's the actual question that you're going to be asking and then you may have multiple for the role of assistant to try to nudge uh basically the bias or the direction of the answer to the question so again imagine you have a back-end database for whatever application you have here and you have a whole bunch of demographic information right you know race gender age all of that type of thing and so you create a question and you say I want the most appropriate answer for a woman who lives in California that's above 55 years old right so you can try to nudge it and the cool part is right that's Dynamic so the next person might be a man who's 19 year olds in Alabama you know basically give me an answer the exact same question but bias it based off of this assistant information that I've given we're going to Output the text for this we're going to print out the text first and then have the output response below that um just be oh no I'm sorry we're going to print out the response and we're going to print out the their text below that and so let me just go and do that here so we're going to do clear then we're going to do a open AI Turbo so this is running through so who was the leader in 2000 and the answer is it's a little slow today it was faster truly truly it was faster when I was doing an in-person seminar so that again that's one of the things you have to be thinking about is when you're creating your web application is how fast these answers are going to come back uh so again so we have the uh the response so choices uh so choices at index 0 message content that's the content we have the created time we have the model we have the tokens used 81 tokens so in the year 2000 the leader of the United States was President Bill Clinton however his second term in the office was coming to an end and the country was gearing up for the presidential election later that year so it gave a response and it gave a little bit more additional information again that's one of the things I find with 3.5 it's a little verbose a little verbose not necessarily a bad thing but again when you're thinking about parsing the response it might be an issue for you uh let's see if we go here the nationality of Brazil so exact same question we just simply feed it Brazil instead of USA we hit control s we come down here we clear we run the script again it's taking longer it's taking longer of course of course when I'm doing a video that's the time it would take longer anyways Fernando henrique cardoso was leader of Brazil in the year 2000 he served as the President of Brazil from 1995 to 2003 and was the first Brazilian president to be re-elected for a second consecutive term since the end of the military dictatorship blase blase blase and so what's really cool about this right is that you can have that one question and then simply by changing the variable value you can get a much different answer and this is the the one of the powerful things with this type of AI technology is the is the idea of customizing the answer for the particular user that's asking the question and if you as a tech professional as the coder can extract as much demographic or as much uh you know specific information about that user as possible you can really start slanting these ants to hopefully make the answer as useful as possible to that end user so this is all there is for the the the the 3.5 turbo again these rolls is where it gets really kind of cool the big thing here is you're able to slant the answer to the question based off of these assistants and the assistance you can simply feed by concatenating in the values of variables now when we start thinking about our users asking our web application questions and it going and querying chat GPT one of the things that we have to think about is to make sure that our users get the right answers right because you know there's a lot of different truths out there everybody has their own facts nowadays so how can we make sure that the user gets the response that we think is the most most appropriate free it for them well one of the ways that you can do that is actually concatenate on additional information to the query that is being sent to chat kpt to try to skew the answers in particular directions in ways that the end user may not even think about again one of the the powerful things about AI from a psychological standpoint is for some reason don't ask me why but people think computers are right if a computer says it it is true think about how powerful that is psychologically so if on the back end you can skew answers into a particular direction it's more easy to get people to go along with it whatever your world Viewpoint is look the AI agrees with me so obviously I'm right no you can't audit the back end code well I would let you audit the code but you don't really want to do that so what I want to show you right now is an example of how I was able to concatenate additional information into a particular script and then we're going to Loop through and based off of the type of person that we're saying is asking the question a cat keep PT is actually going to give an entirely different response so this is where things either get fun or they get dark or they get fun and dark all at the same time one of the things I really try to hammer home to to my students whether you come to an in-person seminar or whether you're watching one of these videos is to always remember when you're doing tasks in Information Technology the tasks that we are doing are based off of The Human Condition right again there's this weird idea that somehow technology is pure right so humans are confusing and scary again you have a lot of autistic people in technology world or aspies in the technology World humans are scary technology that's something you can depend on and so you get folks going to technology one of the issues that people forget is that technology is used to solve human problems and many times to solve it in ways that humans want that problem to be solved so when you're doing things like writing code it's important to think about not just loops and not just setting variable values but also thinking about how your app is going to be used and if you kind of need to add a little bit of humanity into that app one way or the other so with this app basically it's again we're dealing with a da Vinci model like we dealt with before the 3.0 model because it's not so verbose we don't want verbose we just kind of want a simple thing here just give you an idea of what's going on uh we have the the open AI module with the API key and then I've created a list here and so the list is called slant and so the in the slant list we have Christian we have scientists we have pastafarian we have Republicans and we have Democrats so one of the interesting things here is just to see what the bias of chat kpt is what does cat GPT think about Republicans Or democrats that's kind of an interesting thing and the other thing is we can actually see how we can skew the answer to a particular question the question is going to be how did the world begin to be clear not trying to get into any argument with anybody I think this is just an interesting one just to throw in there again especially with the modern world right you got the whole intelligent design on one side you got the evolutionists on the other you got the pastafarians just saying hey can't we all relax anyway so we got that question here so what I'm going to do is 4X in slant so this is a for each Loop so for each value in the slant list submit so the the question is going to be how do Christian Scientists pacifier Republicans Democrats think question how did the world begin so how do pastafarian think how did the world begin right we have the the response equals the the create function the defici text model The Prompt so that submit that we created here is a word concatenating right so text concatenating with the string of X concatening away think concatenating with question turns that all into one long string that gets submitted as the prompt we have the temperature we don't worry about the max tokens so we're just going to keep it at 60 to keep it simple here the rest of this and then basically print string so as a and then print out so as a Christian as a scientist whatever and then print out the question and then print out the answer right so this is kind of interesting here hit Ctrl s we go over here open AI test uh so uh Python 3 open AI hyphen test dot p y and so now we can see the evil bias right um so it's printing out so I'll let it finish off as a pastafarian as a republican as a Democrat I think this is kind of interesting just to take a look at as a Christian how did the world begin Christians believe that the world was created by God according to the Bible God created the world in six days and rested on the seventh right so if somebody put in how did the world begin and then it's spitting out that the world was created by God as a scientist how did the world begin scientists think the world began with a Big Bang Theory which states of the universe began as a single extremely hot and dense point if we go down to pastafarians pastafarians believe that the world was created by the Flying Spaghetti Monster according to Church of the Flying Spaghetti Monster the Flying Spaghetti Monster created the the world after drinking heavily right then here's kind of what's interesting here's what's interesting as a republican how did the world begin Republicans generally believe that the world began began with the creation of the universe by God they believe that God created the universe and all of its contents including the Earth and all living things so think about this again we talk about like bias and something like AI Republican is a political party right and they used to believe in low taxes and small government and and a strong military and some other things but think about this cat GPT is literally doing a religious bias on a political party good or bad Democrats and if we scroll down Democrats Democrats generally believe that the world began with the Big Bang Theory which states the universe began with a single infinitely dense point of matter blase blase blase So based off of the concatenation the adding of the bias that we wanted to put into the answer we actually got five entirely different answers and so this is something for you to be thinking about when you're creating your app do you want to concatenate on a few different things just to make sure you get the right type of answer and again it may not even be biased it may not even be biased you may just uh want to concatenate on format in HTML right so let's say you're going to have your users or writers create blog posts about different subjects and now they need to put in format and HTML to make sure it gets formatted but you know employees or employees you can tell them to do something whether or not they're gonna do it's a whole different story so what if you could just have them type in the question or the prompt for a blog post and then automatically concatenate on format as HTML right that might be useful for you or again like the English language is very interesting was you travel around the world is English is not English English in the United States is different than English in the UK which is different than English and Ireland which is different than English and India which may or may not be haven't been a Pakistan may or may not be different than English and Pakistan right so depending on where you're writing or again if you're creating some kind of content farm you may you may plug in you know answer as an American answer as a Brit answer as a Canadian and it will slightly change right the syntax and language that's most appropriate for the target market that you're going at and you can just very easily do that by adding this concatenation directly into the to the The Prompt that's going to be sent so that you don't have to worry about it or tell your employees or your contractors that they have to manually add in that kind of information so now that we've dealt with the text uh responses from chat hebt let's look at the image responses using doll e now I will say if it is close to your bedtime and you're scared of the dark you're scared of the boogeyman or Boogie girl probably leave this for tomorrow dolly dolly is amazing let me be clear Dolly from a technological standpoint is absolutely amazing it's also one of the creepiest creepiest things I've seen in my life um it will it will give you an image and you may have nightmares for a long time from that image um basically when we're dealing with Dolly you're going to give it a prompt just like we've been given a prompt before again there's there's five lines of code essentially we're just gonna I'm gonna go through that in a second one of the big things to remember with dolly is that the URL that you're going to be given is going to be active for maybe an hour again I have not been able to get a definitive length of time for how long the the the URL exists for but it seems like an hour is a decent amount of time right so if you're creating an application and you do like an IMG SRC so basically you're just embedding an image into your website make sure you use wget or make sure you use something to download that image so that the image doesn't go poof after about an hour I think that's one of the important things to be thinking about when you're using Dolly uh past that let's just go over and I'll show you the uh show you the code and I'll show you the very very creepy responses so before I show you the code I figured I'd just show you some of the output you know just so you get an idea where you're getting into it Dolly so now with me I just plug in a lot of weird random prompts to see what it'll give me so this prompt right here as I said a goat on a bus going to battle clowns and so I got like a clown goat driving a bus so we got this here uh this so I was put in a lot of fun I was putting on like a lot of weird things for a while and I was like you know what let me let me let me just ask a normal prompt right so I literally plugged in woman on a bus and this this is what I got this is what I got um look at that face look at that face it's like two left eyes or two right eyes it's just particularly weird I think that's the funny thing with Dolly you get again you give it like crazy give it crazy uh requests and you get crazy responses you give it normal requests and then it just gets really dark uh let's see other things um so I don't know this was like a goat in a bar so it gave that kind of styling there uh a goat a clown and a taco at a bar gives us this um this was funny this was hilarious so I got a little political I got a little political so I was like hey what about a republican in love with a sheep I don't know why I just plugged it in there and for some reason it put Obama there no Mama's in love with his sheep again the responses that you get is so curious this is actually interesting so I said like a goat I was like give me a picture of a goat in World War II and that's actually a pretty darn nice picture I gotta say I don't know goats in World War II Phenom phenomenal I don't know why again this is another goat in World War II it does really well with doing goats in World War II another goat in World War II but not that's that's pretty I would print that out and put that on a wall uh kid kid had a computer it did that a person at a computer it did that a cat attacking a towel it did that kid riding a cat kid riding a cat this is one of the ones I love kid riding a cat so yeah so basically these are some of the different examples just to show you of what um oh what uh what you can get uh so beyond that uh this is the code this is the oops I think I forgot to paste Ctrl V Ctrl s got to put in the right API key again the API key will be deleted before you watch this video Don't okay so for the dolly so import open ai ai key response equals open AI dot image create so you give it a prompt so last prompt was kid using a computer you give it a number so n equals five what this means is it will give you five images at a shot so this means it'll cost you 10 cents if you're doing 10 24 or whatever I'm just plugging in 256 because I don't want to spend that much money so this is the size so this is where you put in the 512 or the 1024 the 256 I'm just doing 256. the image URL equals response data zero URL let's see here we're going to print out the response so you see the URLs the other thing that I'm going to do here is I'm going to open a document Dolly hyphen test.html I'm basically then going to write to it and I'm going to embed these images 4X in response data image SRC string of the URL close and then close so basically what this is going to do is it's going to print to this dolly test file and it's going to embed all of those images using the IMG SRC so we can see everything on one page so I don't know a kid using a computer that's that's too normal for a seminar we're not doing normal here let's see say goat uh uh goat writing a writing a cow on a mountain right that's that's the kind of thing we're going to do around here we're going to do control s obviously make sure it's saved then we're going to go here now clear Python 3 doll e hyphen test dot p y and this is going to go through and it's going to process process process process okay so here we go so those URLs so that response right so printing out the response printing out the response um that is what we're printing out here and you see these are the URLs so we're not we're we are not automatically downloading the images we're simply getting the URLs for the image from here I can simply click on it and do open link and I get that particular picture so there we go um is that a cow anyways we can go here and if I hit refresh there we go so this is this is that web page that I created and so a goat riding a cow on a mountain a goat right in a cow on a mountain a goat writing account Mountain a goat writing a cow in a mountain a goat right a cow on a mountain right and so by having five of these images I can decide which one I prefer right and they're all slightly different so I might prefer one or the other if we go over again I don't know we can do something else weird let's say a kid riding a llama in the the circus no an order control s got a process that simply going to run the script again running running running running again taking a little long did I taking a little long okay that ran again we have that this page that's automatically being recreated every single time I refresh this and there we go the faces are the weirdest thing I don't know can you see that face here um I don't know if you can really see that I don't know Dolly doll e and human faces is just pure nightmare fuel but anyways kid on the Llama circus getting a llama circus get an alarm a circus get on a llama circus get on the Llama circus you know you can plug this kind of stuff in and then you get to decide you know whether or the whether the results or what you're looking for but again like other than the weird distortions of the faces it is it is a surprisingly good now that we've taken a look at the image API with doll e we can look at the audio API with whisper as far as I can understand whisper is now currently like in beta phase so you don't seem to need to give it any tokens when you upload content in order to get a transcript from it so that will probably change somewhere in the future so somewhere with this code you'll probably just have to you know add some tokens or whatnot just kind of keep that in mind it shouldn't be any big deal The Whisper API is wow it is simple wow it is simple it's amazing like like three lines it's not even four lines of code it's three lines of code it's all you need in order to transcribe audio fabulous import open AI you do the audio file so you give it the path to the audio file then you do the transcript so transcribe with whisper one for the audio file and then it will simply uh give you a response you can also translate audio there's like 50 languages that they translate into English so take that as it is I'm not going to get in the middle of that particular argument so you can translate languages into English you cannot currently translate languages from English or from English into other languages but again you know basically pretty pretty simple code here so with that let's go over to the the actual page and I'll show you how this works so this is the code to four uh whisper pretty simple so empor open AI you need to do that you do actually need to give the API key so here's the API key that you feed it but again you're not actually feeding a token so who knows what it's actually going to cost you at the end of the day you're then going to create a variable for the audio file and you're going to open uh the audio file so w hyphen test.mp3 so you're going to do that then transcript is going to equal open AI audio transcribe whisper one for the uh oh for the for the model and then the audio file what you have here and then we're simply going to print out the transcript easy peasy right so if I go down to audacity if you're using Ubuntu audacity is the easiest way to just record off of the microphone and be able to dump it into something like an easy to find MP3 files that's what we're going to do here and um I don't know I'm just going to talk so I'm going to talk some words like I'm gonna I'm gonna be saying words for my class and hopefully the whisper API will be able to determine what words I'm saying then we're going to stop it and then we're going to do file we are going to export I'm going to export as an MP3 so again these MP3 files could be coming from from anywhere you could be export you know you could use handbrake or ffmpeg to pull the audio file out of videos something like that and they're going to do export MP3 I'm just going to select the the W hyphen 3 test that I already had created we will save we will replace it because I'm lazy we're going to hit OK and then we're going to come here I got our command prompt whisper test that's our python script it's going to go through so text so I'm going to talk some words like I'm going I'm gonna I'm gonna be saying words for my class and hopefully the whisper API will be able to determine what words I'm saying so look at that look at that audio audio transcription that easily and the important thing to understand is the technology professional is dealing with audio files is hard turning an audio file into a text file blow your mind that's difficult to deal with dealing with ASCII text that's easy right so one of the examples I saw so fireship fireship is a is a good channel to watch on YouTube and they showed an example where they use JavaScript on a web page so you could push a button to record audio basically to ask the web app to do something uh that audio was turned into an MP3 it was submitted to whisper whisper sent back the text from that audio file and then you're able to parse and look for a command so you could hit the record button and you could say tell me what the weather is going to be you know on Friday uh that audio gets sent to whisper whisper sends back the text and then that text can be used for Chad GPT or any other kind of query that you're going to use so that the user is able to get the results that you're that you're looking for so this you know again this is whisper and it is amazing I mean just look at that look at that four lines of code import key audiophile transcript well five lines and then doing something with the results this is the world that we're currently in now one of the next services that are offered by the China GPT API is moderation so I'm not going to go through the full code on this I think we've shown you enough code at this point but moderation is really good for is imagine you have any kind of communication system and basically you're trying to keep the language clean again uh you have bullying you have trolling you have whatever else you know going on with the communications simply being able to scan those Communications and look for the hatefulness or whatever within that communication might be a useful thing the other thing to look for with something like moderation is just from a management standpoint imagine if you have a system that's constantly scanning the emails or the messages of your employees or the users of your organization just looking for red flags I'm going to tell you something this may shock you but leaders and managers are not nearly as impressive as people want to think they are it's kind of funny right you look nowadays you go to LinkedIn or whatever and you you see what a leader is supposed to be or a manager is supposed to be there's like these 20 bullet points and what a leader is and I always giggle I always giggle I'm like good luck with that you know what a manager is a manager is an employee that has to deal with other employees and here's the deal some of them are good some of them are not so good right some of them need help so one of the things as a manager you can run into a problem is if you've got twin employees or 20 employees or 50 employees under you knowing knowing which employees are struggling knowing which employees are getting frustrated or angry and just simply just simply knocking on their door and saying hey I just want to make sure everything is okay right because because managers and leaders get tunnel vision like everybody right they get tunnel vision and they focus on their best employees and they focus on their worst employees and then they kind of forget everybody else so one of the problems you're going to have is you can have a good employee not a rock star but good solid employee that's valuable for the company but they're not the worst but they are they're having family problems or they're getting frustrated or there's some issue so day after day after day they're getting a little bit more Angry a little bit more Angry a little bit more frustrated since the boss is tunnel visioned on the best performers or the worst performers they forget about the middle folks and then all of a sudden you have an explosion and you're your middle group and they quit or there's some mess or whatever else one of the things I really argue for for a lot of these AI systems is basically just having what we call a single pane of glass to look at the analytics of what's going on with overall your institution just to see where you might start to have problems so imagine right with a moderation type system that's constantly scanning messages and all that you know everybody gets a baseline right everybody gets a baseline you know your low performers are always pissed off your high performers are always happy and the middle people are somewhere in the middle one of the interesting things if you're constantly scanning all these messages and just looking for Point values to be clear you're not reading the messages themselves it's all being done by the computer but you're looking for Point values for frustration and hate and all that kind of stuff and if all of a sudden if all of a sudden a couple of your employees start spiking up that may just be an alert to you just as a good manager to just say hey want to make sure everything's doing okay is there anything I can do to make your job easier right if you try to solve the problem when you have a little Spike it'll probably you know keep you from having a bigger blow up later or again when we talk about hate speech or trolling or whatever else remember right adults adults like to lie to their kids my adults like to lie to their kids and the adults look at their kids and say I know High School is bad kiddo but don't worry once you're an adult it will stop oh are you still telling your kid the Santa Claus exists too the reality is bullying doesn't stop let me be crystal clear I'm in my mid-40s I can tell you bullying doesn't stop physical intimidation doesn't stop it's it's more of a lower Roar the older you get but it's still there one of the issues you can have is again communication between employees and your company you may not know as a boss or a manager how raw or nasty that communication is is because it's party to party communication but if you had some system to go wait a minute this sales person or this person right they're really spiking on kind of like the hate or sexual innuendo or whatever else I need to go and we need to have a a discipline session or we need to have a session with that person before we have the sexual sexual harassment lawsuit before we have the Discrimination lawsuit right so that's one of the things that can be really powerful with moderation and so like with this it shows you you know import OS module import open AI module give it the key and then the uh the input so this input value again could be coming from a database it could be coming from somewhere else and the input equals I want to kill them again if one of my employees is saying anything along the lines of I want to kill them I definitely want to knock on that door and see what's going on so when we're looking at the moderation API and a bit of the an overview of it uh so they have categories you know hate content that expresses and science or promotes hate base on Race gender ethnicity blase blase hate threatening hateful content that also includes violence or serious harm self-harm again if you have an employee that's depressed and starts you know messaging maybe I should just end to myself you know maybe a knock on the door would be a wise idea sexual content meant to arouse sexual sexual excitement um again this should not happen let me be crystal clear this should not happen in a business environment um we all know it does right again one person communicating with another employee I want to nip that in the butt as quickly as possible sexual with minors oh hell no violence graphic violence so these are all different categories within the moderation thing um if you go down basically it'll show you when you get the results back you get whether it's hate whether it's hate threatening self-harm sexual and you actually get uh numbers based off of that right so let's go over here the moderations right so again create moderation this is the end point if we have here again we have the example that's going out that's node.js we don't want node we want python uh so again this is the I want to kill them so the input is I want to kill them and this is the response we get right so we get the basic categories so basically just a true false so hate is false hate threatening is true self-harm is false sexual false sexual miners false violence through violence graphic is false so that's just a true or false thing if you just need a very a very blunt measurement what's interesting down here though is that we then get to um an actual number score right uh wait a minute uh there we go so the number score so with a number score this is between zero to one and so you see for hate right hate is 0.22 um hate threatening is 0.41 self-harm is .005 sexual is point zero one sexual minors is point zero zero violence is 0.92 so almost one violence graphic is .036 and so since you get this number right again one of the other things that you can do is you can simply you know store this particular data and start to get a baseline for how your customers or for how your users are communicating and then you can either see spikes or you can see drops based off of what is going on you can also see the communication for your entire company your entire organization right maybe maybe they're a little bit you know maybe all of your employees are a little bit more sexual than you would like um maybe all of your employees you know talk a little bit more violent right you you may have a Baseline and then the thing is to look for the spikes to look for the deviations where employees are going outside of what may be normal in your company what may also be useful here too is again from a management standpoint understanding how your company actually communicates one of the big problems is for the executives right you go up to the top floor you get that corner office you do start to separate from the warehouse workers you do start to separate from the sales workers and the marketing people and all of that you may actually lose track with you know what they're all saying to each other and that might wind you up into a lawsuit or bigger problems going in the future so this whole this whole thing with moderation might be very useful for you again for messaging systems so scanning slack scanning email scanning any of the the social media accounts any type of thing like that any place where you can simply go out and basically grab grab text to be able to throw it through this API this might be something useful for you to track how your people are feeling and then we have identifying user abuse and end users so one of the issues that you may run into with this API is that there are API violations right if you ask for child porn from dolly or ask how to kill somebody from chat GPT your account is going to get flagged you get too many of those flags everything's gonna go bad right because everything is at the account level so one of the things that you can do is you can actually add a user variable and the value for that variable could come in from a database or a session value so that when the account gets pinged for an API violation you know who the hell did it right because that's going to be a big thing right when you when you want to stay in the good graces of any company that's providing with an API the people providing you with an API especially if they know you have a lot of users hammering your app they know there's going to be trolls and all of those kinds of people the important question question is how you are going to deal with the trolls if you do not have a way to identify individually who is violating the rules then you're kind of screwed and so the whoever's providing you with the API if you can't stop it they'll just cut off your API access so one of the nice things here is you can add this user value so that again if one of your users is doing something nefarious trying to use the API in the incorrect way that can get flagged and then you can you can disable or you can delete that particular account so that's something that's useful in here again in a multi multi-user setup for your platform one of the things to be thinking about when you use chat GPT or any kind of open AI solution or AI solution is what are you going to be doing with your results and one of the things that I would highly recommend is that you cache your results right so every time you ask for an image from Dolly it's gonna cost you money whether it's one and a half cents or whether two cents it's gonna cost you for every image you ask for 10 or 20 or 100 images it's going to cost you money you're literally paying for those images and so one of the things that I would recommend is why don't you just automatically download them into a data store so that you have them in the future right something just to think about there instead of continuously requesting you know the same types of images you just download everything and maybe one of those weird images that you don't like for your project is perfect for somebody else's project and you don't have to pay two cents or two dollars or whatever else one of the other things to be thinking about too is caching the GPT results um you know again somebody asks a question they get a resp do they get an answer from chat GPT one of the important things to understand about humans is we're all kind of sort of the same I know we all think we're unique we all think we're special little snowflakes that's just not the truth it's just not the truth they're all kind of the same we all kind of ask the same questions we all kind of sort of have the same problems especially in a business or an organization so one of the things you might do is Cash the questions being asked and the answers being given and then you can have somebody go through and look at the answers that are coming back and if it's in a database you may just have them go in and edit the answers to be a little bit more appropriate for your environment and then what you could have is somebody could ask a question the initial response for that question will actually get pulled from your local database since the question has already been asked before here are the three answers that we already have in the database like you could flag one this is the official answer from the company and then if that's not what the user is looking for they could hit another button to actually you know hit chatgpt and get an entirely different answer that can be valuable because that means that you can edit uh the response that your end user is going to get to be most appropriate for your particular environment it means that you're not hammering the hell out of chat kpt so you're not paying those API fees again onesie2z users on your web app it doesn't really matter but if you've got thousands tens of thousands hundreds of thousands or millions of people on your web app those API calls will start to cost a lot of money pretty soon so that's one of the things to be thinking about is reducing the the API usage fees and then also things to be thinking about is improve operational security one of the big things with caching is that you're going to your local infrastructure users are going for the local infrastructure so that the communications are not going outside of your infrastructure you don't have to worry about man in the middle attacks or anything like that where somebody may be trying to collect the questions or the answers that are coming back to your organization again something to consider now currently currently as I've been informed chat EPT now as of whatever this is March 17th or whatever 2023 or March 12th whatever 2023. uh currently they are not as I understand caveat this as I understand using your questions to teach cat right the models so these models you can have self learning models where the models are continuously learning why that's important especially going in the future is the Amazon the big wigs at Amazon literally had a crap fit when they realized that their Engineers were dumping engineering questions into chat GPT or and other AI Solutions looking for answers right so again where I showed you you know it'll show you how to to write a piece of code or whatever things you can do with cat gpts you can say hey can you optimize this code hey can you see a vulnerability or a problem in this code well the issue was is you had some Amazon Engineers copying entire blocks of proprietary Amazon code dumping into the chat EPT and then the issue is is track EPT gives an answer but if calcium PT is then learning from that code that it cost Amazon millions of dollars to create at some point in time somebody else is going to be asking a question and all of a sudden an answer is going to pop out that looks a hell of a lot like Amazon's code right so this is something to be very very careful about again one of the things that I always argue whenever you're thinking about apis is again you do not necessarily know what the vendor is doing with all of these queries you don't necessarily know how they're logging things or whatever else so do be careful with apis and make sure you only send out the information that you do need to send out and make sure it's sanitized and that type of thing you know if they talked about that before somebody apis or AI Solutions or API keys are getting automatically filled in because somebody dumped API Keys into some learning model and now the AP like active API keys are getting spit out so one of the things to be thinking about is when you create an app to submit something to any kind of AI solution is there some kind of sanitization within that that app that you created to do things like remove the uh move the API keys so those kind of things don't leak this is an important thing to be thinking about again right now right now this second they're not supposed to be learning from the from the input information that could change at any time and the other thing to be thinking about is there's a lot of competitors out there just because open AI is doing something doesn't mean a different competitor isn't and you can get into a mess right if you owe if you always try to build secure again you're always building for a zero trust environment generally you won't be let down so we're winding up to the end of the seminar uh we did not talk about cat gpt4 because literally I crap you're not on Tuesday on Tuesday this is what I received please join us today at 1pm Pacific time four o'clock my time for the live demo of gpt4 with the API so the API wait list came out forward 3pt4 and so you can go on that wait list and you may or may not get access to gpt4 for any amount of time again with this class I've shown you whisper I've shown you Dolly I've shown you The DaVinci model and the 3.5 turbo model all of those models will will remain relevant going into the future and even when four comes out you may still find that DaVinci actually solves your problem better than the brand new model as I showed you with three 3.5 3.5 is this wordy as hell it just goes on and on and on you go to go to DaVinci gives you an answer eventually gives you one sentence 3.5 turbo is like and you you have to take all of that and turn it into a format that your user can do something with so yes four is now supposedly out whether you're gonna be able to get access to that API is a different story and even when you're able to get access to that API it doesn't discount anything we talked about today now where do you go from here if you want to start playing with the ape AI uh playing with the API and such uh the main thing is make sure you learn python so again when we talk about programming languages and which programming language you should learn it really comes down to what problem are you trying to solve and what apis have the vendors created for you so when you look at open AI they seem very very very friendly with python it does appear to be a python first environment so if you know you know python you should be able to sail through it there is a node JS API to be clear from what I've been able to see I don't think it's at the same level as the python API I could be wrong there to be clear I could be wrong but it does seem like python is the way to go if you know a different coding language it does not appear that there are official apis out there but if you go to GitHub there are ways to kind of work around the system and make something work but mainly I'd say if you want to start playing with uh gbt just learn some python again I showed I showed you literally how to do a lot of this stuff you don't really have to learn that much python you can sign up for the chat GPT API you initially get 18 in credit or I don't know I got 18 in credit I'm kind of confused they may have changed that I saw something where it's like you get five dollars in credit for the first three months now I don't know if you sign up for the chat GPT API they give you some amount of credit as long as you state a text again DaVinci or uh 3.5 Turbo so uh even if it's five dollars it'll last you forever as soon as you get into images that is where you'll swallow actually a decent amount of money but if you want to keep playing with it again you can't plug in your credit card number and Away you go you can play with AI as much as you want so that's basically where you go if you want to start understanding more about how all this works so I hope you enjoyed this particular seminar and as I say at the end of all these seminars mostly seminars please steal this presentation when I look at scaling silicon Dojo frankly I don't know I'm in my mid-40s I'm kind of tired I don't want to do it I don't want to do it I want you to do it right the concept when we talk about Dojo so many times people use words but they don't really mean the words that they're using I really do mean it again I spent 20 years doing martial arts and one of the most amazing things about martial arts is you can have somebody that comes in they get up the black belt level or not even black up black belt level they get to whatever level they want to get to they can go out they can create their own martial arts studio and go from there right nobody copyrighted Taekwondo or taiichi or Kenpo or Shotokan or any of that right you learn it and then when you get to whatever level you think is appropriate you can go out there and teach it I've had many people over the years I've been doing YouTube since 2009 I have people had people come up to me from India that said I was in a Backwater Village in India and I now work at Cisco because of your videos I had somebody here in Asheville come up to me that said he was from Africa he literally stated that his village did not have internet access so he walked into another village with internet access to download my old videos so I could bring them back to his village and watch those videos and now he's in University in Cincinnati I have talked with so many people and so one of the things that I'm thinking about with silicon Dojo is again how this can scale and how this can grow and the way that I would like that to be done is I think it would be amazing if somebody in Mogadishu or Somalia or Colorado or Mexico or whatever else saw these videos liked what I was doing took the types of information that I'm providing and created their own Dojo again you can do this I've got I've got a 700 square foot room now to be clear it's in HACC in Asheville North Carolina so it does cost a couple of dollars and I've got some nice things here but realize this could be a basement I just need 700 square feet this could be a basement this could be a garage you could literally have folding tables and folding chairs and people's cast off computers and you can teach Python and Linux and all these other coding languages and such as well as any college can you don't need a lot of money and resources to do what I'm doing so if you like what I'm doing here again please please take this um the end for the uh the presentation itself and all of the code will be on GitHub hopefully by the time you're watching this video so you can download it you can modify it as you see fit and uh and yeah and basically uh you know use this type of education and teach the people around you again to hopefully empower the people that are in your area to do whatever the hell it is that they want to do again I figure folks in mogadish you probably have different uh different aspirations different needs and and hopes and all that than somebody in Atlanta Georgia versus somebody in Amsterdam right so again you modifying the education for your particular environment so as always I enjoyed uh teaching this particular seminar I much preferred teaching this particular seminar to a group of live human beings but I'll take the virtual people too I'll take the virtual people too uh if you're wondering what's going to be going on in the future we are actually going to be starting to focus more on Hands-On classes we're still going to do these seminars but there's going to be more exercises again you can kind of figure out how you're going to do the exercise I'll give you the code and everything but again it's not going to be quite a seminar the idea is that you're actually going to do some Hands-On stuff I've just noticed that when I do these seminars especially after a long day I have a lot of students falling asleep and let's be honest I can't really blame them you've had a long day of work you come to come to Silicon Dojo at six o'clock at night you sit in a nice comfy chair and listen to me talk for an hour and a half is not a shock or that you're going to go to sleep so what I want to do is I want to do more Hands-On classes so we've done uh three eight hour Hands-On classes up until this point we did PHP we did my sequel we did Linux and my thought is is can we cut those down even more into one to three hour blocks again so the python that I showed you day right that was that probably looked pretty simple even if you don't know any python at all you probably looked at that one I could probably do that if I understood what the hell he was doing so one of my thoughts is Let's do an introduction to python class max it at three hours max it at three hours and basically explain modules explain variables explain if else statements explain loops explain a few other things just for that basic concept so that then the next class we can do we could do a class on chat GPT or Dolly and instead of me sitting up here pontificating at my students they can actually be sitting there and they can play be playing with the projects seeing what happens in that type of deal give them the actual Hands-On you know the tactile experience of building something to make them feel more comfortable and hopefully you know keep them awake that type of deal so this is kind of a model that we're going to be working towards and my idea with this is if we start modulizing and creating blocks of education then we can just simply pick and choose the blocks for the particular students that are in class or whatever we're trying to solve for again python is going to be our kind of like our de facto language here just because it does so much it builds robots it deals with AI it deals with computer vision right and so one of my thoughts is what if we created like 50 classes 50 blocks of classes on python some of them will be on databases some of them will be on a chat EPT some of them will be on opencv some of them will be on Azure cognitive services and then like every Tuesday or on weeknights we could just have a one block class on a weekend for a day I could simply stick two or three or four classes together to come up with a full day class so it's like okay we're going to teach you python python with chat GPT and then that would be a full day or we could we could uh you know stick everything together for a full boot camp so somebody could come here for for five days and we could go in and we could have the basics of python the basics of Django the basics of databases and then connect that with something that they would be interested in yeah Machine Vision or whatever else and that way we can just kind of pick and choose again with business business is very much about finding a product and finding a replicatable product and I think coming up with these blocks of classes Hands-On classes will be a good way to go will it I don't know I'll tell you in a couple months will it work out will it be successful I will tell you just as soon as I know so anyways as I always enjoy uh Joy trying to trying to teach you folks trying to trying to empower your folks to make the world a little bit better place I look forward to hopefully seeing you at an in-person class and if nothing else you can you can come here and watch me on YouTube see y'all later
Info
Channel: Eli the Computer Guy
Views: 18,921
Rating: undefined out of 5
Keywords: Eli, the, Computer, Guy, Repair, Networking, Tech, IT, Startup, Arduino, iot
Id: 585DQv6nmlo
Channel Id: undefined
Length: 109min 45sec (6585 seconds)
Published: Fri Mar 17 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.