Skip to content

Commit b82f55e

Browse files
committed
[Bugfix] deepseek_r1_reasoning_parser put reason content in wrong field when no end think tag in output
Signed-off-by: Mo Xu <moxu@amazon.com>
1 parent ad97763 commit b82f55e

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

tests/entrypoints/openai/reasoning_parsers/test_deepseekr1_reasoning_parser.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424
"reasoning_content": "This is a reasoning section",
2525
"content": None,
2626
}
27-
NO_REASONING = {
27+
NO_CONTENT = {
2828
"output": "This is content",
29-
"reasoning_content": None,
30-
"content": "This is content",
29+
"reasoning_content": "This is content",
30+
"content": None,
3131
}
3232
NO_REASONING_STREAMING = {
3333
"output": "This is a reasoning section",
@@ -98,8 +98,8 @@
9898
),
9999
pytest.param(
100100
False,
101-
NO_REASONING,
102-
id="no_reasoning_token",
101+
NO_CONTENT,
102+
id="no_content_token",
103103
),
104104
pytest.param(
105105
True,

vllm/entrypoints/openai/reasoning_parsers/deepseek_r1_reasoning_parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def extract_reasoning_content(
128128
# Thus we assume the reasoning content is always at the start.
129129
# Ref https://huggingface.co/deepseek-ai/DeepSeek-R1/commit/8a58a132790c9935686eb97f042afa8013451c9f
130130
if self.think_end_token not in model_output:
131-
return None, model_output
131+
return model_output, None
132132
else:
133133
# Add a start token if it's missing to keep compatibility.
134134
if self.think_start_token not in model_output:

0 commit comments

Comments
 (0)