back to indexOpenAI's ChatGPT API First Look
Chapters
0:0 OpenAI ChatGPT API is here
3:2 Testing the new ChatCompletion endpoint
3:31 Comparing this to ChatGPT app
6:54 More testing of ChatGPT API
8:7 Formatting ChatGPT responses
9:58 Feeding responses back into ChatGPT
11:21 Final thoughts on ChatGPT API
00:00:00.000 |
OpenAI have just released their API endpoints for TrackGPT. 00:00:05.060 |
What we're going to do is have a quick look at what that looks like 00:00:10.500 |
So they've just announced it in this article here, introducing 00:00:17.600 |
Now, I'm not going to talk about Whisper APIs, but we've covered them before. 00:00:21.500 |
So you can go and watch those videos if you're interested. 00:00:24.500 |
But what is really exciting is TrackGPT, finally, we can use it through 00:00:31.500 |
Now, this article doesn't really cover anything. 00:00:34.000 |
They just kind of mentioned this, which is pretty impressive. 00:00:38.100 |
So the cost reduction, and if we scroll down, I think they are more 00:00:43.100 |
specific about it elsewhere, but we'll cover that in a moment. 00:00:46.700 |
But if we scroll down, we just see a couple of use cases, which is pretty cool. 00:00:50.360 |
So you have Snapchat using it, these guys who I'm not really familiar 00:00:54.800 |
with, Instacart, I think we also have Shopify here, which is pretty cool. 00:00:58.900 |
They have TrackGPT, which is providing a chat interface, but they're also 00:01:06.940 |
So, you know, they're doing the whole knowledge base thing here and feeding 00:01:13.900 |
And we see more in-depth example of that here from Toby, who's the CEO of Shopify. 00:01:18.740 |
And you see that they're bringing all these other resources and kind of fine 00:01:23.900 |
tuning what they're searching for based on that. 00:01:27.100 |
Now returning back to the 2ChatGPT, let's come up here and we have somewhere near 00:01:34.300 |
the bottom of the article, we have a little bit of code here, and it's just above this 00:01:41.900 |
All right, so if you've used OpenAI's endpoints before, you probably 00:01:47.600 |
Now what we can use is this model, which is apparently pretty easy to migrate 00:01:53.700 |
from, small amount of adjustment needed to their prompts. 00:01:59.460 |
It's a 10 times cheaper than existing GPT 3.5 models, which were 00:02:05.660 |
So this is seemingly better performance than this, and it's also 10 times cheaper. 00:02:14.540 |
Now we have some demo code here, and then we can come to here 00:02:20.340 |
So we have chat completions, go down and some code here, right? 00:02:27.140 |
So we come to here, all I've done here is just pip and sort OpenAI. 00:02:34.540 |
Now to get that API key, you need to go to platform.openai.com. 00:02:40.800 |
You should see in the top right, there's like a signup or your actual account. 00:02:46.460 |
So you go into there, view API keys, and then you just click create 00:02:52.640 |
That secret key would go in here and then we would come to here. 00:03:04.440 |
So this is literally my first time trying this. 00:03:17.400 |
Was it who won the World Series in 2020 Los Angeles Dodgers? 00:03:24.000 |
It was played at Globe Life Field in Arlington. 00:03:30.020 |
Now what's probably more interesting is if we, you know, I want to see if this 00:03:35.160 |
is actually the same model as what we would be getting from ChatGPT, like 00:03:44.220 |
It was, so I just asked, you know, what are sentence transformers? 00:03:49.020 |
Can you show me how to implement something like this? 00:03:55.260 |
Give me some models that I, you know, wouldn't recommend using. 00:04:01.880 |
So I'm going to take these, let's just see how we'd actually implement 00:04:11.380 |
Now here we have web user, so system user assistant, right? 00:04:16.520 |
So this system here is like the primer for the model. 00:04:22.120 |
So this is before I even say anything up here. 00:04:24.320 |
So we can just leave it as you are a helpful assistant. 00:04:28.220 |
I don't know if that's going to produce the same sort of result as what we just 00:04:31.180 |
got, but let's try and let's just say, you know, what are sentence transformers? 00:04:38.260 |
Sentence transformers are a class of deep learning models that are specifically 00:04:42.160 |
designed to generate high quality sentence embeddings. 00:04:46.220 |
And let's compare that to what we've got on the other side. 00:04:49.460 |
Uh, it's pretty similar, but this one is, I would say significantly longer. 00:04:54.360 |
So I imagine it's probably a token limit that we can set up here. 00:05:00.020 |
So maybe this is what we can, we can add in here. 00:05:05.820 |
So this seems to be like a system message that they sometimes 00:05:22.400 |
I don't know if we need to enter this, but September, 2021, and the 00:05:34.400 |
So primer, I'm going to put that in there and I'm going to rerun it and see what we get. 00:05:47.860 |
They're slightly different to what we, what we got initially. 00:05:50.960 |
Let's have a quick look at the chat completion and such a limit. 00:05:57.040 |
In the case of max tokens, temperature and max tokens are 00:06:03.600 |
So I think this is the same as the usual inputs that we provide. 00:06:07.900 |
So if we go max tokens and say 500, run this again. 00:06:22.800 |
Yeah, but what we probably can do is make it go shorter if we wanted to. 00:06:40.800 |
So you can see the total tokens here, actually. 00:06:42.880 |
So if I put that down to 50, we should not go 50, I think. 00:06:54.680 |
So let's carry on that conversation with the other parts I added in there. 00:07:02.040 |
And what we will do is just copy in the other responses I got. 00:07:06.140 |
So the first answer I got was this, pretty long. 00:07:11.440 |
So this one's going to be the role will be the assistant. 00:07:16.640 |
And the content will be what I just got, but I need to format it a little bit better. 00:07:40.340 |
What would it do if we fed that in and didn't say anything from the user? 00:07:47.340 |
So it's literally just like nothing else is needed, which is cool. 00:08:10.440 |
Let me do response so I can format this a bit nicer. 00:08:47.040 |
Naturally, let's ask chat EPT how to do that. 00:09:17.940 |
So then we come to here and I'm going to display. 00:09:30.040 |
Implement sentence transformer of question answering. 00:09:40.340 |
It's better than the one I got before actually, which was like this. 00:10:11.340 |
All right, so we'll just call it response one. 00:10:16.340 |
And what I'm going to do is come to here and I'm going to put response one. 00:10:30.040 |
I would say do you have any other model was better suited to Q&A? 00:10:42.040 |
You can feed the responses directly back into there using these. 00:10:56.940 |
Yes, there are a number of training models and then, you know, see we can 00:11:07.140 |
I think yeah message and then it was content. 00:11:17.640 |
So Berkeley way Albert electric you a DPR nice. 00:11:22.240 |
So that I think looks pretty cool just as a you know, it's just a very 00:11:29.940 |
This is the first time I'm using it as well, but it looks very cool. 00:11:34.140 |
I would like to try this with a few other things see how does the 00:11:37.140 |
instructions and so on but we'll do that in another video for now. 00:11:43.640 |
Thank you very much for watching and I will see you again in the next one.