remove reasoning from llm calls for title and description generation

This commit is contained in:
gabby committed 2026-10-01 01:43:36 +00:00
1 parent 50c83c61fd
commit 65c5899393
8 files changed
+84 -3

No files matched your search

+1
View File
@@ -83,6 +83,7 @@ def build_scheduler(config: dict) -> tuple[Scheduler, dict]:
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)),
disable_thinking=bool(llm_cfg.get("disable_thinking", True)),
)
log = DecisionLog(config.get("log", "data/decisions.jsonl"))
trace = TraceLog(config.get("trace", "data/runs.jsonl"))
+9
View File
@@ -26,6 +26,13 @@ class LLMClient(OpenAICompatClient):
Short JSON replies, so the defaults are conservative: low temperature, no
presence penalty, a modest timeout, and single-shot generation. Every value
is overridable from the `llm` block in `config.json`.
`disable_thinking` defaults **on**: the small local model is often a
reasoning model (e.g. `qwen3.5:4b`) whose hidden chain-of-thought consumes
the short reply budget and leaves `content` empty — the same cap problem
codegen documents, but here the reply is a ~30-token JSON object, so the
thinking is pure overhead. Set `llm.disable_thinking: false` for a
non-reasoning endpoint that rejects the parameter.
"""
error_class = LLMError
@@ -54,6 +61,7 @@ class LLMClient(OpenAICompatClient):
top_p: float = 0.9,
presence_penalty: float = 0.0,
frequency_penalty: float = 0.0,
disable_thinking: bool = True,
):
super().__init__(
base_url=base_url,
@@ -76,6 +84,7 @@ class LLMClient(OpenAICompatClient):
top_p=top_p,
presence_penalty=presence_penalty,
frequency_penalty=frequency_penalty,
disable_thinking=disable_thinking,
)
@staticmethod
+11
View File
@@ -88,6 +88,13 @@ class OpenAICompatClient:
`frequency_penalty` are per-`chat` overridable; the `generate_skill_body`
escalation ladder bumps presence toward the card's max (2.0) and lowers
temperature on retries. `max_attempts` bounds that ladder (default 3).
`disable_thinking` sends `reasoning_effort: "none"` so a reasoning model
answers directly instead of spending the (short) reply budget on hidden
chain-of-thought. It is off by default because codegen *wants* the
reasoning; the `llm` title/description author turns it on. Ollama honors it
on the `/v1` compat endpoint (its native `think:false` is not plumbed
through `/v1`).
"""
error_class = ProviderError
@@ -117,6 +124,7 @@ class OpenAICompatClient:
presence_penalty: float = 1.5,
frequency_penalty: float = 0.2,
max_attempts: int = 3,
disable_thinking: bool = False,
):
self.base_url = base_url.rstrip("/")
self.model = model
@@ -139,6 +147,7 @@ class OpenAICompatClient:
self.presence_penalty = presence_penalty
self.frequency_penalty = frequency_penalty
self.max_attempts = max_attempts
self.disable_thinking = disable_thinking
self._window: int | None = None
def chat(
@@ -169,6 +178,8 @@ class OpenAICompatClient:
"stream": True,
"stream_options": {"include_usage": True},
}
if self.disable_thinking:
payload["reasoning_effort"] = "none"
if max_tokens is not None:
payload["max_tokens"] = max_tokens
body = json.dumps(payload).encode("utf-8")