fix: use getModel() temperature as single source of truth in OpenAI handler#12144
Draft
roomote-v0[bot] wants to merge 1 commit intomainfrom
Draft
fix: use getModel() temperature as single source of truth in OpenAI handler#12144roomote-v0[bot] wants to merge 1 commit intomainfrom
roomote-v0[bot] wants to merge 1 commit intomainfrom
Conversation
…andler The OpenAiHandler computed temperature independently in createMessage(), ignoring defaultTemperature from custom model info. This caused a 400 error with models like kimi-for-coding that only accept specific temperature values (e.g. 0.6). Changes: - getModel() now detects deepseek reasoner models and passes the correct defaultTemperature to getModelParams() - createMessage() streaming path uses temperature from getModel() instead of computing it separately - createMessage() non-streaming path now includes temperature (was missing) - completePrompt() now includes temperature (was missing) This makes getModelParams() the single source of truth for temperature, which respects: user overrides > model defaultTemperature > provider default. Closes #12142
Open
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: #12142
Description
This PR attempts to address Issue #12142. Feedback and guidance are welcome.
Root cause: The
OpenAiHandler.createMessage()computed temperature independently fromgetModel(), ignoringdefaultTemperaturefrom custom model info. When using the OpenAI Compatible provider with models likekimi-for-coding(which only acceptstemperature: 0.6), Roo Code senttemperature: 0(the hardcoded default), resulting in a 400 error.Fix: Make
getModelParams()the single source of truth for temperature across all code paths:getModel()now detects deepseek reasoner models and passesDEEP_SEEK_DEFAULT_TEMPERATUREasdefaultTemperaturetogetModelParams()(matching howopenrouter.tshandles this).createMessage()streaming path uses thetemperaturereturned bygetModel()instead of computing it separately.createMessage()non-streaming path now includestemperaturefromgetModel()(was previously missing entirely).completePrompt()now includestemperaturefromgetModel()(was previously missing).Temperature priority is now consistent everywhere: user override > model
defaultTemperature> provider default (0).After this fix, users can set
defaultTemperature: 0.6in their custom model info forkimi-for-codingand it will be respected.Test Procedure
defaultTemperaturefrom custom model info is sent when no user temperature is setmodelTemperaturetakes priority overdefaultTemperaturecompletePrompt()includes temperaturePre-Submission Checklist
Documentation Updates
No documentation updates needed -- this is an internal bug fix that makes existing configuration options work as documented.
Interactively review PR in Roo Code Cloud