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

Add support for OpenAI o1 #4128

Open
dmtran-g opened this issue Dec 18, 2024 · 8 comments
Open

Add support for OpenAI o1 #4128

dmtran-g opened this issue Dec 18, 2024 · 8 comments
Labels
ai/provider enhancement New feature or request

Comments

@dmtran-g
Copy link

Feature Description

OpenAI has just released o1-2024-12-17. See https://platform.openai.com/docs/models/gpt-4o#o1

I tried to use o1-2024-12-17 with streamText, but ran into the following error:

"type": "APICallError",
"message": "Unsupported value: 'stream' does not support true with this model. Supported values are: false.",

Note: according to https://platform.openai.com/docs/guides/reasoning, o1 supports "developer messages" (whereas o1-preview didn't support system messages):

Developer messages are the new system messages: Starting with o1-2024-12-17, o1 models support developer messages rather than system messages, to align with the chain of command behavior described in the model spec. Learn more.

Use Cases

No response

Additional context

No response

@dmtran-g dmtran-g added the enhancement New feature or request label Dec 18, 2024
@dmtran-g
Copy link
Author

dmtran-g commented Dec 18, 2024

Actually, it looks like the above error comes from the OpenAI API itself.

According to https://platform.openai.com/docs/guides/reasoning#limitations

Streaming support not available in the REST API

Edit: o1-preview supports streaming, but it looks like o1 doesn't support it yet

@lgrammel
Copy link
Collaborator

Released in @ai-sdk/[email protected]

@dmtran-g
Copy link
Author

dmtran-g commented Dec 19, 2024

Hi @lgrammel

Thank you so much for quickly adding support for o1!

I took a look at the changes, it looks like "developer" messages are not yet supported for o1.
Should I create a new issue for this?

According to https://platform.openai.com/docs/guides/reasoning

Developer messages are the new system messages: Starting with o1-2024-12-17, o1 models support developer messages rather than system messages, to align with the chain of command behavior described in the model spec. Learn more.

@lgrammel
Copy link
Collaborator

You don't need them, OpenAI will translate system messages accordingly (it's just a rename)

@dmtran-g
Copy link
Author

You don't need them, OpenAI will translate system messages accordingly (it's just a rename)

I see, thanks for the explanation!

@kdawgwilk
Copy link

We are still seeing errors with o1-preview and using system messages so i think the SDK still needs to map them?

AI_APICallError: Unsupported value: 'messages[0].role' does not support 'system' with this model.

@dmtran-g
Copy link
Author

We are still seeing errors with o1-preview and using system messages

o1-preview doesn't support system messages, but o1 does (though I haven't tried it myself yet, as o1 doesn't support streaming yet)

@lgrammel lgrammel reopened this Dec 23, 2024
@lgrammel
Copy link
Collaborator

Planning to automatically convert system messages to developer messages for openai reasoning models

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ai/provider enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants