mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-08 13:12:08 +00:00
fix: forward reasoning_effort for custom providers (GLM-5.2 on ARK)
- Add 'max' to VALID_REASONING_EFFORTS (GLM-5.2 native parameter) - Emit top-level reasoning_effort string for custom providers - Stop hardcoding 'medium' in legacy extra_body.reasoning, use actual effort Custom providers (e.g. GLM-5.2 on Volcengine ARK) silently dropped reasoning_effort — the value never reached the upstream API. Kimi, TokenHub, and LM Studio all had dedicated branches for this, but custom providers had none.
This commit is contained in:
parent
4651ac64a1
commit
f69a33794b
2 changed files with 21 additions and 2 deletions
|
|
@ -377,6 +377,22 @@ class ChatCompletionsTransport(ProviderTransport):
|
|||
if _lm_effort is not None:
|
||||
api_kwargs["reasoning_effort"] = _lm_effort
|
||||
|
||||
# Custom provider (e.g. GLM-5.2 on ARK): send top-level reasoning_effort
|
||||
# string so the upstream API receives its native parameter format.
|
||||
if params.get("is_custom_provider", False):
|
||||
_custom_thinking_off = bool(
|
||||
reasoning_config
|
||||
and isinstance(reasoning_config, dict)
|
||||
and reasoning_config.get("enabled") is False
|
||||
)
|
||||
if not _custom_thinking_off:
|
||||
_custom_effort = "medium"
|
||||
if reasoning_config and isinstance(reasoning_config, dict):
|
||||
_custom_effort = (
|
||||
reasoning_config.get("effort", "medium") or "medium"
|
||||
)
|
||||
api_kwargs["reasoning_effort"] = _custom_effort
|
||||
|
||||
# extra_body assembly
|
||||
extra_body: dict[str, Any] = {}
|
||||
|
||||
|
|
@ -423,7 +439,10 @@ class ChatCompletionsTransport(ProviderTransport):
|
|||
if gh_reasoning is not None:
|
||||
extra_body["reasoning"] = gh_reasoning
|
||||
else:
|
||||
extra_body["reasoning"] = {"enabled": True, "effort": "medium"}
|
||||
_effort = "medium"
|
||||
if reasoning_config and isinstance(reasoning_config, dict):
|
||||
_effort = reasoning_config.get("effort", "medium") or "medium"
|
||||
extra_body["reasoning"] = {"enabled": True, "effort": _effort}
|
||||
|
||||
if provider_name == "gemini":
|
||||
raw_thinking_config = _build_gemini_thinking_config(model, reasoning_config)
|
||||
|
|
|
|||
|
|
@ -791,7 +791,7 @@ def apply_subprocess_home_env(env: dict[str, str]) -> None:
|
|||
env["HOME"] = home
|
||||
|
||||
|
||||
VALID_REASONING_EFFORTS = ("minimal", "low", "medium", "high", "xhigh")
|
||||
VALID_REASONING_EFFORTS = ("minimal", "low", "medium", "high", "xhigh", "max")
|
||||
|
||||
|
||||
def parse_reasoning_effort(effort) -> dict | None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue