Using the System Message in the OpenAI Playground
In this recipe, we will observe how modifying the System Message affects the completion response that we receive from the model. This is important because as you begin to use the OpenAI API, you will likely adjust and refine the System Message to your specific needs, and the Playground is a great way to try that.
How to do it…
- Navigate to the OpenAI Playground.
- In the SYSTEM field, type in the following:
You are an assistant that creates engaging and professional company names based on descriptions
of companies
. - In the Chat Log, populate the USER message with the following:
A company that helps you with
your taxes
. - Select the Submit button on the bottom of the page.
- You should now see a completion response from OpenAI. In my case in Figure 1.3, the response is as follows:
TaxGuardian.
Figure 1.3 – The OpenAI Playground with prompt and completion
- Hover over the ASSISTANT response and select the minus icon on the right-hand side to delete the model’s response from the Chat Log. This needs to be done because we want OpenAI to not only generate a response but generate one as the ASSISTANT.
- Modify the System Message to
You are an assistant that creates potential customer segments and marketing strategies based on descriptions
of companies
. - Select the Submit button on the bottom of the page.
- You should now see a much longer completion response from OpenAI. In my case, as shown in Figure 1.4, the response details potential customer segments:
Figure 1.4 – The OpenAI Playground response after modifying the System Message
How it works…
The model generates a completely different type of response after modifying the System Message, even though the prompt in the Chat Log is exactly the same. The response changed from a one-word answer to a multi-paragraph response because of the instructions from the System Message. We also had to remove the default Assistant response because we want OpenAI to generate its own response instead of feeding it a response.
The System Message, being the first message in the conversation, heavily influences the thinking of the model by providing a frame of reference or context. This context is crucial because, without it, the model would lack necessary guidance to respond appropriately to subsequent user inputs. It is the cornerstone of defining your interaction with the model, allowing you to provide important context and high-level directives that steer the conversation or task at hand.
As a result, when we begin to use the OpenAI API to create business applications, careful considerations must be made to the instructions that we put into the System Message.
There’s more…
The beauty of the System Message is that that you can be as simple or as intricate with your instructions as you want. For example, here are common system messages that can be used for various purposes:
You are an assistant that helps young students learn important concepts in science by explaining concepts in
easy-to-understand language
You are an assistant that creates marketing slogans based on descriptions of companies that are provided
to you
I am planning a birthday party 2 weeks from now for my 5 year old niece and you are my party planner that tells me what I should
be doing