Skip to content

Commit 4eade36

Browse files
authored
ci: Fix L0_openai_vllm (#8616)
1 parent 62a84b6 commit 4eade36

5 files changed

Lines changed: 27 additions & 8 deletions

File tree

python/openai/openai_frontend/engine/triton_engine.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2024-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
1+
# Copyright 2024-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
#
33
# Redistribution and use in source and binary forms, with or without
44
# modification, are permitted provided that the following conditions
@@ -991,6 +991,11 @@ def _validate_completion_request(
991991
if not isinstance(request.prompt, str):
992992
raise ClientError("only single string input is supported")
993993

994+
if "best_of" in request.model_fields_set and metadata.backend == "vllm":
995+
raise ClientError(
996+
"best_of is no longer supported in vLLM backend, removed from vLLM V1 engine"
997+
)
998+
994999
if request.n and request.n > 1:
9951000
raise ClientError(
9961001
f"Received n={request.n}, but only single choice (n=1) is currently supported"

python/openai/openai_frontend/engine/utils/triton.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2024-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
1+
# Copyright 2024-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
#
33
# Redistribution and use in source and binary forms, with or without
44
# modification, are permitted provided that the following conditions
@@ -100,6 +100,8 @@ def _create_vllm_generate_request(
100100
"max_tokens",
101101
"logprobs",
102102
"top_logprobs",
103+
# not supported for vLLM backend (removed from vLLM V1) but supported for TRT-LLM/Python backend
104+
"best_of",
103105
}
104106

105107
# NOTE: The exclude_none is important, as internals may not support

python/openai/requirements.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2024-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
1+
# Copyright 2024-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
#
33
# Redistribution and use in source and binary forms, with or without
44
# modification, are permitted provided that the following conditions
@@ -31,6 +31,9 @@ fastapi==0.121.2
3131
httpx==0.27.2
3232
openai==1.107.3
3333
partial-json-parser # used for parsing partial JSON outputs
34+
35+
# FIXME [TRI-641]: The latest stable version of scipy is 1.17.0 which caused segfault during tests. See TRI-620.
36+
scipy==1.16.3
3437
# Minimum starlette version needed to address CVE(s):
3538
# https://github.com/advisories/GHSA-f96h-pmfr-66vw
3639
# https://github.com/advisories/GHSA-7f5h-v6xp-fcq8

python/openai/tests/conftest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2024-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
1+
# Copyright 2024-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
#
33
# Redistribution and use in source and binary forms, with or without
44
# modification, are permitted provided that the following conditions
@@ -37,6 +37,7 @@ def pytest_configure(config):
3737
config.addinivalue_line(
3838
"markers", "openai: mark test to run with OpenAI server (subprocess)"
3939
)
40+
config.addinivalue_line("markers", "asyncio: mark test as an asyncio test")
4041

4142

4243
### TEST ENVIRONMENT SETUP ###

python/openai/tests/test_completions.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2024-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
1+
# Copyright 2024-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
#
33
# Redistribution and use in source and binary forms, with or without
44
# modification, are permitted provided that the following conditions
@@ -57,7 +57,6 @@ def test_completions_defaults(self, client, model: str, prompt: str):
5757
("top_p", 0.9),
5858
("frequency_penalty", 0.5),
5959
("presence_penalty", 0.2),
60-
("best_of", 1),
6160
("n", 1),
6261
# logprobs is an integer for completions
6362
("logprobs", 5),
@@ -359,7 +358,12 @@ def test_no_prompt(self, client, model: str):
359358
],
360359
)
361360
def test_completions_multiple_choices(
362-
self, client, sampling_parameter_dict: dict, model: str, prompt: str
361+
self,
362+
client,
363+
sampling_parameter_dict: dict,
364+
backend: str,
365+
model: str,
366+
prompt: str,
363367
):
364368
response = client.post(
365369
"/v1/completions",
@@ -370,7 +374,11 @@ def test_completions_multiple_choices(
370374
# FIXME: Add support and test for success
371375
# Expected to fail when n or best_of > 1, only single choice supported for now
372376
assert response.status_code == 400
373-
assert "only single choice" in response.json()["detail"]
377+
if backend == "vllm" and "best_of" in sampling_parameter_dict:
378+
error_message = "best_of is no longer supported in vLLM backend"
379+
else:
380+
error_message = "only single choice"
381+
assert error_message in response.json()["detail"]
374382

375383
@pytest.mark.skip(reason="Not Implemented Yet")
376384
def test_lora(self):

0 commit comments

Comments
 (0)