Repository navigation
fix(agent): preserve zero temperature setting - #16897
Conversation
|
Caution Review failedAn error occurred during the review process. Please try again later. 📝 WalkthroughWalkthroughThe temperature condition in ChangesTemperature Configuration
Estimated code review effort: 1 (Trivial) | ~5 minutes Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
test/unit_test/agent/component/test_llm_prompt.py (1)
64-71: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAlso test that negative temperatures remain excluded.
This regression test covers zero, but the PR contract also requires negative values to be omitted. Add a focused assertion for an enabled negative temperature.
Suggested test
+def test_gen_conf_excludes_negative_temperature(): + param = LLMParam() + param.temperature = -0.1 + param.temperatureEnabled = True + + assert "temperature" not in param.gen_conf()🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@test/unit_test/agent/component/test_llm_prompt.py` around lines 64 - 71, Add a focused assertion in test_gen_conf_includes_zero_temperature_when_enabled, or a nearby dedicated test, that sets temperature to a negative value with temperatureEnabled enabled and verifies gen_conf() omits the "temperature" key. Preserve the existing zero-temperature assertion.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@test/unit_test/agent/component/test_llm_prompt.py`:
- Around line 64-71: Add a focused assertion in
test_gen_conf_includes_zero_temperature_when_enabled, or a nearby dedicated
test, that sets temperature to a negative value with temperatureEnabled enabled
and verifies gen_conf() omits the "temperature" key. Preserve the existing
zero-temperature assertion.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: c83088a8-ef35-4f2a-948f-10431b365f65
📒 Files selected for processing (2)
agent/component/llm.pytest/unit_test/agent/component/test_llm_prompt.py
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #16897 +/- ##
=======================================
Coverage 93.16% 93.16%
=======================================
Files 10 10
Lines 717 717
Branches 118 118
=======================================
Hits 668 668
Misses 29 29
Partials 20 20 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
temperature=0in the Agent LLM configuration.Why
LLMParam.gen_conf()only forwards temperature values greater than zero. This causes an explicitlyconfigured
temperature=0to be omitted, allowing the model provider to use its default valueinstead.
PR #15389 fixed zero-valued parameters in the REST chat completion routes, but the Agent LLM
component uses a separate configuration path where the issue remains.
Testing
ruff format --check agent/component/llm.py test/unit_test/agent/component/test_llm_prompt.pyruff check agent/component/llm.py test/unit_test/agent/component/test_llm_prompt.pygit diff --checkFixes #16683