Fix temperature param for o3mini and o1mini when using LiteLLM (#2203)

* fix: prevent invalid temperature 0 param when using o3mini model

* fix: handle temperature param properly for o1-mini and o3-mini models
This commit is contained in:
k-inoway authored and GitHub committed 2025-03-12 11:33:12 -07:00
1 parent 4ade5daeff
commit 36836ad4d6
1 file changed
+8 -1
+8 -1
View File
@@ -23,11 +23,18 @@ export class LiteLlmHandler implements ApiHandler {
role: "system",
content: systemPrompt,
}
const modelId = this.options.liteLlmModelId || liteLlmDefaultModelId
const isOminiModel = modelId.includes("o1-mini") || modelId.includes("o3-mini")
let temperature: number | undefined = 0
if (isOminiModel) {
temperature = undefined // does not support temperature
}
const stream = await this.client.chat.completions.create({
model: this.options.liteLlmModelId || liteLlmDefaultModelId,
messages: [systemMessage, ...formattedMessages],
temperature: 0,
temperature,
stream: true,
stream_options: { include_usage: true },
})