main
py 27 lines 881 Bytes
Raw
1 # SPDX-License-Identifier: Apache-2.0
2 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3
4 import pytest
5
6 from vllm.reasoning import ReasoningParserManager
7 from vllm.tokenizers import get_tokenizer
8
9 pytestmark = pytest.mark.skip_global_cleanup
10
11 REASONING_MODEL_NAME = "stepfun-ai/step3"
12
13
14 @pytest.fixture(scope="module")
15 def step3_parser():
16 tokenizer = get_tokenizer(tokenizer_name=REASONING_MODEL_NAME)
17 return ReasoningParserManager.get_reasoning_parser("step3")(tokenizer)
18
19
20 def test_count_reasoning_tokens_stops_at_think_end(step3_parser):
21 end = step3_parser.think_end_token_id
22 assert step3_parser.count_reasoning_tokens([11, 12, end, 13]) == 2
23
24
25 def test_count_reasoning_tokens_without_think_end(step3_parser):
26 """Step3 treats output as reasoning until </think> appears."""
27 assert step3_parser.count_reasoning_tokens([11, 12, 13]) == 3