Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion python/openai/openai_frontend/engine/triton_engine.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# Copyright 2024-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -991,6 +991,11 @@ def _validate_completion_request(
if not isinstance(request.prompt, str):
raise ClientError("only single string input is supported")

if "best_of" in request.model_fields_set and metadata.backend == "vllm":
raise ClientError(
"best_of is no longer supported in vLLM backend, removed from vLLM V1 engine"
)

if request.n and request.n > 1:
raise ClientError(
f"Received n={request.n}, but only single choice (n=1) is currently supported"
Expand Down
4 changes: 3 additions & 1 deletion python/openai/openai_frontend/engine/utils/triton.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# Copyright 2024-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -100,6 +100,8 @@ def _create_vllm_generate_request(
"max_tokens",
"logprobs",
"top_logprobs",
# not supported for vLLM backend (removed from vLLM V1) but supported for TRT-LLM/Python backend
"best_of",
}

# NOTE: The exclude_none is important, as internals may not support
Expand Down
5 changes: 4 additions & 1 deletion python/openai/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# Copyright 2024-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -31,6 +31,9 @@ fastapi==0.121.2
httpx==0.27.2
openai==1.107.3
partial-json-parser # used for parsing partial JSON outputs

# FIXME [TRI-641]: The latest stable version of scipy is 1.17.0 which caused segfault during tests. See TRI-620.
scipy==1.16.3
# Minimum starlette version needed to address CVE(s):
# https://github.com/advisories/GHSA-f96h-pmfr-66vw
# https://github.com/advisories/GHSA-7f5h-v6xp-fcq8
Expand Down
3 changes: 2 additions & 1 deletion python/openai/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# Copyright 2024-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -37,6 +37,7 @@ def pytest_configure(config):
config.addinivalue_line(
"markers", "openai: mark test to run with OpenAI server (subprocess)"
)
config.addinivalue_line("markers", "asyncio: mark test as an asyncio test")


### TEST ENVIRONMENT SETUP ###
Expand Down
16 changes: 12 additions & 4 deletions python/openai/tests/test_completions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# Copyright 2024-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -57,7 +57,6 @@ def test_completions_defaults(self, client, model: str, prompt: str):
("top_p", 0.9),
("frequency_penalty", 0.5),
("presence_penalty", 0.2),
("best_of", 1),
("n", 1),
# logprobs is an integer for completions
("logprobs", 5),
Expand Down Expand Up @@ -359,7 +358,12 @@ def test_no_prompt(self, client, model: str):
],
)
def test_completions_multiple_choices(
self, client, sampling_parameter_dict: dict, model: str, prompt: str
self,
client,
sampling_parameter_dict: dict,
backend: str,
model: str,
prompt: str,
):
response = client.post(
"/v1/completions",
Expand All @@ -370,7 +374,11 @@ def test_completions_multiple_choices(
# FIXME: Add support and test for success
# Expected to fail when n or best_of > 1, only single choice supported for now
assert response.status_code == 400
assert "only single choice" in response.json()["detail"]
if backend == "vllm" and "best_of" in sampling_parameter_dict:
error_message = "best_of is no longer supported in vLLM backend"
else:
error_message = "only single choice"
assert error_message in response.json()["detail"]

@pytest.mark.skip(reason="Not Implemented Yet")
def test_lora(self):
Expand Down
Loading