Introduction: Understanding System Prompts

In the previous lesson, you learned how to make your prompts more effective by using clear instructions and positive reinforcement. Now, let's take a step further and talk about a special type of prompt called a system prompt.

A system prompt is a message that sets the rules or context for how a language model should behave during a conversation. Unlike regular prompts, which are usually questions or requests from the user, system prompts act as instructions for the model itself. They help define the model's role, tone, or personality for the entire session.

For example, if you want the model to act like a helpful assistant, you can set a system prompt that tells it to do so. This is especially useful in chat platforms like LibreChat, where you might want the model to stay in character or follow specific guidelines throughout the conversation.

Why Use System Prompts?

System prompts are necessary because they guide the model's behavior from the very beginning. They help you:

  • Set the model's role (e.g., a teacher, a cat, an IT specialist)
  • Control the tone and style of responses
  • Limit or expand what the model can talk about

By using system prompts, you can ensure the model consistently follows your desired guidelines throughout the entire conversation.

Example

Let's look at a real-world example. Imagine you are building a customer support chatbot. You want the chatbot to always be polite and only answer questions related to your product. By setting a system prompt like:

The model will try to follow these instructions in every response.

System prompts are also helpful for creative tasks. For example, if you want the model to write stories as if it were a pirate, you can set a system prompt to make it talk like one.

System Prompts in LibreChat

In the practices on our platform, you can set the system prompt in the following way.

Open the parameters section in the right sidebar:

Enter your system prompt in the "Custom Instructions" input field.

That's it! You don't have to click any "save" button; the system prompt is already here and will be applied to your next prompt.

More Examples of System Prompts

Here are three different ways you can use system prompts to guide a language model's behavior:

  1. Limiting the Scope of Conversation

  2. Enforcing a Specific Output Format

  3. Controlling the Level of Detail

Summary And What's Next

In this lesson, you learned what system prompts are and why they are essential. You saw how to write clear and effective system prompts and how to use them in LibreChat to control the model's behavior.

Next, you'll get a chance to practice writing your own system prompts and see how they affect the model's responses. This hands-on practice will help you become more confident in guiding language models to behave precisely as you want.

Sign up
Join the 1M+ learners on CodeSignal
Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal