[Frontend][last/N] Move all non-OpenAI content out of the OpenAI folder. (#56369)
Signed-off-by: wang.yuqi <yuqi.wang@daocloud.io>
wang.yuqi committed
Sep 11, 2026 at 13:33 UTC
fe4d4109c24063fb5e60ede9d48a1c0b3e9e4cea
5 files changed
+3
-85
tests/entrypoints/openai/test_async_tokenization.py
deleted
-82
@@ -1,82 +0,0 @@
1
-# SPDX-License-Identifier: Apache-2.0
2
-# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3
-
4
-import asyncio
5
-import random
6
-from collections.abc import Callable
7
-
8
-import openai
9
-import pytest
10
-import pytest_asyncio
11
-
12
-from tests.utils import RemoteOpenAIServer
13
-
14
-MODEL_NAME = "Qwen/Qwen2.5-1.5B-Instruct"
15
-
16
-
17
-@pytest.fixture(scope="module")
18
-def server():
19
- args = [
20
- # use half precision for speed and memory savings in CI environment
21
- "--dtype",
22
- "bfloat16",
23
- "--max-model-len",
24
- "8192",
25
- "--enforce-eager",
26
- "--max-num-seqs",
27
- "128",
28
- "--load-format",
29
- "dummy",
30
- ]
31
-
32
- with RemoteOpenAIServer(MODEL_NAME, args) as remote_server:
33
- yield remote_server
34
-
35
-
36
-@pytest_asyncio.fixture
37
-async def client(server):
38
- async with server.get_async_client() as async_client:
39
- yield async_client
40
-
41
-
42
-@pytest.mark.asyncio
43
-@pytest.mark.parametrize(
44
- ids=["completion", "chat"],
45
- argnames=["create_func_gen", "content_body"],
46
- argvalues=[
47
- (lambda x: x.completions.create, {"prompt": " ".join(["A"] * 10_000)}),
48
- (
49
- lambda x: x.chat.completions.create,
50
- {"messages": [{"role": "user", "content": " ".join(["A"] * 10_000)}]},
51
- ),
52
- ],
53
-)
54
-async def test_with_and_without_truncate(
55
- server: RemoteOpenAIServer,
56
- client: openai.AsyncOpenAI,
57
- create_func_gen: Callable,
58
- content_body: dict,
59
-):
60
- create_func = create_func_gen(client)
61
- body = {"model": MODEL_NAME, **content_body, "max_tokens": 10}
62
-
63
- num_requests = 10
64
- truncate_prompt_tokens = [1000] * (num_requests // 2) + [None] * (
65
- num_requests - num_requests // 2
66
- )
67
- random.shuffle(truncate_prompt_tokens)
68
-
69
- bodies = [
70
- {**body, "extra_body": {"truncate_prompt_tokens": t}}
71
- for t in truncate_prompt_tokens
72
- ]
73
-
74
- async def get_status_code(**kwargs):
75
- try:
76
- await create_func(**kwargs)
77
- return 200
78
- except openai.APIStatusError as e:
79
- return e.status_code
80
-
81
- responses = await asyncio.gather(*[get_status_code(**b) for b in bodies])
82
- assert 500 not in responses
tests/entrypoints/serve/utils/test_sse_keep_alive.py
renamed
+1
-1
@@ -6,7 +6,7 @@ import asyncio
6
import pytest
7
from starlette.responses import StreamingResponse
8
9
-from vllm.entrypoints.openai.sse_keep_alive import (
9
+from vllm.entrypoints.serve.utils.sse_keep_alive import (
10
SSE_KEEP_ALIVE_COMMENT,
11
with_sse_keep_alive,
12
)
vllm/entrypoints/openai/chat_completion/api_router.py
+1
-1
@@ -14,7 +14,6 @@ from vllm.entrypoints.openai.chat_completion.protocol import (
14
ChatCompletionResponse,
15
)
16
from vllm.entrypoints.openai.chat_completion.serving import OpenAIServingChat
17
-from vllm.entrypoints.openai.sse_keep_alive import with_sse_keep_alive
17
from vllm.entrypoints.serve.engine.protocol import ErrorResponse
18
from vllm.entrypoints.serve.utils.api_utils import (
19
load_aware_call,
@@ -22,6 +21,7 @@ from vllm.entrypoints.serve.utils.api_utils import (
21
with_cancellation,
22
)
23
from vllm.entrypoints.serve.utils.orca_metrics import metrics_header
24
+from vllm.entrypoints.serve.utils.sse_keep_alive import with_sse_keep_alive
25
from vllm.logger import init_logger
26
27
logger = init_logger(__name__)
vllm/entrypoints/openai/completion/api_router.py
+1
-1
@@ -12,7 +12,6 @@ from vllm.entrypoints.openai.completion.protocol import (
12
CompletionResponse,
13
)
14
from vllm.entrypoints.openai.completion.serving import OpenAIServingCompletion
15
-from vllm.entrypoints.openai.sse_keep_alive import with_sse_keep_alive
15
from vllm.entrypoints.serve.engine.protocol import ErrorResponse
16
from vllm.entrypoints.serve.utils.api_utils import (
17
load_aware_call,
@@ -20,6 +19,7 @@ from vllm.entrypoints.serve.utils.api_utils import (
19
with_cancellation,
20
)
21
from vllm.entrypoints.serve.utils.orca_metrics import metrics_header
22
+from vllm.entrypoints.serve.utils.sse_keep_alive import with_sse_keep_alive
23
from vllm.logger import init_logger
24
25
logger = init_logger(__name__)