Skip to content

DeepSeek (AI SDK) requests use temperature=0 due to getModelParams defaultTemperature=0 shadowing DEEP_SEEK_DEFAULT_TEMPERATURE #11194

@hannesrudolph

Description

@hannesrudolph

Summary

When using the DeepSeek provider (AI SDK path), the outgoing request body shows temperature: 0 even though the intended DeepSeek default is DEEP_SEEK_DEFAULT_TEMPERATURE = 0.3.

Root Cause

  • getModelParams() has a default parameter defaultTemperature = 0 (model-params.ts).
  • DeepSeekHandler.getModel() calls getModelParams({ format: "openai", ... }) without passing defaultTemperature, so the computed temperature becomes 0 via:
    • customTemperature ?? model.defaultTemperature ?? defaultTemperature (model-params.ts)
    • which resolves to undefined ?? undefined ?? 0 => 0.
  • The DeepSeek AI SDK request options then use:
    • temperature: this.options.modelTemperature ?? temperature ?? DEEP_SEEK_DEFAULT_TEMPERATURE (deepseek.ts)
    • Since temperature is 0 (not nullish), it wins and DEEP_SEEK_DEFAULT_TEMPERATURE is never reached.

Expected

If the user did not configure a temperature, DeepSeek requests should default to 0.3 as per DEEP_SEEK_DEFAULT_TEMPERATURE.

Actual

DeepSeek AI SDK requests default to 0 unless the user explicitly sets a temperature.

Suggested Fix (pick one)

Option A (targeted; minimal blast radius)

Pass defaultTemperature: DEEP_SEEK_DEFAULT_TEMPERATURE into getModelParams from DeepSeekHandler.getModel().

Option B (broader behavior change)

Change getModelParams default from 0 to undefined and update call sites/tests.

Option C (explicit defaults)

Change getModelParams default to undefined, then make each provider pass an explicit defaultTemperature matching its intended behavior.

Notes

This was discovered while fixing DeepSeek reasoning round-tripping; not part of that patch scope.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions