[Bugfix][Frontend] Reject beam search with echo and logprobs in /v1/completions (#60876)
Signed-off-by: surawut.j <surawut.jirasaktavee@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
5dc9bcd8cd
commit
c811943137
@@ -852,6 +852,20 @@ def test_logprobs_below_minus_one_rejected():
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("max_tokens", [5, 0])
|
||||
def test_beam_search_echo_logprobs_rejected(max_tokens):
|
||||
"""Beam search does not compute prompt logprobs, so echo + logprobs is rejected."""
|
||||
with pytest.raises(VLLMValidationError, match="not supported with beam search"):
|
||||
CompletionRequest(
|
||||
model=MODEL_NAME,
|
||||
prompt="Test prompt",
|
||||
max_tokens=max_tokens,
|
||||
use_beam_search=True,
|
||||
echo=True,
|
||||
logprobs=1,
|
||||
)
|
||||
|
||||
|
||||
class TestCompletionPromptListLimit:
|
||||
"""Regression tests for CVE: unbounded prompt list fan-out."""
|
||||
|
||||
|
||||
@@ -492,6 +492,17 @@ class CompletionRequest(OpenAIBaseModel):
|
||||
parameter="logprob_token_ids",
|
||||
)
|
||||
|
||||
if (
|
||||
data.get("use_beam_search")
|
||||
and data.get("echo")
|
||||
and data.get("logprobs") is not None
|
||||
):
|
||||
raise VLLMValidationError(
|
||||
"`echo` with `logprobs` is not supported with beam search "
|
||||
"because beam search does not compute prompt logprobs.",
|
||||
parameter="echo",
|
||||
)
|
||||
|
||||
if (
|
||||
data.get("logprob_token_ids")
|
||||
and data.get("echo")
|
||||
|
||||
Reference in New Issue
Block a user