Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support o1 developer message format #1717

Merged
merged 5 commits into from
Jan 8, 2025
Merged

Support o1 developer message format #1717

merged 5 commits into from
Jan 8, 2025

Conversation

dirkbrnd
Copy link
Contributor

@dirkbrnd dirkbrnd commented Jan 7, 2025

Description

OpenAI's o1 model requires system messages to be developer messages going forward. This change is backwards compatible with older models.

Fixes #1621

Note We don't yet have access to o1, so we cannot confirm whether o1 itself works yet. This only paves the way for it.

Type of change

Please check the options that are relevant:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Model update
  • Infrastructure change

Checklist

  • My code follows Phidata's style guidelines and best practices
  • I have performed a self-review of my code
  • I have added docstrings and comments for complex logic
  • My changes generate no new warnings or errors
  • I have added cookbook examples for my new addition (if needed)
  • I have updated requirements.txt/pyproject.toml (if needed)
  • I have verified my changes in a clean environment

@manthanguptaa
Copy link
Contributor

This lools good but my only concern is that we can't test it with o1 yet because of not having access to it

@dirkbrnd
Copy link
Contributor Author

dirkbrnd commented Jan 8, 2025

This lools good but my only concern is that we can't test it with o1 yet because of not having access to it

This is true, but this allows users that already have o1 to atleast continue, which is the case for the user that raised the issue. We can confirm with them that it works. According to OpenAI and other articles, this should be the only required change. And we can confirm it works on older models, so we know we have the interface correct.

Copy link
Contributor

@manthanguptaa manthanguptaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested against sambanova, together, and openai cookbooks and this working perfectly

@manthanguptaa manthanguptaa merged commit aa5238a into main Jan 8, 2025
1 check passed
@gauravdhiman
Copy link
Contributor

@dirkbrnd / @manthanguptaa This change broke the Deepseek and I think will break other OpenAILike models.
with v2.7.7 getting below error when using Deepseek, saying "unknown variant developer`"
with 2.7.6, it works fine with Deepseek.

error:

  File "/Users/gauravdhiman/projects/python/ai/playgrounds/kokoro-onnx-tts/.venv-kokoro-onnx-tts/lib/python3.12/site-packages/openai/_base_client.py", line 1064, in _request
    raise self._make_status_error_from_response(err.response) from None
openai.UnprocessableEntityError: Failed to deserialize the JSON body into the target type: messages[0].role: unknown variant `developer`, expected one of `system`, `user`, `assistant`, `tool` at line 1 column 34

Did not try other providers, but with deepseek I can see above issue.

@dirkbrnd
Copy link
Contributor Author

Thanks for raising, we have merged a fix. Releasing with 2.7.8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OpenAI o1 requires "developer" messages instead of "system" messages
4 participants