fix(providers): honor disabled thinking for supported GLM models
This commit is contained in:
1 parent
67742b2880
commit
8c8fbc7a05
2 files changed
+25
No files matched your search
@@ -168,6 +168,11 @@ def _thinking_styles_for(spec: ProviderSpec | None, model_name: str) -> list[str
|
||||
styles: list[str] = []
|
||||
if spec and spec.thinking_style:
|
||||
styles.append(spec.thinking_style)
|
||||
elif spec and spec.name == "zhipu" and _model_slug(model_name) in {
|
||||
"glm-4.6", "glm-4.7", "glm-5", "glm-5.1", "glm-5.2",
|
||||
}:
|
||||
# Keep this model-specific: GLM-5.3 requires thinking and cannot disable it.
|
||||
styles.append("thinking_type")
|
||||
model_style = _model_thinking_style(model_name)
|
||||
if model_style and model_style not in styles:
|
||||
styles.append(model_style)
|
||||
|
||||
@@ -1485,6 +1485,26 @@ def _build_kwargs_for(provider_name: str, model: str, reasoning_effort=None):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("provider, model, effort, thinking_type", [
|
||||
("zhipu", "glm-4.6", "none", "disabled"),
|
||||
("zhipu", "glm-4.7", "none", "disabled"),
|
||||
("zhipu", "glm-5", "none", "disabled"),
|
||||
("zhipu", "glm-5.1", "none", "disabled"),
|
||||
("zhipu", "glm-5.2", "none", "disabled"),
|
||||
("zhipu", "glm-5.2", "minimal", "disabled"),
|
||||
("zhipu", "glm-4.7", "high", "enabled"),
|
||||
("zhipu", "glm-4.7", None, None),
|
||||
("zhipu", "glm-5.3", "none", None),
|
||||
("zhipu", "glm-5.3-flash", "none", None),
|
||||
("custom", "glm-4.7", "none", None),
|
||||
])
|
||||
def test_zhipu_glm_thinking_controls(provider, model, effort, thinking_type) -> None:
|
||||
kw = _build_kwargs_for(provider, model, reasoning_effort=effort)
|
||||
assert kw.get("extra_body", {}).get("thinking", {}).get("type") == thinking_type
|
||||
if effort == "none":
|
||||
assert "reasoning_effort" not in kw
|
||||
|
||||
|
||||
def test_dashscope_thinking_enabled_with_reasoning_effort() -> None:
|
||||
kw = _build_kwargs_for("dashscope", "qwen3-plus", reasoning_effort="medium")
|
||||
assert kw["extra_body"] == {"enable_thinking": True}
|
||||
|
||||
Reference in new issue
Block a user