Skip to content

Commit 8aea9a2

Browse files
authored
Compatible with both thinking and enable_thinking. (#1260)
1 parent 97a4887 commit 8aea9a2

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

lightllm/server/api_models.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,17 @@ def apply_loaded_defaults(cls, data: Any):
266266
data[key] = value
267267
return data
268268

269+
@model_validator(mode="after")
270+
def sync_thinking_chat_template_kwargs(self):
271+
"""Mirror thinking <-> enable_thinking when only one is set (Qwen vs DeepSeek templates)."""
272+
if not self.chat_template_kwargs:
273+
return self
274+
if "thinking" not in self.chat_template_kwargs and "enable_thinking" in self.chat_template_kwargs:
275+
self.chat_template_kwargs["thinking"] = self.chat_template_kwargs["enable_thinking"]
276+
elif "enable_thinking" not in self.chat_template_kwargs and "thinking" in self.chat_template_kwargs:
277+
self.chat_template_kwargs["enable_thinking"] = self.chat_template_kwargs["thinking"]
278+
return self
279+
269280

270281
class UsageInfo(BaseModel):
271282
prompt_tokens: int = 0

0 commit comments

Comments
 (0)