Skip to content

Error with model selection with openai reasoning models #138

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

Closed
Pythonista7 opened this issue Apr 14, 2025 · 2 comments · Fixed by #139
Closed

Error with model selection with openai reasoning models #138

Pythonista7 opened this issue Apr 14, 2025 · 2 comments · Fixed by #139

Comments

@Pythonista7
Copy link
Contributor

I notice that OpenAIAugmentedLLM on init sets the self._reasoning flag , the default fallback model is gpt-4o but when i specifically pass a model_name which is a reasoning model during generate_str(request_params=...) it fails with the below error.

[mcp_agent.workflows.llm.augmented_llm_openai.writing_assistant] Error: 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'}}

I believe we would need to update the self._reasoning after the self.select_model() returns (line: 154) here?

Image

If there is an alternate way to resolve this or if a code change would be required would be happy to implement them based on suggestion :) Thanks!

@StreetLamb
Copy link
Collaborator

Hi @Pythonista7, thanks for raising the issue! If you would like to, another thing to resolve would be changing max_tokens to max_completion_tokens since max_tokens has been deprecated.

@Pythonista7
Copy link
Contributor Author

@StreetLamb great suggestion! Have update the PR with the change: #139

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 a pull request may close this issue.

2 participants