@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 91ac7f764d
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 14, 05:30 UTC

[CI][gpt-oss] Enable python tool tests in CI (#24315)

Signed-off-by: wuhang <wuhang6@huawei.com>

wuhang committed Oct 6, 2025 at 12:20 UTC 91ac7f764d04e7a9103e3c839244ce241a43b45e
3 files changed +24 -26
requirements/common.txt
+1
@@ -49,3 +49,4 @@ pybase64 # fast base64 implementation
49 cbor2 # Required for cross-language serialization of hashable objects
50 setproctitle # Used to set process names for better debugging and monitoring
51 openai-harmony >= 0.0.3 # Required for gpt-oss
52 +gpt-oss >= 0.0.7
tests/entrypoints/openai/test_response_api_with_harmony.py
+16 -22
@@ -15,22 +15,15 @@ MODEL_NAME = "openai/gpt-oss-20b"
15
16
17 @pytest.fixture(scope="module")
18 -def monkeypatch_module():
19 - from _pytest.monkeypatch import MonkeyPatch
20 -
21 - mpatch = MonkeyPatch()
22 - yield mpatch
23 - mpatch.undo()
24 -
25 -
26 -@pytest.fixture(scope="module")
27 -def server(monkeypatch_module: pytest.MonkeyPatch):
18 +def server():
19 args = ["--enforce-eager", "--tool-server", "demo"]
20 + env_dict = dict(
21 + VLLM_ENABLE_RESPONSES_API_STORE="1",
22 + PYTHON_EXECUTION_BACKEND="dangerously_use_uv",
23 + )
24
30 - with monkeypatch_module.context() as m:
31 - m.setenv("VLLM_ENABLE_RESPONSES_API_STORE", "1")
32 - with RemoteOpenAIServer(MODEL_NAME, args) as remote_server:
33 - yield remote_server
25 + with RemoteOpenAIServer(MODEL_NAME, args, env_dict=env_dict) as remote_server:
26 + yield remote_server
27
28
29 @pytest_asyncio.fixture
@@ -316,7 +309,7 @@ async def test_streaming(client: OpenAI, model_name: str, background: bool):
309 # TODO: Add back when web search and code interpreter are available in CI
310 prompts = [
311 "tell me a story about a cat in 20 words",
319 - # "What is 13 * 24? Use python to calculate the result.",
312 + "What is 13 * 24? Use python to calculate the result.",
313 # "When did Jensen found NVIDIA? Search it and answer the year only.",
314 ]
315
@@ -329,12 +322,7 @@ async def test_streaming(client: OpenAI, model_name: str, background: bool):
322 # {
323 # "type": "web_search_preview"
324 # },
332 - # {
333 - # "type": "code_interpreter",
334 - # "container": {
335 - # "type": "auto"
336 - # }
337 - # },
325 + {"type": "code_interpreter", "container": {"type": "auto"}},
326 ],
327 stream=True,
328 background=background,
@@ -412,6 +400,7 @@ async def test_streaming(client: OpenAI, model_name: str, background: bool):
400 async for event in stream:
401 counter += 1
402 assert event == events[counter]
403 + assert counter == len(events) - 1
404
405
406 @pytest.mark.asyncio
@@ -429,7 +418,6 @@ async def test_web_search(client: OpenAI, model_name: str):
418
419 @pytest.mark.asyncio
420 @pytest.mark.parametrize("model_name", [MODEL_NAME])
432 -@pytest.mark.skip(reason="Code interpreter tool is not available in CI yet.")
421 async def test_code_interpreter(client: OpenAI, model_name: str):
422 response = await client.responses.create(
423 model=model_name,
@@ -443,10 +431,16 @@ async def test_code_interpreter(client: OpenAI, model_name: str):
431 "and you must print to see the output."
432 ),
433 tools=[{"type": "code_interpreter", "container": {"type": "auto"}}],
434 + temperature=0.0, # More deterministic output in response
435 )
436 assert response is not None
437 assert response.status == "completed"
438 assert response.usage.output_tokens_details.tool_output_tokens > 0
439 + for item in response.output:
440 + if item.type == "message":
441 + output_string = item.content[0].text
442 + print("output_string: ", output_string, flush=True)
443 + assert "5846" in output_string
444
445
446 def get_weather(latitude, longitude):
vllm/entrypoints/tool.py
+7 -4
@@ -14,10 +14,12 @@ if TYPE_CHECKING:
14
15 logger = init_logger(__name__)
16
17 +MIN_GPT_OSS_VERSION = "0.0.7"
18 +
19
20 def validate_gpt_oss_install():
21 """
20 - Check if the gpt-oss is installed and its version is at least 0.0.3.
22 + Check if the gpt-oss is installed and its version is at least 0.0.7.
23 If not, raise an ImportError.
24 """
25 from importlib.metadata import PackageNotFoundError, version
@@ -25,16 +27,17 @@ def validate_gpt_oss_install():
27 from packaging.version import InvalidVersion, Version
28
29 try:
28 - pkg_version_str = version("gpt_oss") # e.g., "0.0.5"
30 + pkg_version_str = version("gpt_oss")
31 pkg_version = Version(pkg_version_str)
32 except PackageNotFoundError:
33 raise ImportError("Package 'gpt_oss' is not installed.") from None
34 except InvalidVersion as e:
35 raise ImportError(f"Invalid version string for 'gpt_oss': {e}") from None
36
35 - if pkg_version < Version("0.0.3"):
37 + if pkg_version < Version(MIN_GPT_OSS_VERSION):
38 raise ImportError(
37 - f"gpt_oss >= 0.0.3 is required, but {pkg_version} is installed."
39 + f"gpt_oss >= {MIN_GPT_OSS_VERSION} is required, "
40 + f"but {pkg_version} is installed."
41 ) from None
42
43