fix(openai): omit temperature for models that don't support it (#215)#233
fix(openai): omit temperature for models that don't support it (#215)#233proyectoauraorg wants to merge 1 commit into
Conversation
…ode-Org#215) claude-opus-4-7 (and similar) reject requests through the OpenAI-Compatible provider with a 400 error because 'temperature' is deprecated/unsupported. Honor the model's existing supportsTemperature flag (already respected by openai-native, gemini, lite-llm and vercel-ai-gateway) and omit temperature from the streaming request when it is explicitly set to false. undefined keeps sending temperature, preserving current behavior for all other models. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR fixes conditional temperature parameter handling in the OpenAI-compatible provider. The implementation omits the temperature parameter from streaming chat requests when ChangesConditional Temperature Parameter Support
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Summary
Fixes #215. Using
claude-opus-4-7through the OpenAI-Compatible provider fails with a400error because the upstream API (e.g. via LiteLLM/Bedrock) rejectstemperatureas deprecated/unsupported for that model.OpenAiHandler.createMessage()always includedtemperaturein the streaming request. This honors the model's existingsupportsTemperatureflag — already respected byopenai-native,gemini,lite-llmandvercel-ai-gateway— and omitstemperaturewhen it is explicitly set tofalse.Behavior
supportsTemperature: false→temperatureis omitted from the request.undefined/true→temperatureis sent exactly as before (no behavior change for existing models).Users hitting this can set Supports temperature → off on the OpenAI-Compatible model (the flag already exists in
ModelInfoand the settings UI).Testing
Added tests asserting
temperatureis omitted whensupportsTemperature: falseand included by default.Summary by CodeRabbit