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] Unsupported parameter: 'max_tokens' with o3-mini #468

Open
manuelmorales opened this issue Feb 2, 2025 · 0 comments
Open

[BUG] Unsupported parameter: 'max_tokens' with o3-mini #468

manuelmorales opened this issue Feb 2, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@manuelmorales
Copy link

manuelmorales commented Feb 2, 2025

OpenAi's o3-mini doesn't accept max_tokens but max_completion_tokens instead. When running:

openai_o3_mini = OpenAIServerModel(model_id="o3-mini", api_key=OPENAI_API_KEY)
agent = CodeAgent(tools=[DuckDuckGoSearchTool()], model=chatgpt_4o_mini)
agent.run("What is the weather in Tokyo?")

I get:

...
Error in generating model output:
Error code: 400 - {'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'}}

This is with smolagents version = "1.7.0".

The temporary solution I found is to delete such default param from kwargs:

openai_o3_mini = OpenAIServerModel(model_id="o3-mini", api_key=OPENAI_API_KEY, max_completion_tokens=8192)
del openai_o3_mini.kwargs["max_tokens"]

That way it works. I believe this will be a problem with all reasoning models like o1 and o1-mini.

@manuelmorales manuelmorales added the bug Something isn't working label Feb 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant