Skip to content

temperature=0.0 silently ignored from 2nd turn onward in multi-turn chat (falsy value treated as unset) #2169

@ken12313451

Description

@ken12313451

Environment details

- Programming language: Python 3.13
- OS: Windows 11
- Language runtime version: Python 3.13
- Package version: google-genai (latest as of March 2026)

Summary

In multi-turn chat, temperature=0.0 works correctly on the first send_message
call, but from the 2nd turn onward it appears to be treated as "unset" (falsy),
causing the model to fall back to default temperature (1.0). Setting
temperature=0.01 works correctly on all turns.

This is a critical issue for applications requiring deterministic output across a
full multi-turn session.

Steps to reproduce

  1. Create a chat session with GenerateContentConfig(temperature=0.0, seed=12345)
  2. First send_message — works as expected (deterministic output)
  3. Second send_message with same config (temperature=0.0) — output becomes
    non-deterministic, as if temperature is unset
  4. Change to temperature=0.01 on the 2nd turn — output becomes near-deterministic
    again

Expected behavior

temperature=0.0 should be respected on all turns, not just the first.

Actual behavior

temperature=0.0 works on the 1st turn but is silently ignored from the 2nd turn
onward, likely due to falsy value handling (0.0 == False in Python). The model
falls back to default temperature, producing highly variable output.

Workaround

None. Even setting temperature=0.01 as a workaround does not fully resolve the
issue — it still requires finding specific seed values that produce acceptable
results, and complete determinism is never guaranteed. We strongly request a fix for
this bug.

Metadata

Metadata

Labels

priority: p2Moderately-important priority. Fix may not be included in next release.status:awaiting user responsetype: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions