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

+18 -8
View File
@@ -66,6 +66,16 @@ def _resolve_api_key(cfg: dict) -> str:
return ""
def _opt_float(value) -> float | None:
"""Config number for an opt-in provider parameter.
A missing/`null` key yields `None`, which the provider omits from the
request so the server's model default applies. A present value is coerced
to `float`.
"""
return None if value is None else float(value)
def _provider_endpoint(cfg: dict, default_base: str) -> dict:
"""Endpoint kwargs shared by the llm/codegen clients.
@@ -123,10 +133,10 @@ def build_scheduler(config: dict) -> tuple[Scheduler, dict]:
idle_warn=float(llm_cfg.get("idle_warn", 30.0)),
idle_timeout=float(llm_cfg.get("idle_timeout", 120.0)),
context_window=float(llm_cfg.get("context_window", 0.0)),
temperature=float(llm_cfg.get("temperature", 0.2)),
top_p=float(llm_cfg.get("top_p", 0.9)),
presence_penalty=float(llm_cfg.get("presence_penalty", 0.0)),
frequency_penalty=float(llm_cfg.get("frequency_penalty", 0.0)),
temperature=_opt_float(llm_cfg.get("temperature")),
top_p=_opt_float(llm_cfg.get("top_p")),
presence_penalty=_opt_float(llm_cfg.get("presence_penalty")),
frequency_penalty=_opt_float(llm_cfg.get("frequency_penalty")),
disable_thinking=bool(llm_cfg.get("disable_thinking", True)),
api_key=llm_endpoint["api_key"],
extra_headers=llm_endpoint["extra_headers"],
@@ -161,10 +171,10 @@ def build_scheduler(config: dict) -> tuple[Scheduler, dict]:
degeneration_interval=int(deg_cfg.get("interval", 8000)),
degeneration_window=int(deg_cfg.get("window", 2000)),
degeneration_min_chars=int(deg_cfg.get("min_chars", 4000)),
temperature=float(codegen_cfg.get("temperature", 0.7)),
top_p=float(codegen_cfg.get("top_p", 0.85)),
presence_penalty=float(codegen_cfg.get("presence_penalty", 1.5)),
frequency_penalty=float(codegen_cfg.get("frequency_penalty", 0.2)),
temperature=_opt_float(codegen_cfg.get("temperature")),
top_p=_opt_float(codegen_cfg.get("top_p")),
presence_penalty=_opt_float(codegen_cfg.get("presence_penalty")),
frequency_penalty=_opt_float(codegen_cfg.get("frequency_penalty")),
max_attempts=int(codegen_cfg.get("max_attempts", 3)),
api_key=codegen_endpoint["api_key"],
extra_headers=codegen_endpoint["extra_headers"],