[DSV4] Cherry pick missing commits from deepseek_v4 branch and enhance tests (#24793)

Co-authored-by: Xinyuan Tong <115166877+JustinTong0323@users.noreply.github.com>
Co-authored-by: yueming-yuan <yym022502@gmail.com>
This commit is contained in:
Baizhou Zhang
2026-05-09 04:15:37 -07:00
committed by GitHub
co-authored by Xinyuan Tong yueming-yuan
parent 4b23f6bdc5
commit ef5e9f8aba
15 changed files with 481 additions and 87 deletions
@@ -220,6 +220,37 @@ class TestChatCompletionRequest(unittest.TestCase):
self.assertFalse(request.chat_template_kwargs.get("thinking"))
self.assertFalse(request.chat_template_kwargs.get("enable_thinking"))
def test_chat_completion_reasoning_effort_max(self):
"""`max` is an sglang extension on chat completion's top-level
`reasoning_effort` only; the Responses-API-style nested
`reasoning.effort` path stays aligned with OpenAI's three levels."""
from pydantic import ValidationError
messages = [{"role": "user", "content": "Hello"}]
request = ChatCompletionRequest(
model="test-model",
messages=messages,
reasoning_effort="max",
)
self.assertEqual(request.reasoning_effort, "max")
# Unknown values still rejected.
with self.assertRaises(ValidationError):
ChatCompletionRequest(
model="test-model",
messages=messages,
reasoning_effort="ultra",
)
# Nested reasoning.effort=max is NOT promoted by normalize_reasoning_inputs:
# the Responses API path keeps the OpenAI low/medium/high contract.
request = ChatCompletionRequest(
model="test-model",
messages=messages,
reasoning={"effort": "max"},
)
self.assertNotEqual(request.reasoning_effort, "max")
def test_chat_completion_json_format(self):
"""Test chat completion json format"""
transcript = "Good morning! It's 7:00 AM, and I'm just waking up. Today is going to be a busy day, "