-
Notifications
You must be signed in to change notification settings - Fork 796
Description
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
- Create a chat session with
GenerateContentConfig(temperature=0.0, seed=12345) - First
send_message— works as expected (deterministic output) - Second
send_messagewith same config (temperature=0.0) — output becomes
non-deterministic, as if temperature is unset - Change to
temperature=0.01on 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.