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

[Bug] Azure OpenAI O1 models don’t work #4248

Closed
nikhil-pandey opened this issue Oct 3, 2024 · 12 comments · Fixed by #6079
Closed

[Bug] Azure OpenAI O1 models don’t work #4248

nikhil-pandey opened this issue Oct 3, 2024 · 12 comments · Fixed by #6079
Labels
azure 🐛 Bug Something isn't working | 缺陷 Inactive No response in 30 days | 超过 30 天未活跃 released

Comments

@nikhil-pandey
Copy link

📦 Environment

Vercel

📌 Version

Latest main / v1.21.4

💻 Operating System

macOS

🌐 Browser

Safari

🐛 Bug Description

{ "error": { "message": "Unsupported parameter: 'max_tokens' is not supported with this model. Use 'max_completion_tokens' instead.", "type": "invalid_request_error", "param": "max_tokens", "code": "unsupported_parameter" }, "endpoint": "https://***.openai.azure.com/", "provider": "azure" }

I haven’t set any max token limit. Max token field should be removed from the request body

📷 Recurrence Steps

Use Azure OpenAI o1 models

🚦 Expected Behavior

Should work

📝 Additional Information

@nikhil-pandey nikhil-pandey added the 🐛 Bug Something isn't working | 缺陷 label Oct 3, 2024
@github-project-automation github-project-automation bot moved this to Roadmap - Chat 1.x in Lobe Chat Routine Oct 3, 2024
@lobehubbot
Copy link
Member

👀 @nikhil-pandey

Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible.
Please make sure you have given us as much context as possible.
非常感谢您提交 issue。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。

Copy link

dosubot bot commented Oct 3, 2024

Hey @nikhil-pandey! 👋 I'm here to help you with any bugs, questions, or contributions you have. Let's squash those bugs together while we wait for a human maintainer.

The error you're encountering is due to the use of the max_tokens parameter, which is not supported by the Azure OpenAI O1 models. Instead, you should use max_completion_tokens.

To resolve this issue, you need to modify the request construction in the codebase to replace max_tokens with max_completion_tokens for the Azure OpenAI O1 models. This change should be made in the part of the code where the request parameters are set for Azure OpenAI models, specifically in the LobeAzureOpenAI class or wherever the request payload is being constructed [1].

If you haven't explicitly set a max token limit, ensure that the default configuration or any conditional logic in the code does not automatically include max_tokens for these models. You might need to update the logic to conditionally set max_completion_tokens instead, based on the model being used.

To continue talking to Dosu, mention @dosu.

@dosubot dosubot bot added the azure label Oct 3, 2024
This was referenced Oct 11, 2024
@arvinxx arvinxx mentioned this issue Nov 9, 2024
@lobehubbot lobehubbot added the Inactive No response in 30 days | 超过 30 天未活跃 label Dec 3, 2024
@ripenedcat
Copy link

问题依旧,还没有修复吗?

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


The question is still, hasn't it been repaired yet?

@htdohk
Copy link

htdohk commented Feb 1, 2025

求修复该问题

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Seeking to repair this problem

@hcygnaw
Copy link
Contributor

hcygnaw commented Feb 2, 2025

看起来是因为用了旧版本的azure openai package?"@azure/openai": "1.0.0-beta.12"
旧版本已经deprecated了,这里有一份Migration Guide.

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


It looks because of the old version of Azure Openai Package? "@Azure/Openai": "1.0.0- Beta.12"
The old version has been deprecated. RIPT-New) Then, then

@faceCutWall
Copy link
Contributor

I'm currently working on this :) #6079

@wolph
Copy link

wolph commented Feb 15, 2025

As a workaround you can use litellm to create a proxy that behaves like OpenAI. That way LobeChat will think it is talking to OpenAI o1/o3 (mini) and it will work.

@github-project-automation github-project-automation bot moved this from Roadmap - Chat 1.x to Done in Lobe Chat Routine Feb 15, 2025
@lobehubbot
Copy link
Member

@nikhil-pandey

This issue is closed, If you have any questions, you can comment and reply.
此问题已经关闭。如果您有任何问题,可以留言并回复。

@lobehubbot
Copy link
Member

🎉 This issue has been resolved in version 1.55.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
azure 🐛 Bug Something isn't working | 缺陷 Inactive No response in 30 days | 超过 30 天未活跃 released
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

7 participants