Skip to content

vllm.benchmarks.lib.endpoint_request_func

The request function for API endpoints.

Classes:

Functions:

RequestFuncInput dataclass

The input for the request function.

RequestFuncOutput dataclass

The output of the request function including metrics.

StreamedResponseHandler

Handles streaming HTTP responses by accumulating chunks until complete messages are available.

Methods:

  • add_chunk –

    Add a chunk of bytes to the buffer and return any complete

add_chunk(chunk_bytes)

Add a chunk of bytes to the buffer and return any complete messages.

_extract_sse_data(message)

Extract the data payload of a single SSE message.

The Responses API stream labels every message with an event: line before its data: line, so the payload cannot be recovered by stripping a leading data: the way the Completions and Chat Completions streams allow.

Parameters:

  • message

    (str) –

    One complete SSE message, without its trailing blank line.

Returns:

  • str | None –

    The payload, with multi-line payloads joined by newlines as required

  • str | None –

    by the SSE spec, or None if the message carries no data: line.

async_request_openai_completions(request_func_input, session, pbar=None) async

The async request function for the OpenAI Completions API.

Parameters:

  • request_func_input

    (RequestFuncInput) –

    The input for the request function.

  • session

    (ClientSession) –

    The aiohttp session used to issue the request.

  • pbar

    (tqdm | None, default: None ) –

    The progress bar to display the progress.

Returns: