text
stringlengths
14
100k
source
stringclasses
1 value
repo
stringclasses
810 values
language
stringclasses
13 values
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Unit tests for response_input_to_harmony. Covers every type branch in the function and verifies that each produced Harmony Message has the correct role, channel, recipient, content_type, author name, and text ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from unittest.mock import patch import pytest from openai.types.responses.response_function_tool_call import ResponseFunctionToolCall from openai.types.responses.response_function_tool_call_output_...
fim
vllm-project/vllm
python
<|fim_suffix|> text_config.format = ResponseFormatTextJSONSchemaConfig( type="json_schema", name="test", schema={"type": "object"}, ) request = ResponsesRequest( model="test-model", input="test input", structured_outputs=structu...
fim
vllm-project/vllm
python
<|fim_suffix|> for event in events if event.type == "response.function_call_arguments.done" ] assert [event.arguments for event in argument_done] == [tool_args] function_done = [ event for event in events if event.type == "response.output_...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import pytest import pytest_asyncio from openai import OpenAI from tests.utils import RemoteOpenAIServer from .conftest import validate_streaming_event_stack MODEL_NAME = "Qwen/Qwen3-8B" @pytest.fixture(scop...
fim
vllm-project/vllm
python
<|fim_suffix|>us_response_id=response1.id, ) _ = await response2 response3_result = await response3 print(response3_result) assert "John" in response3_result.output[-1].content[0].text assert "Mark" not in response3_result.output[-1].content[0].text <|fim_prefix|># SPDX-License-Identifier: Apac...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from vllm.entrypoints.openai.engine.protocol import ( DeltaFunctionCall, DeltaMessage, DeltaToolCall, ) from<|fim_suffix|> tool_call = processor.resolve_target_state(dm) if targe...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import json import openai import pytest from pydantic import BaseModel @pytest.mark.asyncio async def test_structured_output(client: openai.AsyncOpenAI): response = await client.responses.create( in...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyri<|fim_suffix|>eate, {"prompt": " ".join(["A"] * 10_000)}), ( lambda x: x.chat.completions.create, {"messages": [{"role": "user", "content": " ".join(["A"] * 10_000)}]}, ), ], ) async def test_...
fim
vllm-project/vllm
python
<|fim_suffix|>You are a helpful assistant."}, {"role": "user", "content": "What is the capital of France?" * 400}, ] stream = await client.chat.completions.create( model=MODEL_NAME, messages=messages, max_tokens=5, temperature=0.0, stream=True, stream_opti...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import json import pytest from vllm.entrypoints.openai.cli_args import make_arg_parser, validate_parsed_serve_args from vllm.entrypoints.openai.models.protocol import LoRAModulePath from vllm.utils.argparse_uti...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ Tests for DPSupervisor: unit tests and lifecycle integration tests. Lifecycle integration tests replace child vLLM servers with lightweight aiohttp "fake" servers controlled by the test, so the...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Roundtrip tests for multimodal serde used by the disagg generate endpoin<|fim_suffix|>": elem}) encoded = encode_mm_kwargs_item(item) decoded = decode_mm_kwargs_item(encoded) decoded_...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import asyncio import os import openai # use the official client for correctness check import pytest import pytest_asyncio from tests.utils import RemoteOpenAIServer from tests.v1.utils import check_request_bal...
fim
vllm-project/vllm
python
<|fim_suffix|>", "/v1/completions"): LONG_TIMEOUT_SECONDS, ("POST", "/v1/messages"): LONG_TIMEOUT_SECONDS, ("POST", "/inference/v1/generate"): LONG_TIMEOUT_SECONDS, }.get(key, DEFAULT_TIMEOUT_SECONDS) # No need to verify SSL certificate for localhost case.call_and_validate(verify=False, tim...
fim
vllm-project/vllm
python
<|fim_suffix|>rams.chat_template_kwargs["reasoning_effort"] == "high" <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Unit tests for reasoning_effort -> enable_thinking mapping. Models like Gemma4 require enable_thinking=True in chat_template_...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project impor<|fim_suffix|>HIDDEN_LAYERS assert topk == NUM_EXPERTS_PER_TOK assert (routed_experts >= 0).all() assert (routed_experts < NUM_LOCAL_EXPERTS).all() <|fim_middle|>t io i...
fim
vllm-project/vllm
python
<|fim_suffix|>ces[0].token_ids # Verify we collected some tokens and first chunk had prompt_token_ids assert len(streamed_prompt_token_ids) > 0 assert streamed_token_ids == streamed_logprob_token_ids @pytest.mark.asyncio async def test_chat_completion_with_emoji_and_token_ids(server): """...
fim
vllm-project/vllm
python
<|fim_suffix|>_NAME) # Check that the token representations are consistent between raw # tokens and top_logprobs # Slice off the first one, because there's no scoring associated # with BOS top_logprobs = completion.choices[0].logprobs.top_logprobs[1:] top_logprob_keys = [...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import json import subprocess import tempfile from unittest.mock import AsyncMock, MagicMock, patch import pytest from vllm.assets.audio import AudioAsset from vllm.entrypoints.openai.run_batch import ( Bat...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Unit tests for tool_calls Iterable → list materialisation. Regression tests for https://github.com/vllm-project/vllm/issues/34792. Setting VLLM_LOGGING_LEVEL=debug caused tool calling to break f...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import pytest from vllm.entrypoints.openai.chat_completion.protocol import ChatCompletionRequest from vllm.entrypoints.openai.responses.protocol import ResponsesRequest from vllm.parser.abstract_pa...
fim
vllm-project/vllm
python
<|fim_suffix|>emote_server: yield remote_server @pytest.mark.asyncio async def test_show_version(server: RemoteOpenAIServer): transport = httpx.HTTPTransport(uds=server.uds) client = httpx.Client(transport=transport) response = client.get(server.url_for("version")) response.raise_for_statu...
fim
vllm-project/vllm
python
<|fim_suffix|>) usage = UsageInfo( prompt_tokens=0, completion_tokens=0, total_tokens=0, ) response = ChatCompletionResponse( id=response_id or "chatcmpl-test", object="chat.completion", created=created or 0, model=model or "test-model", choic...
fim
vllm-project/vllm
python
<|fim_suffix|>ooling_params=single_pooling_params, pooling_task="embed" ) assert len(PROMPTS) == len(outputs) # pooling_params is None, default params should be applied outputs = llm.encode(PROMPTS, pooling_params=None, pooling_task="embed") assert len(PROMPTS) == len(outputs) def test_right_side...
fim
vllm-project/vllm
python
<|fim_suffix|> Any] = { "model": MODEL_NAME, "input": input, "truncate_prompt_tokens": truncation_size, } response = await client.post(path="embeddings", cast_to=object, body={**kwargs}) assert response["usage"]["prompt_tokens"] == max_model_len <|fim_prefix|># SPDX-License-Identif...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import weakref import pytest import torch from tests.models.utils import softmax from vllm import LLM, ClassificationRequestOutput, PoolingParams from vllm.distributed import cleanup_dist_env_and_m...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import pytest import requests import torch import torch.nn.functional as F from tests.utils import RemoteOpenAIServer from vllm.entrypoints.pooling.classify.protocol import ClassificationResponse f...
fim
vllm-project/vllm
python
<|fim_suffix|> "role": "user", "content": [ {"type": "text", "text": "Please classify this image."}, {"type": "image_url", "image_url": image_base64}, ], } ] response = requests.post( server.url_for("classify"), json={"model": ...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Pytest configuration for vLLM pooling embed tests.""" import warnings import torch from vllm.platforms import current_platform def pytest_collection_modifyitems(config, items): """Configure ROCm-specif...
fim
vllm-project/vllm
python
<|fim_suffix|>], "truncate": "NONE", } resp = _cohere_embed_raw(server, body) assert resp.status_code == 400 def test_truncate_start_vs_end_differ(server: RemoteOpenAIServer, model_name: str): """START and END truncation should produce different embeddings when the input is long enough to ...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Tests for the Cohere /v2/embed API with a multimodal model (SigLIP). Validates image embedding, batching, normalisation, and embedding type conversions through the /v2/embed endpoint. """ import struct import...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Parity test between Cohere /v2/embed and OpenAI /v1/embeddings. Verifies that both endpoints produce identical float embeddings when no prompt prefix is applied (input_type omitted for Cohere /v2/embed). """ ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import os import pytest from tests.models.language.pooling_mteb_test.mteb_embed_utils import ( MTEB_EMBED_TASKS, MTEB_EMBED_TOL, OpenAIClientMtebEncoder, run_mteb_embed_task, ) from...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Unit tests for EmbedIOProcessor.""" import pytest from vllm import PoolingParams from vllm.entrypoints.pooling.embed.io_processor import EmbedIOProcessor from vllm.entrypoints.pooling.embed.prot...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import weakref import pytest import torch import torch.nn.functional as F from vllm import LLM, EmbeddingRequestOutput, PoolingParams from vllm.distributed import cleanup_dist_env_and_memory from vllm.platforms ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import json import numpy as np import openai import pybase64 as base64 import pytest import pytest_asyncio import requests import torch import torch.nn.functional as F from tests.models.language.p...
fim
vllm-project/vllm
python
<|fim_suffix|>-hf_overrides", '{"matryoshka_dimensions":[256]}'] ) # ROCm: Use Flex Attention to support encoder-only self-attention. if current_platform.is_rocm(): args.extend(["--attention-backend", "FLEX_ATTENTION"]) with RemoteOpenAIServer(model_info.name, args) as remote_server: ...
fim
vllm-project/vllm
python
<|fim_suffix|>gs.usage.total_tokens == embeddings.usage.prompt_tokens # 验证embedding向量的有效性 embedding_vector = embeddings.data[0].embedding assert all(isinstance(x, float) for x in embedding_vector) assert not all(x == 0 for x in embedding_vector) @pytest.mark.asyncio @pytest.mark.parametrize("model_na...
fim
vllm-project/vllm
python
<|fim_suffix|>e_url": {"url": image_url}}, ], } ] response = requests.post( server.url_for("v1/embeddings"), json={"model": model_name, "messages": messages}, ) response.raise_for_status() output = EmbeddingResponse.model_validate(response.json()) assert len...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Unit tests for Cohere embed protocol: build_typed_embeddings and its underlying packin<|fim_suffix|> embs = [[0.1, 0.2, 0.3]] result = build_typed_embeddings(embs, ["base64"]) ...
fim
vllm-project/vllm
python
<|fim_suffix|> "w_activation should be close to activation(wo_activation)." ) <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import weakref import pytest import torch from tests.models.utils import softmax from vllm import LLM, Pooling...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import json import numpy as np import pybase64 as base64 import pytest import requests import torch from tests.models.utils import check_embeddings_close from tests.utils import RemoteOpenAIServer...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import weakref import pytest from tests.entrypoints.pooling.scoring.util import EncoderScoringHfRunner from vllm import LLM from vllm.distributed import cleanup_dist_env_and_memory from vllm.platf...
fim
vllm-project/vllm
python
<|fim_suffix|>e.json()) assert score.id is not None assert score.data is not None assert len(score.data) == 1 vllm_outputs = [d.score for d in score.data] hf_outputs = hf_model.predict([[TEXTS_1[0], TEXTS_2[0]]]).tolist() for i in range(len(vllm_outputs)): assert hf_outputs[i] == pyte...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import os import pytest from tests.models.language.pooling_mteb_test.mteb_score_utils import ( MTEB_RERANK_LANGS, MTEB_RERANK_TASKS, MTEB_RERANK_TOL, RerankClientMtebEncoder, Sc...
fim
vllm-project/vllm
python
<|fim_suffix|>core for x in outputs]) default = get_outputs(use_activation=None) w_activation = get_outputs(use_activation=True) wo_activation = get_outputs(use_activation=False) assert torch.allclose(default, w_activation, atol=1e-2), ( "Default should use activation." ) assert not to...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import pytest import requests import torch import torch.nn.functional as F from tests.utils import RemoteOpenAIServer from vllm.entrypoints.pooling.pooling.protocol import PoolingResponse from vllm...
fim
vllm-project/vllm
python
<|fim_suffix|>() default_score = ScoreResponse.model_validate(default_response.json()) instruction_response = requests.post( remote_server.url_for("score"), json={ "model": MODEL_NAME, "queries": query, "documents": document, "instruction": INSTRU...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import weakref import pytest from vllm import LLM from vllm.distributed import cleanup_dist_env_and_memory from vllm.platforms import current_platform from .util import ColBERTScoringHfRunner MO...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import weakref import pytest from vllm import LLM from vllm.distributed import cleanup_dist_env_and_memory from vllm.platforms import current_platform from .util import make_base64_image, make_im...
fim
vllm-project/vllm
python
<|fim_suffix|>erver): """Test ColBERT token_embed task via pooling endpoint.""" text = "What is the capital of France?" pooling_response = requests.post( server.url_for("pooling"), json={ "model": MODEL_NAME, "input": text, "task": "token_embed", ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import pytest import requests from tests.entrypoints.pooling.scoring.util import ( make_base64_image, make_image_mm_param, ) from tests.utils import RemoteOpenAIServer from vllm.entrypoints...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from io import BytesIO import pybase64 as base64 import torch import torch.nn.functional as F from huggingface_hub import hf_hub_download from PIL import Image from safetensors.torch import load_fi...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import importlib import importlib.util import json import warnings from types import SimpleNamespace import numpy as np import pytest import torch from vllm.entrypoints.pooling.utils import encode...
fim
vllm-project/vllm
python
<|fim_suffix|>gin installed." elif task == "classify": err_msg = "Try switching the model's pooling_task via.+" else: err_msg = "Embedding API is not supported by this model.+" with pytest.raises(ValueError, match=err_msg): llm.encode(prompt, pooling_task=task, use_tqdm=False) <|fim...
fim
vllm-project/vllm
python
<|fim_suffix|>sg = f"Unsupported task: {task!r}" assert response.json()["error"]["message"].startswith(err_msg) <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import pytest import requests from tests.utils import RemoteOpenAIServer from vll...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import weakref import pytest from vllm import LLM, PoolingRequestOutput from vllm.config import PoolerConfig from vllm.distributed import cleanup_dist_env_and_memory from vllm.platforms import curr...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import p<|fim_suffix|>r): task = "token_embed" response = requests.post( server.url_for("pooling"), json={ "model": model_name, "input": input_text, ...
fim
vllm-project/vllm
python
<|fim_suffix|>turn anything""" return @pytest.fixture(scope="module") def server(): args = [ "--max-model-len", "8192", "--max-num-seqs", "128", "--worker-extension-cls", "tests.entrypoints.serve.dev.rpc.test_collective_rpc.TestWorkerExtension", ] wi...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import requests from prometheus_client.parser import text_string_to_metric_families from tests.utils import RemoteOpenAIServer MODEL_NAME = "meta-llama/Llama-3.2-1B" def test_sleep_mode(): #...
fim
vllm-project/vllm
python
<|fim_suffix|>nd(chunk) assert any("Internal server error" in chunk for chunk in chunks), ( f"Expected error message in chunks: {chunks}" ) assert chunks[-1] == "data: [DONE]\n\n" @pytest.mark.asyncio async def test_stream_skips_empty_token_output(): """Outputs with empty token_ids are skippe...
fim
vllm-project/vllm
python
<|fim_suffix|>vided(): """Even when the client picks the same value as the dataclass default, it must register as explicitly set so the server won't override it.""" payload = _base_payload() payload["sampling_params"] = {"max_tokens": 16} req = GenerateRequest.model_validate(payload) assert req....
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import io import httpx import numpy as np import pybase64 as base64 import pytest import pytest_asyncio from tests.utils import RemoteOpenAIServer MODEL_NAME = "TitanML/tiny-mixtral" GEN_ENDPOINT...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Tests for multimodal features through the /inference/v1/generate endpoint. Mirrors test_serving_tokens.py but exercises the multimodal piping using Qwen/Qwen3-VL-2B-Instruct end-to-end via the server's /render...
fim
vllm-project/vllm
python
<|fim_suffix|>gs": dict(enable_thinking=False), } completions_resp = await client.post("/v1/chat/completions", json=payload) completions_data = completions_resp.json() completions_res = completions_data["choices"][0]["message"]["content"] assert generate_res == completions_res @pytest.mark.asyncio...
fim
vllm-project/vllm
python
<|fim_suffix|>)}], num_output_top_logprobs=0, ) assert len(result.content[0].top_logprobs) == 1 <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from vllm.entrypoints.serve.disagg.serving import ServingTokens from vllm.logprobs imp...
fim
vllm-project/vllm
python
<|fim_suffix|>Assert that it returns 503 Service Unavailable assert response.status_code == 503 <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import asyncio from http import HTTPStatus from unittest.mock import AsyncMock, Mock import opena...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import asyncio import subprocess import sys import tempfile import time from http import HTTPStatus import openai import pytest import pytest_asyncio import requests from prometheus_client.parser im...
fim
vllm-project/vllm
python
<|fim_suffix|> that # don't start with /v1 or /v2 (e.g. /health, /metrics). response = requests.get(server.url_for("health")) assert response.status_code == HTTPStatus.OK # --------------------------------------------------------------------------- # /v2 path authentication tests # -----------------------...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import openai import pytest import pytest_asyncio from tests.utils import RemoteOpenAIServer # any model with a chat template should work here MODEL_NAME = "Qwen/Qwen3-0.6B" @pytest.fixture(scope="module") de...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import asyncio import json import shutil from contextlib import suppress import openai # use the official client for correctness check import pytest import pytest_asyncio from tests.utils import ...
fim
vllm-project/vllm
python
<|fim_suffix|>ePoolingServing(PoolingServingBase): """Minimal concrete subclass used only in these unit tests.""" request_id_prefix = "test" def get_io_processor(self, request): raise NotImplementedError def _build_response(self, ctx): raise NotImplementedError def _make_pooling_ser...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Tests for the /derender endpoints (postprocessing counterpart to /render).""" import h<|fim_suffix|>req = await _render_chat(client) synthetic_ids = gen_req["token_ids"][:3] response = ...
fim
vllm-project/vllm
python
<|fim_suffix|>lapsed < 2.0 # -- Health & Models -- @pytest.mark.asyncio async def test_health_endpoint(client): response = await client.get("/health") assert response.status_code == 200 @pytest.mark.asyncio async def test_models_endpoint(client): response = await client.get("/v1/models") assert re...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Tests for the /render endpoints that expose prompt preprocessing.""" import httpx import pytest import pytest_asyncio from tests.utils import RemoteLaunchRenderServer MODEL_NAME = "hmellor/tin...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Multimodal tests for the /render endpoints that expose prompt preprocessing.""" import httpx import pytest import pytest_asyncio from tests.utils import RemoteOpenAIServer from vllm.multimodal.utils import e...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Shared fixtures and utilities for SageMaker tests.""" import pytest import pytest_asyncio from tests.utils import RemoteOpenAIServer # Model name constants used across tests MODEL_NAME_SMOLLM ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Integration tests for handler override functionality. Tests real customer usage scenarios: - Using @custom_ping_handler and @custom_invocation_handler decorators to override handlers - Setting...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import openai # use the official async_client for correctness check import pytest import requests from tests.utils import RemoteOpenAIServer from .conftest import MODEL_NAME_SMOLLM @pytest.mark....
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Integration test for middleware loader functionality. Tests that customer middlewares get called correctly with a vLLM server. """ import os import tempfile import pytest import requests from...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-I<|fim_suffix|>t import openai # use the official client for correctness check import pytest import requests from tests.utils import RemoteOpenAIServer from .conftest import ( HEADER_SAGEMAKER_CLOSED_SESSION_ID, HEADER_SAGEMAKER_NEW_SESSION_ID, HEADER_SAGEMAKER_SESSION_ID, ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from dataclasses import dataclass, field from typing import Any from unittest.mock import AsyncMock, MagicMock import pytest from vllm.config.multimodal import MultiModalConfig from vllm.entrypoin...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import pytest import pytest_asyncio import requests from tests.utils import RemoteOpenAIServer from vllm.tokenizers import get_tokenizer # any model with a chat template should work here MODEL_NAM...
fim
vllm-project/vllm
python
<|fim_suffix|>ssion test: ``/tokenize`` must expand image placeholders for VLM models. Fixed by PR #34560 ("Move InputPreprocessor into Renderer (2/2)"). Before that change, ``/tokenize`` returned ~26 tokens for a message with an image instead of the expected 1451. Confirmed broken on 0.15.1 and 0.16.0. """ import j...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ Regression test: calling ``/tokenize`` with multimodal data followed by ``/v1/chat/completions`` with the same data must not cause an error. Ensures that the ``/toke<|fim_suffix|> } ] ...
fim
vllm-project/vllm
python
<|fim_suffix|> result = get_max_tokens( max_model_len=24000, max_tokens=5000, input_length=100, default_sampling_params={"max_tokens": 2048}, ) assert result == 5000 def test_override_max_tokens_caps_request(self): """When user explicit...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copy<|fim_suffix|>ages in Anthropic and speech-to-text entrypoints are sanitized to prevent memory address leakage. Verifies the fix for the incomplete CVE-2026-22778 remediation where PIL repr addresses leaked via the Anthropic API router a...
fim
vllm-project/vllm
python
<|fim_suffix|>l == fp.get_system_fingerprint(cfg) fp.set_default_fingerprint_mode("hash") hashed = fp.get_system_fingerprint(cfg) assert hashed != full assert "tp8" not in hashed fp.set_default_fingerprint_mode("custom", "deploy-42") assert fp.get_system_fingerprint(cfg) == "deploy-42" fp...
fim
vllm-project/vllm
python
<|fim_suffix|>ger", mock_logger): request_logger = RequestLogger(max_log_len=5) # Test with empty output request_logger.log_outputs( request_id="test-empty", outputs="", output_token_ids=[], finish_reason="stop", is_streaming=False, ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import asyncio import tempfile from pathlib import Path from ssl import SSLContext import pytest from vllm.entrypoints.serve.utils.ssl import SSLCertRefresher class MockSSLContext(SSLContext): ...
fim
vllm-project/vllm
python
<|fim_suffix|>ath() with open(str(path), "rb") as f: yield f @pytest.fixture def foscolo(): # Test translation it->en path = AudioAsset("azacinto_foscolo").get_local_path() with open(str(path), "rb") as f: yield f <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyright...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ Evaluate Transcription API correctness by computing Word Error Rate (WER) on a given ASR dataset. When provided, it will also compare the WER against a baseline. This simulates real work usage of the API and m...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import asyncio import json import warnings import numpy as np import pybase64 as base64 import pytest import websockets from tests.entrypoints.speech_to_text.conftest import add_attention_backend ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import asyncio from types import SimpleNamespace from unittest.mock import AsyncM<|fim_suffix|>cted_request_ids ): engine_client = SimpleNamespace( errored=False, generate=Mock(s...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX<|fim_suffix|>bo", args) as remote_server: yield remote_server @pytest_asyncio.fixture async def transcription_client_with_force_include_usage( transcription_server_with_force_include_usage, ): async with ( transcription_server_with_for...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Unit tests for ``Qwen3ASR``'s user-text sanitizer. The sanitizer is the security boundary between user-supplied transcription fields (``prompt`` / ``response_prefix``) and the structured ChatML p...
fim
vllm-project/vllm
python
<|fim_suffix|> ], finished=True, ) def _sse_delta_contents(sse_body: str) -> list[str]: """Extract ``choices[0].delta.content`` from each ``data:`` line (streaming API).""" contents: list[str] = [] for line in sse_body.splitlines(): if not line.startswith("data: "): contin...
fim
vllm-project/vllm
python
<|fim_suffix|> had a little lamb", expected_seconds=16, ) @pytest.mark.asyncio async def test_basic_audio_with_lora(mary_had_lamb, rocm_aiter_fa_attention): """Ensure STT (transcribe) requests can pass LoRA through to generate.""" # ROCm SPECIFIC CONFIGURATION: # To ensure the test pas...
fim
vllm-project/vllm
python
<|fim_suffix|> that stream=True + beam search raises bad request for now.""" with pytest.raises(openai.BadRequestError): await whisper_client.audio.transcriptions.create( model=MODEL_NAME, file=winning_call, language="en", stream=True, extra_body=d...
fim
vllm-project/vllm
python