Skip to content
This repository was archived by the owner on May 15, 2026. It is now read-only.

Commit 6e87953

Browse files
committed
fix(api): use MISTRAL_DEFAULT_TEMPERATURE directly as fallback
Address review comment - ensure temperature defaults to 1 (MISTRAL_DEFAULT_TEMPERATURE) instead of 0 from getModelParams to match original behavior.
1 parent de2f78e commit 6e87953

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/api/providers/mistral.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ export class MistralHandler extends BaseProvider implements SingleCompletionHand
134134
messages: Anthropic.Messages.MessageParam[],
135135
metadata?: ApiHandlerCreateMessageMetadata,
136136
): ApiStream {
137-
const { temperature } = this.getModel()
138137
const languageModel = this.getLanguageModel()
139138

140139
// Convert messages to AI SDK format
@@ -145,11 +144,12 @@ export class MistralHandler extends BaseProvider implements SingleCompletionHand
145144
const aiSdkTools = convertToolsForAiSdk(openAiTools) as ToolSet | undefined
146145

147146
// Build the request options
147+
// Use MISTRAL_DEFAULT_TEMPERATURE (1) as fallback to match original behavior
148148
const requestOptions: Parameters<typeof streamText>[0] = {
149149
model: languageModel,
150150
system: systemPrompt,
151151
messages: aiSdkMessages,
152-
temperature: this.options.modelTemperature ?? temperature ?? MISTRAL_DEFAULT_TEMPERATURE,
152+
temperature: this.options.modelTemperature ?? MISTRAL_DEFAULT_TEMPERATURE,
153153
maxOutputTokens: this.getMaxOutputTokens(),
154154
tools: aiSdkTools,
155155
toolChoice: this.mapToolChoice(metadata?.tool_choice),
@@ -176,14 +176,14 @@ export class MistralHandler extends BaseProvider implements SingleCompletionHand
176176
* Complete a prompt using the AI SDK generateText.
177177
*/
178178
async completePrompt(prompt: string): Promise<string> {
179-
const { temperature } = this.getModel()
180179
const languageModel = this.getLanguageModel()
181180

181+
// Use MISTRAL_DEFAULT_TEMPERATURE (1) as fallback to match original behavior
182182
const { text } = await generateText({
183183
model: languageModel,
184184
prompt,
185185
maxOutputTokens: this.getMaxOutputTokens(),
186-
temperature: this.options.modelTemperature ?? temperature ?? MISTRAL_DEFAULT_TEMPERATURE,
186+
temperature: this.options.modelTemperature ?? MISTRAL_DEFAULT_TEMPERATURE,
187187
})
188188

189189
return text

0 commit comments

Comments
 (0)