fix: do not enforce temperature of 0 for OpenAI compatible provider#12043
Draft
roomote-v0[bot] wants to merge 1 commit intomainfrom
Draft
fix: do not enforce temperature of 0 for OpenAI compatible provider#12043roomote-v0[bot] wants to merge 1 commit intomainfrom
roomote-v0[bot] wants to merge 1 commit intomainfrom
Conversation
When no custom temperature is set and the model is not a DeepSeek reasoner, the OpenAI compatible provider was hardcoding temperature=0. This overrode whatever server-side default the provider may have. Changed the fallback to undefined so the temperature field is omitted from the API request, letting the remote provider use its own default. Fixes #12042
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related GitHub Issue
Closes: #12042
Description
This PR attempts to address Issue #12042. When using the OpenAI compatible provider without a custom temperature set, the handler was hardcoding
temperature: 0in the API request. This overrode whatever server-side default the provider may have configured.Changes:
src/api/providers/openai.ts(createMessage) - Changed the temperature fallback from0toundefinedfor the non-DeepSeek case, so the field is omitted from the request when no custom temperature is set.src/api/providers/openai.ts(getModel) - ChangeddefaultTemperature: 0todefaultTemperature: undefinedsogetModelParamsalso returnsundefinedwhen no temperature source provides a value.src/api/transform/model-params.ts- Updated theGetModelParamsOptionstype to allowdefaultTemperatureto benumber | undefined.Tests updated - Updated the Azure AI Inference test expectation and added a new test case verifying that
undefineddefaultTemperature producesundefinedtemperature output.Scope and safety:
OpenAiHandlerused for "OpenAI Compatible" provider typeOpenAiNativeHandler(actual OpenAI) is in a separate file and unaffectedDeepSeekHandlerextendsOpenAiHandlerbut overridescreateMessagewith its own temperature handlingFeedback and guidance are welcome.
Test Procedure
npx vitest run api/transform/__tests__/model-params.spec.ts- all 58 tests passnpx vitest run api/providers/__tests__/openai.spec.ts- all 48 tests passPre-Submission Checklist
Documentation Updates
Additional Notes
This fix aligns with the intent of Issue #7187 which previously addressed a similar problem.
Interactively review PR in Roo Code Cloud