mirror of
https://github.com/RustyRaptor/doge_cogs.git
synced 2026-12-03 15:55:21 -07:00
doge_alignment: ALIGNMENT_MODEL_REASONING (reasoning_effort) for thinking models
Ollama's reasoning models spend the whole token budget thinking unless reasoning_effort is "none"; it's only sent when set. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GUebqhE8dK19vyn4Ct5g1L
This commit is contained in:
1 parent
96822d5f8c
commit
c61ef5b642
2 files changed
+14
-2
No files matched your search
@@ -179,18 +179,24 @@ def model_config(
|
||||
) -> ModelConfig | None:
|
||||
"""Return the guessing model's settings, or None if unset.
|
||||
|
||||
From ``ALIGNMENT_MODEL_URL``/``_NAME``/``_KEY``, else Red's shared API
|
||||
tokens ``alignment_model`` (``url``, ``model``, ``key``).
|
||||
From ``ALIGNMENT_MODEL_URL``/``_NAME``/``_KEY``/``_REASONING``, else
|
||||
Red's shared API tokens ``alignment_model`` (``url``, ``model``,
|
||||
``key``, ``reasoning``).
|
||||
"""
|
||||
url = env.get("ALIGNMENT_MODEL_URL") or tokens.get("url")
|
||||
if not url:
|
||||
return None
|
||||
reasoning = env.get("ALIGNMENT_MODEL_REASONING") or tokens.get(
|
||||
"reasoning"
|
||||
)
|
||||
return ModelConfig(
|
||||
base_url=url,
|
||||
model=env.get("ALIGNMENT_MODEL_NAME")
|
||||
or tokens.get("model")
|
||||
or "default",
|
||||
api_key=env.get("ALIGNMENT_MODEL_KEY") or tokens.get("key"),
|
||||
# "none" turns thinking off on reasoning models (Ollama)
|
||||
extra={"reasoning_effort": reasoning} if reasoning else {},
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -194,3 +194,9 @@ def test_model_config_from_env_then_tokens() -> None:
|
||||
from_env = model_config(env, tokens)
|
||||
assert from_env is not None
|
||||
assert (from_env.base_url, from_env.model) == ("http://e", "tm")
|
||||
assert from_env.extra == {}
|
||||
thinking_off = model_config(
|
||||
{**env, "ALIGNMENT_MODEL_REASONING": "none"}, {}
|
||||
)
|
||||
assert thinking_off is not None
|
||||
assert thinking_off.extra == {"reasoning_effort": "none"}
|
||||
Reference in new issue
Block a user