fix(agent): preserve zero temperature setting (#16897)

### Summary

- Preserve an explicitly enabled `temperature=0` in the Agent LLM
configuration.
  - Continue excluding invalid negative temperature values.
  - Add a focused regression test to the existing Agent LLM test file.

  Fixes #16683
This commit is contained in:
hyotaek kim
2026-07-14 21:10:51 +09:00
committed by GitHub
parent 26161ce844
commit 760203be42
2 changed files with 11 additions and 1 deletions

View File

@@ -70,7 +70,7 @@ class LLMParam(ComponentParamBase):
if int(self.max_tokens) > 0 and get_attr("maxTokensEnabled"):
conf["max_tokens"] = int(self.max_tokens)
if float(self.temperature) > 0 and get_attr("temperatureEnabled"):
if float(self.temperature) >= 0 and get_attr("temperatureEnabled"):
conf["temperature"] = float(self.temperature)
if float(self.top_p) > 0 and get_attr("topPEnabled"):
conf["top_p"] = float(self.top_p)

View File

@@ -59,3 +59,13 @@ def test_fit_messages_uses_default_context_when_max_length_zero():
)
assert err is None
assert msg_fit[-1]["content"] == "User query: test"
@pytest.mark.p1
def test_gen_conf_includes_zero_temperature_when_enabled():
"""Include an explicitly enabled zero temperature in the model configuration."""
param = LLMParam()
param.temperature = 0
param.temperatureEnabled = True
assert param.gen_conf()["temperature"] == 0