[Bugfix] Return HTTP 400 instead of 501 for unknown chat roles in DeepSeek encoders (#53071)
Signed-off-by: JC-ut0 <809602657@qq.com>
This commit is contained in:
@@ -113,6 +113,17 @@ def test_deepseek_v4_explicitly_disables_thinking(kwargs):
|
||||
assert prompt == ("<|begin▁of▁sentence|><|User|>Hello<|Assistant|></think>")
|
||||
|
||||
|
||||
def test_deepseek_v4_unknown_role_raises_value_error():
|
||||
# Invalid roles are client errors: they must surface as ValueError
|
||||
# (mapped to HTTP 400 by the OpenAI serving layer), not
|
||||
# NotImplementedError (mapped to HTTP 501).
|
||||
with pytest.raises(ValueError, match="Invalid role: SYSTEM"):
|
||||
_tokenizer().apply_chat_template(
|
||||
[{"role": "SYSTEM", "content": "Hello"}],
|
||||
tokenize=False,
|
||||
)
|
||||
|
||||
|
||||
def test_deepseek_v4_uses_v4_tool_prompt_from_request_tools():
|
||||
tools = [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user