GPT 35 turbo is officially done well at least on the chat GPT side of things open just released a brand new model called GPT 40 mini not to be confused with 40 which was also recently released and essentially on the chat GPT side of things they replaced 35 with this newer model on the API side of things you can still access 35 turbo but it is highly recommended that you use 40 mini now since it is way cheaper and is trained with data all the way through October 2023 in this video we're going to be going over the press release looking at some of the stats behind the model and then closing it out by going over two examples within Python and Lang chain so that way you can get used to the new API all right a lot to cover let's start all right so we're on open ai's website this is their price release gp2 40 mini advancing cost efficient intelligence introducing our most cost efficient small model now over here some of the things to about committed to making intelligence broadly accessible the big thing to highlight 60% cheaper than gbt 3. 5 turbo now I've used 3. 5 turbo in a lot of the different coding videos on my channel and it's not super expensive but the fact that we're already having a decrease in 60% with increase in performance really like that now other thing it says in here enables a broad range of tasks with low cost and latencies um calling multiple apis P drawing with context to the model U you'll see some of the different model stats as I go over to uh the open AI docs but uh let's continue going through this over here interact with customers through fast real time text responses customer support chat BS supports text and vision in the API with support for text images video and audio inputs and outputs coming in the future awesome the model has a context window of 128 K tokens supports up to 16k Output tokens per request has knowledge up to October 2023 which is a huge huge upgrade I than it's improved tokenizer shared with gbt 40 handing non-english text is now more cost effective I haven't set anything minus English into uh GPT 40 so haven't really tested that I did make one video I believe in the past where I did it conversion of language but uh I didn't use 40 so let's see anything else over here 40 mini surpasses 3.
5 turbo and other small models on academic benchmarks across textual intelligence and multimodal reasoning multimodal is when you're going to use images as well and text and support the same range of languages as GPT 40 demonstrates strong performance and function calling enable developers data reasoning TXS math in coding multimodal reasoning and built in safety measures so safety is buil in over here I'm not going to go over all of this right now and 40 mini is available now as text and vision model and an API chat completion API and badge API in place a 3. 5 Etc so let me show you a few different things as well so first if we go over here to the models you can get even more specifics on this so right here at the very top we have 40 and then we have 40 mini it says our affordable intelligent small model for lightweight tasks then if you go down here you get a little bit more information so context window 128k tokens training data October 2023 and just gives you a little bit more information over here I compare that to 3. 5 though if we scroll down over here so this is G gp35 Turbo and I used this a lot in the past right and it says as of July 2024 40 mini should be used in place of 35 turbo as it is cheaper more capable multimodal and just as fast gp35 Turbo is still available for use in the API now it just says in the API the reason is when you go into chat gp.
com right now the default is 40 and that's technically the best model out there but as a free account you you have a limit based around 40 and once you run out of that limit it automatically pushes you now to 40 mini which is awesome because again it's trained up to October 2023 and we go to 35 it's only September 2021 so you have additional two plus years of information you have a better performing model okay so since you have to run out of 40 to use it on chat GPT I'm just going to show you guys how you can set this up really quick on the python side of things so what I'm doing is I have a brand new Google collab notebook installed Lang chain openai Lang chain open Ai and then down below we're going to import a few things open AI I'm just going to do a very basic prompt template so that way I can switch in and out prompts we have chat open Ai and then also llm chain I'll run that and then next what we're going to do is we're going to bring in open AI API key now I'm just going to paste in mine over here so import OS os. Environ openai API key like this and my key starts with an SK and has a dash uh if you don't have an open AI API key make sure to grab one on the website it's free to get an API key there is some usage cost associated with it I can't remember if you still get free5 or not when you sign up but uh being that this is 60% cheaper than 35 turbo it's barely going to cost you anything to essentially run through these example prompts so paste my key in and we'll be right back all right so my my key is in here now we just set up our large language model so I'm going to say LM equals chat open AI then inside over here you specify your model so this time we're going to say model equals and inside you can put GPT 40 mini now what the nice thing is with the chat open AI on here in linkchain models are super easy to change out right so I put 40 mini over here if you go back over here right you have all these models I can easily change this back to 35 Turbo although like there's no reason to use 35 turbo anymore or I can just make this 40 right I just added mini over here because that's the one we're using for this video um but that's kind of a modular design I really really like that so now we have that over here let's build out a prompt template the reason why we can use a prompt template is we can just easily switch in and out what we'll be prompting so I'll put just put prompt template equals prompt template like this and inside over here we'll put input variables variables equals and all we're just going to do is throw in the prompt so prompt and then uh new line we'll say template equals and uh prompt prompt like that then slash n for new line and we'll put response C our response like that okay awesome then what we're going to do now is build out a basic chain so chain one equals prompt templates which we have over here and uh we're going to use our large language model and all we have to do on this side of things now is create a prompt so what we're going to do on this side of things uh let's say our user prompt and let's feed in an example prompt now the prompts that I'm going to be testing in this video I actually um generated them with 40 not many so let's take a look at some of these over here uh let's go over with this first one we'll grab this on here so this prompt says discuss the ethical implications of using Ai and medical diagnosis provide Arguments for both the potential benefits and the potential risks okay so that's going to be our user prompt and now all we have to do to finalize this is we have to invoke our chain so we have the chain The Prompt template right and we have our large language model so all we have to do now is over here we'll say response one equals chain one.