From the course: GPT-4 Foundations: Building AI-Powered Apps
Configuring the system prompt - GPT Tutorial
From the course: GPT-4 Foundations: Building AI-Powered Apps
Configuring the system prompt
- [Instructor] What would happen if we could make GPT-4 focus on a certain task? Would it become better or is the magic of GPT-4 its ability to do a little bit of everything? Today, we'll be talking about focusing our GPT-4 responses by using the system variable. On the left-hand side here, you can see that we have the system prompt, but we haven't talked about it much. What the system prompt does is that it allows us to provide instructions to GPT-4. You can see here, there's this kind of faded, "you are a helpful assistant." This is the default system prompt for GPT-4 and also for ChatGPT. And what we can do here is we can assign a task or a persona to GPT-4. When we're having conversations between the assistant and the user, GPT-4 will act as the assistant and try to accomplish objectives specified in the system prompt. Now let's go through an example. In this example that you can find in the exercise files, we want to ask GPT-4 to find out a user's favorite color. And until the user specifies the color, we'll keep asking them for it. This is useful in our example of a chatbot because we might want to ask the user how they want to customize their action figure. So let's go ahead and try talking to GPT-4 with this new system prompt. So I'm going to go ahead and create a user prompt and say hello to GPT-4. "Hi, how are you doing today?" And hit submit. And there we go. GPT-4 responded, and then it asked me about my favorite color. Okay, it's doing what it's supposed to do. Now let's ask it another question. "The sky is nice today, don't you think?" So another question for GPT-4. And we're going to get an answer, but we're still going to be asked about our favorite color. GPT-4 really won't give up. Okay, let's tell it our favorite color. "My favorite color is blue." Hit submit. And there we go, GPT-4 commented on our favorite color and no more questions. It successfully accomplished its goal of understanding our favorite color. So there we go. That's an example of how we can set the system prompt to accomplish an objective. This gives us the ability to focus GPT-4 to accomplish specific tasks, and later we'll learn how we can combine them to build larger applications.
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.