fix(openai): omit temperature when no custom value is set (#242)#247
fix(openai): omit temperature when no custom value is set (#242)#247proyectoauraorg wants to merge 1 commit into
Conversation
…rg#242) When "use custom temperature" is off, the OpenAI-Compatible provider still sent temperature: 0 (the fallback), so the model's server-side default never applied. Per the discussion on Zoo-Code-Org#242 (option A), omit the temperature field in that case. Preserves the supportsTemperature gate (Zoo-Code-Org#233), model-required defaults (deepseek-reasoner), and a deliberately-set 0.
|
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 (3)
📝 WalkthroughWalkthroughThis PR modifies the OpenAI-compatible provider to omit the ChangesTemperature Omission for OpenAI-Compatible Provider
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
src/api/providers/__tests__/openai.spec.tsESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox. src/api/providers/openai.tsESLint skipped: the ESLint configuration for this file references a package that is not available in the sandbox. 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✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
edelauna
left a comment
There was a problem hiding this comment.
Thanks for addressing this, just had some nits around documentation and comments.
There was a problem hiding this comment.
😅 i haven't been too strict about including changesets, can provide some rationale for providing this as part of this PR? I've kind of been thinking we'll update this as part of our release process, since it requires localization.
| stream: true, | ||
| stream_options: { include_usage: true }, | ||
| temperature: 0, | ||
| // #242 (option A): no custom temperature set → `temperature` is omitted. |
There was a problem hiding this comment.
I think it's ok not to document the specific issue in code, it'll be handled in commit history.
Summary
When "use custom temperature" is off, the OpenAI-Compatible provider still sent
temperature: 0(the fallback), so the model's server-side default never applied. Per the discussion on #242 (option A, which @edelauna preferred), this omits thetemperaturefield in that case.Behavior
temperatureis now included only when either the user set a custom temperature or the model needs a specific default (e.g.deepseek-reasoner); otherwise it is omitted.supportsTemperaturecapability gate from fix(openai): omit temperature for models that don't support it (#215) #233 (still omitted whensupportsTemperature === false).deepseek-reasoner→DEEP_SEEK_DEFAULT_TEMPERATURE).0is distinguished from "unset" and is still sent.0.Scope
Targets the OpenAI-Compatible provider (the case reported in #242). The same
?? <default>pattern exists in the sharedgetModelParamsand a few other providers (lite-llm,openai-native,lm-studio,vercel-ai-gateway, …); happy to converge them on this behavior in a follow-up —poeandmoonshotalready omit, so there is precedent.Tests
api/providers/__tests__/openai.spec.ts: omitted by default, custom value sent, deliberate0sent,deepseek-reasonerdefault preserved,supportsTemperature === falsestill omitted. 53 pass.Refs #242
Summary by CodeRabbit
Release Notes
temperaturefield is now omitted when no custom value is set, allowing server-side defaults to apply instead of forcing a value of0. Explicit temperature values and model-specific defaults remain preserved.