Skip to content

Commit 0e81041

Browse files
authored
tests : use reasoning instead of reasoning_budget in server tests (ggml-org#20432)
1 parent 128142f commit 0e81041

2 files changed

Lines changed: 16 additions & 15 deletions

File tree

tools/server/tests/unit/test_template.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
import datetime
1313
from utils import *
14+
from typing import Literal
1415

1516
server: ServerProcess
1617

@@ -23,24 +24,24 @@ def create_server():
2324

2425

2526
@pytest.mark.parametrize("tools", [None, [], [TEST_TOOL]])
26-
@pytest.mark.parametrize("template_name,reasoning_budget,expected_end", [
27-
("deepseek-ai-DeepSeek-R1-Distill-Qwen-32B", None, "<think>\n"),
28-
("deepseek-ai-DeepSeek-R1-Distill-Qwen-32B", -1, "<think>\n"),
29-
("deepseek-ai-DeepSeek-R1-Distill-Qwen-32B", 0, "<think>\n</think>"),
27+
@pytest.mark.parametrize("template_name,reasoning,expected_end", [
28+
("deepseek-ai-DeepSeek-R1-Distill-Qwen-32B", "on", "<think>\n"),
29+
("deepseek-ai-DeepSeek-R1-Distill-Qwen-32B","auto", "<think>\n"),
30+
("deepseek-ai-DeepSeek-R1-Distill-Qwen-32B", "off", "<think>\n</think>"),
3031
31-
("Qwen-Qwen3-0.6B", -1, "<|im_start|>assistant\n"),
32-
("Qwen-Qwen3-0.6B", 0, "<|im_start|>assistant\n<think>\n\n</think>\n\n"),
32+
("Qwen-Qwen3-0.6B","auto", "<|im_start|>assistant\n"),
33+
("Qwen-Qwen3-0.6B", "off", "<|im_start|>assistant\n<think>\n\n</think>\n\n"),
3334
34-
("Qwen-QwQ-32B", -1, "<|im_start|>assistant\n<think>\n"),
35-
("Qwen-QwQ-32B", 0, "<|im_start|>assistant\n<think>\n</think>"),
35+
("Qwen-QwQ-32B","auto", "<|im_start|>assistant\n<think>\n"),
36+
("Qwen-QwQ-32B", "off", "<|im_start|>assistant\n<think>\n</think>"),
3637
37-
("CohereForAI-c4ai-command-r7b-12-2024-tool_use", -1, "<|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>"),
38-
("CohereForAI-c4ai-command-r7b-12-2024-tool_use", 0, "<|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|><|START_THINKING|><|END_THINKING|>"),
38+
("CohereForAI-c4ai-command-r7b-12-2024-tool_use","auto", "<|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>"),
39+
("CohereForAI-c4ai-command-r7b-12-2024-tool_use", "off", "<|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|><|START_THINKING|><|END_THINKING|>"),
3940
])
40-
def test_reasoning_budget(template_name: str, reasoning_budget: int | None, expected_end: str, tools: list[dict]):
41+
def test_reasoning(template_name: str, reasoning: Literal['on', 'off', 'auto'] | None, expected_end: str, tools: list[dict]):
4142
global server
4243
server.jinja = True
43-
server.reasoning_budget = reasoning_budget
44+
server.reasoning = reasoning
4445
server.chat_template_file = f'../../../models/templates/{template_name}.jinja'
4546
server.start()
4647

tools/server/tests/utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class ServerProcess:
9595
no_webui: bool | None = None
9696
jinja: bool | None = None
9797
reasoning_format: Literal['deepseek', 'none', 'nothink'] | None = None
98-
reasoning_budget: int | None = None
98+
reasoning: Literal['on', 'off', 'auto'] | None = None
9999
chat_template: str | None = None
100100
chat_template_file: str | None = None
101101
server_path: str | None = None
@@ -225,8 +225,8 @@ def start(self, timeout_seconds: int | None = DEFAULT_HTTP_TIMEOUT) -> None:
225225
server_args.append("--no-jinja")
226226
if self.reasoning_format is not None:
227227
server_args.extend(("--reasoning-format", self.reasoning_format))
228-
if self.reasoning_budget is not None:
229-
server_args.extend(("--reasoning-budget", self.reasoning_budget))
228+
if self.reasoning is not None:
229+
server_args.extend(("--reasoning", self.reasoning))
230230
if self.chat_template:
231231
server_args.extend(["--chat-template", self.chat_template])
232232
if self.chat_template_file:

0 commit comments

Comments
 (0)