Transcript from the "Testing the Prompt Template" Lesson
>> Let's run this and see what we broke [LAUGH]. Now it's going to be like, now that I did all of that, it's going to be I'm not gonna give you consistent thinking anymore. Okay, here we go. So actually, I got to ask it a new question now, right?
[00:00:14] So let's go back to our page, and now I don't have to do this, right? I'll have to do is just give it an entry now, today was a okay day I guess, I found a new coffee shop, that was cool. But then I got a flat tire.
[00:00:46] And I'll put a happy face just to really confuse it. [LAUGH] there really throw it off Cool, yeah, let's see what happens. And let me just, I don't know if that's the actual output or not, but I'm just gonna refresh it just to make sure. See what happens here.
[00:01:14] Coo, okay, so as you can see, here's all the things, which is really cool. So, let's see where it starts. It did it twice. I'm trying to see where it started. Okay, so here's the prompt that we made. Let me see if I can get to where it starts and where it ends.
[00:01:33] And yeah, I think it was here. So I think everything that I have highlighted the prompt that got created so you can see. Here's our thing at the top where we steered it, we gave it instructions. And then the format and the structure that we made with Zod schema, and this is where it got inserted.
[00:01:53] It added you must format your output as JSON value that adheres to a given JSON schema incidents. Jason's schema and then it describes Jason's schema. Remember I told you about one shot, zero shot mini shot? Okay, it's giving it an example so it's helping it through examples. This is a classic way of helping LM's.
[00:02:10] So it's like here's an example of what a Jason schema instance would look like and then saying here's the schema and that wouldn't these properties would match this property. Thus this object will be format right it's literally teaching it JSON right imagine having to write this it would be terrible.
[00:02:26] So and then just like remember your output will be parsed and type checked according to the provided schema instance. So make sure all the fields in your output match the schema exactly And there will be no trailing commas, it's yelling at just like I was.
>> And then it's like, cool.
[00:02:42] Here is your JSON Schema. And then put it in an enclosing markdown code block, so you really can't mess this up. And then here's our JSON schema that got created through our Zod. And then it's like, okay, cool, and then it runs it. And then it spits back.
[00:02:59] You can see this is the prompt that I gave it. And then it spits back the format of JSON exactly the way that we want it in a JSON code block ready for us to parse beautiful right? So this is all just prompt engineering. You could have wrote written this yourself, but people at length chain are already doing it.
[00:03:19] So this used their thing [LAUGH]
>> Did you forget the subject?
>> Summary, yeah, I did forget subjects. Yeah, okay, look at that. I guess there was one more that I had that in my code my, GitHub and I just like, just looked over it. Yeah, I did have it in my code.
[00:03:41] I just looked. It's like hidden. It's like right here. You can't really see it. Yeah, let's add the subject and we, and then I guess it is a good example to see like, how did it, it'll still work here, right? So we could say subjects c-string I think this one was actually pretty easy.
[00:03:56] You don't have to do anything crazy. I just said the subject of the journal entry, right? This one's really simple. There we go, we got that. Don't have to change anything else. Should just be able to run this again. I'll run up the same prompt. And see what we get.
[00:04:20] There we go. We got our subject. Daily events, found a new coffee shop but got a flat tire. Neutral, I guess it figured out. It was neutral. It was pretty neutral. I thought that smiley face was gonna throw it off and be like, it was a good day.
[00:04:35] But no I guess not, yes.
>> Is 3.5 Turbo as of like June 2023. Is that like your kinda daily driver or like the default model when using open AI at least. Have you played around with others and have takeaways or recommendation?
>> Yeah, I'll probably use GPT 3.5 Turbo, because it's the same thing with Chat GPT.
[00:04:57] So the difference between GPT 3.5 Turbo and regular GPT 3, I believe, actually I could be wrong, they might have both went through this. But I know Turbo really went through this, is that they had reinforcement learning done to the model after it was trained through. All the data from the internet, human interaction, reforced learning, which basically just means the best way I can describe it is like.
[00:05:21] If you go into ChatGPT and you do thumbs up, thumbs down, that's reinforcement learning, right? It's, it's like looking at the output and being like, this was good. This was bad. And then feeding that back into it. Because the way a neural network works under whatever has tons of different layers each layers is just a set of statistics and which a prediction crosses through.
[00:05:43] So like it determines what is the best statistically what is the best path to go through to get some type of prediction. So in order for it to correct itself, it just goes back to those certain layers and readjust those. It rebalances those statistics to have different numbers, right?
[00:06:00] So you might think of a node and a neural network might have, it can have a value between 0 and 1, right? And that's a statistic. So it just readjusts those to figure out how to get to the result that it needs to get to. There's a lot of stuff that goes into it as far as like, punishing the neural net that sounds so bad but like yeah, you can reward it.