mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-13 08:05:23 +00:00
* fix: stop sending temperature for AI chat across all providers Remove the temperature field from all AI chat completion requests and drop the model-based send-or-not special-casing. Previously the chat sent temperature: 0 for determinism and omitted it for reasoning models (claude-opus-4-7/4-8, gpt-5+, o-series) that reject sampling params, which required hand-maintaining a growing model list. The model-detection helper is kept (renamed modelDisallowsSamplingParams -> requiresMaxCompletionTokens) since it still serves a separate concern: choosing max_completion_tokens over max_tokens for OpenAI/Azure reasoning models on the Chat Completions API. The FIM autocomplete temperature: 0 is intentionally left untouched (it is the code-autocomplete path, not the chat). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * refactor: drop dead claude-* branches from requiresMaxCompletionTokens After temperature removal, requiresMaxCompletionTokens only governs the max_completion_tokens vs max_tokens choice for OpenAI/Azure reasoning models (its sole call site is gated on provider === openai|azure_openai). The retained claude-* branches were leftovers from when the function omitted temperature for Anthropic reasoning models; they are unreachable for the max_completion_tokens decision and made the kept detection tests assert a semantically false claim. Claude reasoning behavior is owned by reasoningRegistry. Drop the dead branches and their tests so name, comment, code, and tests agree. Behaviorally inert. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
12 lines
676 B
TypeScript
12 lines
676 B
TypeScript
// gpt-5+ and o-series reasoning models reject the legacy `max_tokens` field on
|
|
// the OpenAI/Azure Chat Completions API and require `max_completion_tokens`
|
|
// instead. The check strips any provider prefix (e.g. OpenRouter's "openai/o3")
|
|
// so it matches the bare model id, and the o-series match requires a digit after
|
|
// the "o" (o1/o3/o4-mini) so it does not catch unrelated ids like Mistral's
|
|
// "open-mistral-*" or "optimus-*".
|
|
export function requiresMaxCompletionTokens(model: string) {
|
|
const normalizedModel = model.toLowerCase()
|
|
const baseModel = normalizedModel.split('/').pop() ?? normalizedModel
|
|
return baseModel.startsWith('gpt-5') || /^o\d/.test(baseModel)
|
|
}
|