@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 346e56455a
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 10, 19:00 UTC

Add chat prefix completion feature to DeepSeek v3.2 (#31147)

CHENYUE committed Jan 5, 2026 at 11:20 UTC 346e56455a3b10787c7d6e951861317953723185
1 file changed +9 -5
vllm/tokenizers/deepseek_v32_encoding.py
+9 -5
@@ -169,6 +169,7 @@ def render_message(
169 response_format = msg.get("response_format")
170 tool_calls = msg.get("tool_calls")
171 reasoning_content = msg.get("reasoning") or msg.get("reasoning_content")
172 + is_prefix = msg.get("prefix", False)
173
174 if tools:
175 tools = tools_from_openai_format(tools)
@@ -273,11 +274,14 @@ def render_message(
274 + thinking_end_token
275 )
276
276 - prompt += assistant_msg_template.format(
277 - reasoning=thinking_part,
278 - content=summary_content,
279 - tool_calls=tool_calls_content,
280 - )
277 + if not tool_calls and is_prefix:
278 + prompt += summary_content
279 + else:
280 + prompt += assistant_msg_template.format(
281 + reasoning=thinking_part,
282 + content=summary_content,
283 + tool_calls=tool_calls_content,
284 + )
285 else:
286 raise NotImplementedError(f"Unknown role: {role}")
287