OpenAI: New "developer" message role

Posted: Jan 15, 2025.

OpenAI has recently introduced a significant update to its API, transitioning from "system" prompts to "developer" messages. This change aims to provide clearer instructions and better control over model behavior, enhancing the overall developer experience.

What are Developer Messages?

Developer messages are a type of input that provides general instructions to the model, guiding its behavior and response format. Unlike user messages, which are specific queries or tasks, developer messages set the context and tone for the model's responses. They are prioritized over user messages and are essential for customizing the model's behavior[2][3].

Why the Change from "System" to "Developer"?

The term "system prompt" was previously used to describe these instructions, but it has been renamed to "developer message" to more accurately reflect its role in the instruction-following hierarchy.

This change helps to avoid confusion with internal system-level instructions used by OpenAI to maintain security and prevent unethical outputs[4].

Example of Developer Messages

Here is an example of how to use developer messages in OpenAI's API:

from openai import OpenAI

client = OpenAI()

completion = client.chat.completions.create(
    model="gpt-4o",
    messages=[
        {"role": "developer", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Write a haiku about recursion in programming."}
    ]
)

print(completion.choices[0].message.content)

In this example, the developer message instructs the model to behave as a helpful assistant, which influences its response to the user's query[2].

Benefits of Developer Messages

Developer messages offer several benefits:

  • Clearer Instructions: They provide a clear and concise way to guide the model's behavior.
  • Customization: They allow developers to tailor the model's responses to specific needs and contexts.
  • Flexibility: They can be used to define the tone, style, and format of the model's responses.

Best Practices for Developer Messages

When using developer messages, it's essential to follow best practices:

  • Keep it Simple: Use straightforward and clear instructions.
  • Avoid Ambiguity: Ensure that the developer message does not conflict with user messages.
  • Use Delimiters: Use delimiters to clearly indicate different parts of the input[3].

Conclusion

The update from "system" to "developer" messages in OpenAI's API is a significant improvement that enhances the developer experience. By providing clearer instructions and better control over model behavior, developer messages are a powerful tool for customizing AI applications. With these changes, developers can create more sophisticated and tailored AI solutions.

References

Building an AI chatbot?

Open-source GenAI monitoring, prompt management, and magic.

Learn More

Join 10,000+ subscribers

Every 2 weeks, latest model releases and industry news.

Building an AI chatbot?

Open-source GenAI monitoring, prompt management, and magic.

Learn More