Skip to content

Commit 14447cd

Browse files
authored
feat(openai_api_compatible): support top-level enable_thinking parameter (#2496)
1 parent 9515840 commit 14447cd

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

models/openai_api_compatible/manifest.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: 0.0.31
1+
version: 0.0.32
22
type: plugin
33
author: "langgenius"
44
name: "openai_api_compatible"

models/openai_api_compatible/models/llm/llm.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,12 @@ def get_customizable_model_schema(
9090
en_US=(
9191
"Whether to prioritize strict OpenAI compatibility. "
9292
"When True, OpenAI compatibility is prioritized and extended parameters "
93-
"(e.g., thinking, chat_template_kwargs) are not added. "
93+
"(e.g., thinking, chat_template_kwargs, enable_thinking) are not added. "
9494
"Set to False to enable these extensions."
9595
),
9696
zh_Hans=(
9797
"是否优先严格的 OpenAI 兼容性。"
98-
"为 True 时,将优先 OpenAI 兼容性,并且不会添加扩展参数(例如 thinking、chat_template_kwargs)。"
98+
"为 True 时,将优先 OpenAI 兼容性,并且不会添加扩展参数(例如 thinking、chat_template_kwargs、enable_thinking)。"
9999
"设为 False 以启用这些扩展。"
100100
)
101101
),
@@ -231,7 +231,7 @@ def _invoke(
231231

232232
if enable_thinking_value is not None and strict_compatibility_value is False:
233233
# Only apply when `strict_compatibility_value` is False since
234-
# `chat_template_kwargs` and `thinking` are non-standard parameters.
234+
# `chat_template_kwargs` , `thinking` and `enable_thinking` are non-standard parameters.
235235

236236
chat_template_kwargs = model_parameters.setdefault("chat_template_kwargs", {})
237237
# Support vLLM/SGLang format (chat_template_kwargs)
@@ -244,6 +244,10 @@ def _invoke(
244244
"type": "enabled" if enable_thinking_value else "disabled"
245245
}
246246

247+
# Support top-level `enable_thinking` parameter
248+
# This allows compatibility API format: {"enable_thinking": False/True}
249+
model_parameters["enable_thinking"] = enable_thinking_value
250+
247251
reasoning_effort_value = model_parameters.pop("reasoning_effort", None)
248252
if enable_thinking_value is True and reasoning_effort_value is not None:
249253
# Propagate reasoning_effort to both:

0 commit comments

Comments
 (0)