-
Notifications
You must be signed in to change notification settings - Fork 2.4k
fix: omit temperature parameter when not explicitly set for OpenAI Compatible providers #7188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -157,13 +157,20 @@ export class OpenAiHandler extends BaseProvider implements SingleCompletionHandl | |
|
|
||
| const requestOptions: OpenAI.Chat.Completions.ChatCompletionCreateParamsStreaming = { | ||
| model: modelId, | ||
| temperature: this.options.modelTemperature ?? (deepseekReasoner ? DEEP_SEEK_DEFAULT_TEMPERATURE : 0), | ||
| messages: convertedMessages, | ||
| stream: true as const, | ||
| ...(isGrokXAI ? {} : { stream_options: { include_usage: true } }), | ||
| ...(reasoning && reasoning), | ||
| } | ||
|
|
||
| // Only include temperature if explicitly set | ||
| if (this.options.modelTemperature !== undefined) { | ||
| requestOptions.temperature = this.options.modelTemperature | ||
| } else if (deepseekReasoner) { | ||
| // DeepSeek Reasoner has a specific default temperature | ||
| requestOptions.temperature = DEEP_SEEK_DEFAULT_TEMPERATURE | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The special handling for DeepSeek Reasoner models is well-implemented. Could we add a comment explaining why this model requires a specific default temperature? This would help future maintainers understand the reasoning behind this special case. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if we don't need to send this anymore since we are letting the provider set it |
||
| } | ||
|
|
||
| // Add max_tokens if needed | ||
| this.addMaxTokensIfNeeded(requestOptions, modelInfo) | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this intentional? The temperature is set inline here (line 119) while in other tests it's part of the options object. Could we standardize this for better consistency?