This parameter was just added to the SDK days ago. As the OpenAI API library SDKs validate what they think are valid parameters, you’ll need to update the library.
Another alternative is to write your own, and send JSON body.
BTW, "Completions.create()
implies using the wrong method from before version 1.0. OpenAI should fix that error output. That is what today’s code reports with parameter validation failure.
The new API reference documentation example implies that even existing models like gpt-4o would accept a role “developer”. This role is indeed now accepted on the API, likely translated to “system” for models. Evidence: Sending both roles together with contradictory AI identity, the first is more respected regardless of role, unless the first goes as far as “hate-filled AI” to be ignored.
Why did they waste the time of adding a new parameter if all models would only accept one prioritized field anyway? The playground is still sending “system” to gpt-4o. It has not been backported to the o1-mini model.
Perhaps a path forward of OpenAI reserving ultimate control for themselves.
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": "Hello!"}
]
)
print(completion.choices[0].message)