Make provider sampler params opt-in; drop escalation preset

Sampler parameters (temperature/top_p/presence_penalty/frequency_penalty)
now default to None and are omitted from the request payload when unset, so
the server's model/Modelfile default applies. The provider no longer guesses
values on the user's behalf; callers opt in via config or a per-chat override.

- provider.OpenAICompatClient / llm.LLMClient: default the four params to None
  and only include them in the payload when set (max_tokens/reasoning_effort
  already behaved this way).
- cli.build_scheduler: pass None when the config key is absent via _opt_float,
  instead of hardcoded numeric fallbacks.
- codegen: remove ESCALATED_SAMPLER and its use on retries (body, elicitation,
  testgen, regen). The retry ladder keeps the fresh short prompt but reuses the
  configured/omitted sampler; appropriate values can't be known in advance for
  arbitrary user models.
- console: no functional change; the hosted Console API now receives no sampler
  params by default.
- Tests cover omit-by-default, send-when-configured, per-call override, and the
  no-escalation retry.
- Docs: config.example.json comments, provider/llm/codegen/console docstrings,
  AGENTS.md.
This commit is contained in:
gabby committed 2026-10-02 13:00:50 +00:00
1 parent 8afb488dc4
commit 5747ad2fa6
11 files changed
+223 -105

No files matched your search

+38
View File
@@ -123,6 +123,44 @@ def test_generate_skill_via_provider():
httpd.server_close()
def test_llm_omits_sampler_params_by_default():
"""No sampler params are sent unless the `llm` config sets them, so the
server's model default applies."""
httpd, base = _fake_server('{"title": "x", "description": "y"}')
try:
LLMClient(base_url=base, model="test", timeout=10).chat(
[{"role": "user", "content": "name this"}]
)
body = httpd.RequestHandlerClass.received[0]
for key in ("temperature", "top_p", "presence_penalty", "frequency_penalty"):
assert key not in body
finally:
httpd.shutdown()
httpd.server_close()
def test_llm_sends_configured_sampler_params():
httpd, base = _fake_server('{"title": "x", "description": "y"}')
try:
LLMClient(
base_url=base,
model="test",
timeout=10,
temperature=0.2,
top_p=0.9,
presence_penalty=0.0,
frequency_penalty=0.0,
).chat([{"role": "user", "content": "name this"}])
body = httpd.RequestHandlerClass.received[0]
assert body["temperature"] == 0.2
assert body["top_p"] == 0.9
assert body["presence_penalty"] == 0.0
assert body["frequency_penalty"] == 0.0
finally:
httpd.shutdown()
httpd.server_close()
def test_llm_disables_thinking_by_default():
"""The title/description author sends reasoning_effort:none so a reasoning
model answers the short JSON directly (its CoT otherwise eats the 128-token