Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions agent/auxiliary_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -679,10 +679,13 @@ def create(self, **kwargs) -> Any:
# Codex backend, which rejects e.g. {"effort": null}
# with a 400.
effort = reasoning_cfg.get("effort") or "medium"
# Codex backend rejects "minimal"; clamp to "low" to
# match the main-agent Codex transport behavior.
# Codex backend rejects "minimal" and has no "max"
# tier; clamp to match the main-agent Codex transport
# behavior (agent/transports/codex.py::_effort_clamp).
if effort == "minimal":
effort = "low"
elif effort == "max":
effort = "high"
resp_kwargs["reasoning"] = {
"effort": effort,
"summary": "auto",
Expand Down
2 changes: 1 addition & 1 deletion agent/lmstudio_reasoning.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

# LM Studio accepts these top-level reasoning_effort values via its
# OpenAI-compatible chat.completions endpoint.
_LM_VALID_EFFORTS = {"none", "minimal", "low", "medium", "high", "xhigh"}
_LM_VALID_EFFORTS = {"none", "minimal", "low", "medium", "high", "xhigh", "max"}

# Toggle-style models publish allowed_options as ["off","on"] in /api/v1/models.
# Map them onto the OpenAI-compatible request vocabulary.
Expand Down
6 changes: 3 additions & 3 deletions agent/transports/chat_completions.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def _build_gemini_thinking_config(model: str, reasoning_config: dict | None) ->
if normalized_model.startswith("gemini-2.5-"):
return thinking_config

if effort not in {"minimal", "low", "medium", "high", "xhigh"}:
if effort not in {"minimal", "low", "medium", "high", "xhigh", "max"}:
effort = "medium"
Comment on lines +56 to 57

# Gemini 3 Flash documents low/medium/high thinking levels; Gemini 3 Pro
Expand All @@ -63,13 +63,13 @@ def _build_gemini_thinking_config(model: str, reasoning_config: dict | None) ->
if "flash" in normalized_model:
if effort in {"minimal", "low"}:
thinking_config["thinkingLevel"] = "low"
elif effort in {"high", "xhigh"}:
elif effort in {"high", "xhigh", "max"}:
thinking_config["thinkingLevel"] = "high"
else:
thinking_config["thinkingLevel"] = "medium"
elif "pro" in normalized_model:
thinking_config["thinkingLevel"] = (
"high" if effort in {"high", "xhigh"} else "low"
"high" if effort in {"high", "xhigh", "max"} else "low"
)
Comment on lines 71 to 73

return thinking_config
Expand Down
2 changes: 1 addition & 1 deletion agent/transports/codex.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def build_kwargs(
elif reasoning_config.get("effort"):
reasoning_effort = reasoning_config["effort"]

_effort_clamp = {"minimal": "low"}
_effort_clamp = {"minimal": "low", "max": "high"}
reasoning_effort = _effort_clamp.get(reasoning_effort, reasoning_effort)
Comment on lines +89 to 90

kwargs = {
Expand Down
4 changes: 2 additions & 2 deletions batch_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -1173,7 +1173,7 @@ def main(
providers_order (str): Comma-separated list of OpenRouter providers to try in order (e.g. "anthropic,openai,google")
provider_sort (str): Sort providers by "price", "throughput", or "latency" (OpenRouter only)
max_tokens (int): Maximum tokens for model responses (optional, uses model default if not set)
reasoning_effort (str): OpenRouter reasoning effort level: "none", "minimal", "low", "medium", "high", "xhigh" (default: "medium")
reasoning_effort (str): OpenRouter reasoning effort level: "none", "minimal", "low", "medium", "high", "xhigh", "max" (default: "medium")
reasoning_disabled (bool): Completely disable reasoning/thinking tokens (default: False)
prefill_messages_file (str): Path to JSON file containing prefill messages (list of {role, content} dicts)
max_samples (int): Only process the first N samples from the dataset (optional, processes all if not set)
Expand Down Expand Up @@ -1242,7 +1242,7 @@ def main(
print("🧠 Reasoning: DISABLED (effort=none)")
elif reasoning_effort:
# Use specified effort level
valid_efforts = ["none", "minimal", "low", "medium", "high", "xhigh"]
valid_efforts = ["none", "minimal", "low", "medium", "high", "xhigh", "max"]
if reasoning_effort not in valid_efforts:
print(f"❌ Error: --reasoning_effort must be one of: {', '.join(valid_efforts)}")
return
Expand Down
6 changes: 3 additions & 3 deletions cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -8476,7 +8476,7 @@ def _handle_reasoning_command(self, cmd: str):

Usage:
/reasoning Show current effort level and display state
/reasoning <level> Set reasoning effort (none, minimal, low, medium, high, xhigh)
/reasoning <level> Set reasoning effort (none, minimal, low, medium, high, xhigh, max)
/reasoning show|on Show model thinking/reasoning in output
/reasoning hide|off Hide model thinking/reasoning from output
"""
Expand All @@ -8494,7 +8494,7 @@ def _handle_reasoning_command(self, cmd: str):
display_state = "on ✓" if self.show_reasoning else "off"
_cprint(f" {_ACCENT}Reasoning effort: {level}{_RST}")
_cprint(f" {_ACCENT}Reasoning display: {display_state}{_RST}")
_cprint(f" {_DIM}Usage: /reasoning <none|minimal|low|medium|high|xhigh|show|hide>{_RST}")
_cprint(f" {_DIM}Usage: /reasoning <none|minimal|low|medium|high|xhigh|max|show|hide>{_RST}")
return

arg = parts[1].strip().lower()
Expand All @@ -8520,7 +8520,7 @@ def _handle_reasoning_command(self, cmd: str):
parsed = _parse_reasoning_config(arg)
if parsed is None:
_cprint(f" {_DIM}(._.) Unknown argument: {arg}{_RST}")
_cprint(f" {_DIM}Valid levels: none, minimal, low, medium, high, xhigh{_RST}")
_cprint(f" {_DIM}Valid levels: none, minimal, low, medium, high, xhigh, max{_RST}")
_cprint(f" {_DIM}Display: show, hide{_RST}")
return

Expand Down
6 changes: 3 additions & 3 deletions gateway/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -2243,8 +2243,8 @@ def _load_reasoning_config() -> dict | None:
"""Load reasoning effort from config.yaml.

Reads agent.reasoning_effort from config.yaml. Valid: "none",
"minimal", "low", "medium", "high", "xhigh". Returns None to use
default (medium).
"minimal", "low", "medium", "high", "xhigh", "max". Returns None
to use default (medium).
"""
from hermes_constants import parse_reasoning_effort
effort = ""
Expand Down Expand Up @@ -10553,7 +10553,7 @@ def _save_config_key(key_path: str, value):
return t("gateway.reasoning.reset_done")
if effort == "none":
parsed = {"enabled": False}
elif effort in {"minimal", "low", "medium", "high", "xhigh"}:
elif effort in {"minimal", "low", "medium", "high", "xhigh", "max"}:
parsed = {"enabled": True, "effort": effort}
else:
return t(
Expand Down
2 changes: 1 addition & 1 deletion hermes_cli/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class CommandDef:
"Configuration"),
CommandDef("reasoning", "Manage reasoning effort and display", "Configuration",
args_hint="[level|show|hide]",
subcommands=("none", "minimal", "low", "medium", "high", "xhigh", "show", "hide", "on", "off")),
subcommands=("none", "minimal", "low", "medium", "high", "xhigh", "max", "show", "hide", "on", "off")),
CommandDef("fast", "Toggle fast mode — OpenAI Priority Processing / Anthropic Fast Mode (Normal/Fast)", "Configuration",
args_hint="[normal|fast|status]",
subcommands=("normal", "fast", "status", "on", "off")),
Expand Down
2 changes: 1 addition & 1 deletion hermes_cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3845,7 +3845,7 @@ def _prompt_reasoning_effort_selection(efforts, current_effort=""):
str(effort).strip().lower() for effort in efforts if str(effort).strip()
)
)
canonical_order = ("minimal", "low", "medium", "high", "xhigh")
canonical_order = ("minimal", "low", "medium", "high", "xhigh", "max")
ordered = [effort for effort in canonical_order if effort in deduped]
ordered.extend(effort for effort in deduped if effort not in canonical_order)
if not ordered:
Expand Down
12 changes: 10 additions & 2 deletions hermes_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,21 @@ def get_subprocess_home() -> str | None:
return None


VALID_REASONING_EFFORTS = ("minimal", "low", "medium", "high", "xhigh")
VALID_REASONING_EFFORTS = ("minimal", "low", "medium", "high", "xhigh", "max")


def parse_reasoning_effort(effort: str) -> dict | None:
"""Parse a reasoning effort level into a config dict.

Valid levels: "none", "minimal", "low", "medium", "high", "xhigh".
Valid levels: "none", "minimal", "low", "medium", "high", "xhigh", "max".

"max" is the strongest level Anthropic exposes on Claude 4.7+ adaptive
thinking (and is also the strongest level Claude 4.6 accepts, since 4.6
has no "xhigh"). Provider adapters that don't support a distinct "max"
treat it as their own ceiling — for example, OpenRouter/OpenAI-style
`reasoning.effort` consumers should map "max" to their highest supported
level.
Comment on lines +202 to +204

Returns None when the input is empty or unrecognized (caller uses default).
Returns {"enabled": False} for "none".
Returns {"enabled": True, "effort": <level>} for valid effort levels.
Expand Down
4 changes: 2 additions & 2 deletions locales/af.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,14 @@ gateway:
level_disabled: "none (gedeaktiveer)"
scope_session: "sessie-oorskryf"
scope_global: "globale konfigurasie"
status: "🧠 **Redenering-instellings**\n\n**Inspanning:** `{level}`\n**Bereik:** {scope}\n**Vertoon:** {display}\n\n_Gebruik:_ `/reasoning <none|minimal|low|medium|high|xhigh|reset|show|hide> [--global]`"
status: "🧠 **Redenering-instellings**\n\n**Inspanning:** `{level}`\n**Bereik:** {scope}\n**Vertoon:** {display}\n\n_Gebruik:_ `/reasoning <none|minimal|low|medium|high|xhigh|max|reset|show|hide> [--global]`"
display_on: "aan ✓"
display_off: "af"
display_set_on: "🧠 ✓ Redenering-vertoon: **AAN**\nDie model se denke sal voor elke antwoord op **{platform}** vertoon word."
display_set_off: "🧠 ✓ Redenering-vertoon: **AF** vir **{platform}**"
reset_global_unsupported: "⚠️ `/reasoning reset --global` word nie ondersteun nie. Gebruik `/reasoning <level> --global` om die globale verstek te verander."
reset_done: "🧠 ✓ Sessie-redenering-oorskryf verwyder; val terug op globale konfigurasie."
unknown_arg: "⚠️ Onbekende argument: `{arg}`\n\n**Geldige vlakke:** none, minimal, low, medium, high, xhigh\n**Vertoon:** show, hide\n**Permanent:** voeg `--global` by om verby hierdie sessie te stoor"
unknown_arg: "⚠️ Onbekende argument: `{arg}`\n\n**Geldige vlakke:** none, minimal, low, medium, high, xhigh, max\n**Vertoon:** show, hide\n**Permanent:** voeg `--global` by om verby hierdie sessie te stoor"
set_global: "🧠 ✓ Redenering-inspanning gestel op `{effort}` (gestoor in konfigurasie)\n_(neem effek by die volgende boodskap)_"
set_global_save_failed: "🧠 ✓ Redenering-inspanning gestel op `{effort}` (slegs sessie — konfigurasie-stoor het misluk)\n_(neem effek by die volgende boodskap)_"
set_session: "🧠 ✓ Redenering-inspanning gestel op `{effort}` (slegs sessie — voeg `--global` by om permanent te stoor)\n_(neem effek by die volgende boodskap)_"
Expand Down
4 changes: 2 additions & 2 deletions locales/de.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,14 @@ gateway:
level_disabled: "none (deaktiviert)"
scope_session: "Sitzungs-Override"
scope_global: "Globale Konfiguration"
status: "🧠 **Reasoning-Einstellungen**\n\n**Stärke:** `{level}`\n**Geltungsbereich:** {scope}\n**Anzeige:** {display}\n\n_Verwendung:_ `/reasoning <none|minimal|low|medium|high|xhigh|reset|show|hide> [--global]`"
status: "🧠 **Reasoning-Einstellungen**\n\n**Stärke:** `{level}`\n**Geltungsbereich:** {scope}\n**Anzeige:** {display}\n\n_Verwendung:_ `/reasoning <none|minimal|low|medium|high|xhigh|max|reset|show|hide> [--global]`"
display_on: "an ✓"
display_off: "aus"
display_set_on: "🧠 ✓ Reasoning-Anzeige: **AN**\nDas Modelldenken wird vor jeder Antwort auf **{platform}** angezeigt."
display_set_off: "🧠 ✓ Reasoning-Anzeige: **AUS** für **{platform}**"
reset_global_unsupported: "⚠️ `/reasoning reset --global` wird nicht unterstützt. Verwenden Sie `/reasoning <level> --global`, um den globalen Standard zu ändern."
reset_done: "🧠 ✓ Sitzungs-Reasoning-Override gelöscht; Rückfall auf globale Konfiguration."
unknown_arg: "⚠️ Unbekanntes Argument: `{arg}`\n\n**Gültige Stärken:** none, minimal, low, medium, high, xhigh\n**Anzeige:** show, hide\n**Speichern:** `--global` hinzufügen, um über die Sitzung hinaus zu speichern"
unknown_arg: "⚠️ Unbekanntes Argument: `{arg}`\n\n**Gültige Stärken:** none, minimal, low, medium, high, xhigh, max\n**Anzeige:** show, hide\n**Speichern:** `--global` hinzufügen, um über die Sitzung hinaus zu speichern"
set_global: "🧠 ✓ Reasoning-Stärke auf `{effort}` gesetzt (in Konfiguration gespeichert)\n_(wird mit der nächsten Nachricht wirksam)_"
set_global_save_failed: "🧠 ✓ Reasoning-Stärke auf `{effort}` gesetzt (nur Sitzung — Konfiguration konnte nicht gespeichert werden)\n_(wird mit der nächsten Nachricht wirksam)_"
set_session: "🧠 ✓ Reasoning-Stärke auf `{effort}` gesetzt (nur Sitzung — `--global` hinzufügen, um zu speichern)\n_(wird mit der nächsten Nachricht wirksam)_"
Expand Down
4 changes: 2 additions & 2 deletions locales/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,14 @@ gateway:
level_disabled: "none (disabled)"
scope_session: "session override"
scope_global: "global config"
status: "🧠 **Reasoning Settings**\n\n**Effort:** `{level}`\n**Scope:** {scope}\n**Display:** {display}\n\n_Usage:_ `/reasoning <none|minimal|low|medium|high|xhigh|reset|show|hide> [--global]`"
status: "🧠 **Reasoning Settings**\n\n**Effort:** `{level}`\n**Scope:** {scope}\n**Display:** {display}\n\n_Usage:_ `/reasoning <none|minimal|low|medium|high|xhigh|max|reset|show|hide> [--global]`"
display_on: "on ✓"
display_off: "off"
display_set_on: "🧠 ✓ Reasoning display: **ON**\nModel thinking will be shown before each response on **{platform}**."
display_set_off: "🧠 ✓ Reasoning display: **OFF** for **{platform}**"
reset_global_unsupported: "⚠️ `/reasoning reset --global` is not supported. Use `/reasoning <level> --global` to change the global default."
reset_done: "🧠 ✓ Session reasoning override cleared; falling back to global config."
unknown_arg: "⚠️ Unknown argument: `{arg}`\n\n**Valid levels:** none, minimal, low, medium, high, xhigh\n**Display:** show, hide\n**Persist:** add `--global` to save beyond this session"
unknown_arg: "⚠️ Unknown argument: `{arg}`\n\n**Valid levels:** none, minimal, low, medium, high, xhigh, max\n**Display:** show, hide\n**Persist:** add `--global` to save beyond this session"
set_global: "🧠 ✓ Reasoning effort set to `{effort}` (saved to config)\n_(takes effect on next message)_"
set_global_save_failed: "🧠 ✓ Reasoning effort set to `{effort}` (session only — config save failed)\n_(takes effect on next message)_"
set_session: "🧠 ✓ Reasoning effort set to `{effort}` (session only — add `--global` to persist)\n_(takes effect on next message)_"
Expand Down
4 changes: 2 additions & 2 deletions locales/es.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,14 @@ gateway:
level_disabled: "none (deshabilitado)"
scope_session: "anulación de sesión"
scope_global: "configuración global"
status: "🧠 **Ajustes de razonamiento**\n\n**Esfuerzo:** `{level}`\n**Alcance:** {scope}\n**Visualización:** {display}\n\n_Uso:_ `/reasoning <none|minimal|low|medium|high|xhigh|reset|show|hide> [--global]`"
status: "🧠 **Ajustes de razonamiento**\n\n**Esfuerzo:** `{level}`\n**Alcance:** {scope}\n**Visualización:** {display}\n\n_Uso:_ `/reasoning <none|minimal|low|medium|high|xhigh|max|reset|show|hide> [--global]`"
display_on: "activada ✓"
display_off: "desactivada"
display_set_on: "🧠 ✓ Visualización de razonamiento: **ACTIVADA**\nEl pensamiento del modelo se mostrará antes de cada respuesta en **{platform}**."
display_set_off: "🧠 ✓ Visualización de razonamiento: **DESACTIVADA** para **{platform}**"
reset_global_unsupported: "⚠️ `/reasoning reset --global` no es compatible. Usa `/reasoning <level> --global` para cambiar el valor global por defecto."
reset_done: "🧠 ✓ Anulación de razonamiento de la sesión borrada; volviendo a la configuración global."
unknown_arg: "⚠️ Argumento desconocido: `{arg}`\n\n**Niveles válidos:** none, minimal, low, medium, high, xhigh\n**Visualización:** show, hide\n**Persistir:** añade `--global` para guardar más allá de esta sesión"
unknown_arg: "⚠️ Argumento desconocido: `{arg}`\n\n**Niveles válidos:** none, minimal, low, medium, high, xhigh, max\n**Visualización:** show, hide\n**Persistir:** añade `--global` para guardar más allá de esta sesión"
set_global: "🧠 ✓ Esfuerzo de razonamiento ajustado a `{effort}` (guardado en la configuración)\n_(se aplica en el próximo mensaje)_"
set_global_save_failed: "🧠 ✓ Esfuerzo de razonamiento ajustado a `{effort}` (solo en la sesión — error al guardar la configuración)\n_(se aplica en el próximo mensaje)_"
set_session: "🧠 ✓ Esfuerzo de razonamiento ajustado a `{effort}` (solo en la sesión — añade `--global` para persistir)\n_(se aplica en el próximo mensaje)_"
Expand Down
Loading