fix: Agent OpenAI calls fail for GPT-5 and o-series models#3367
Conversation
The agent hardcoded `max_tokens` and `temperature` in the Chat Completions request body. Newer OpenAI models (the GPT-5 family and the o-reasoning series) reject `max_tokens` in favor of `max_completion_tokens` and only accept the default temperature, so configuring e.g. `gpt-5.5` failed with "Unsupported parameter: 'max_tokens' is not supported with this model." Add a pure, testable helper (openAIModelParams.js) that detects the model generation and emits the correct token/temperature parameters, preserving legacy behavior for GPT-4.1 and older. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
🚀 Thanks for opening this pull request! We appreciate your effort in improving the project. Please let us know once your pull request is ready for review. Tip
Note Please respond to review comments from AI agents just like you would to comments from a human reviewer. Let the reviewer resolve their own comments, unless they have reviewed and accepted your commit, or agreed with your explanation for why the feedback was incorrect. Caution Pull requests must be written using an AI agent with human supervision. Pull requests written entirely by a human will likely be rejected, because of lower code quality, higher review effort and the higher risk of introducing bugs. Please note that AI review comments on this pull request alone do not satisfy this requirement. Our CI and AI review are safeguards, not development tools. If many issues are flagged, rethink your development approach. Invest more effort in planning and design rather than using review cycles to fix low-quality code. |
📝 WalkthroughWalkthroughThe PR adds support for next-generation OpenAI models by introducing a utility module that detects model generation and adapts API request parameters accordingly. The feature is integrated into existing agent request flows and documented in the configuration reference. ChangesNext-gen Model Parameter Support
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 6 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (6 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
This looks too model specific; we want to move towards abstraction, not specificity, to support non-OpenAI models in the future. Why not make the passed model params part of the model config, and allow to override default params? This way dashboard doesn't need to mirror param changes in the future.
New Pull Request Checklist
Issue Description
The dashboard AI agent could only talk to OpenAI models up to GPT-4.1. Configuring a newer model (the GPT-5 family or the
o-reasoning series, e.g.gpt-5.4,gpt-5.5,o1,o3) failed with:OpenAI changed the Chat Completions contract for these newer models:
max_tokenswas renamed tomax_completion_tokenstemperatureis acceptedThe agent's request body in
Parse-Dashboard/app.jshardcodedmax_tokens: 2000andtemperature: 0.7, so any next-generation model was rejected by the API.Approach
Parse-Dashboard/openAIModelParams.jsthat detects the model generation from its name and returns the correct token/temperature parameters.gpt-4o,gpt-4-turbo,gpt-3.5-turbo, …) →max_tokens+temperature: 0.7(unchanged behavior).gpt-5+ and theo-series) →max_completion_tokens, temperature omitted.Parse-Dashboard/app.jsvia object spread, keeping the rest of the request unchanged.This keeps full legacy support intact while enabling newer models.
TODOs before merging
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Documentation