vllm.benchmarks.lib.endpoint_request_func
¶
The request function for API endpoints.
Classes:
-
RequestFuncInput–The input for the request function.
-
RequestFuncOutput–The output of the request function including metrics.
-
StreamedResponseHandler–Handles streaming HTTP responses by accumulating chunks until complete
Functions:
-
async_request_openai_completions–The async request function for the OpenAI Completions API.
RequestFuncInput
dataclass
¶
The input for the request function.
Source code in vllm/benchmarks/lib/endpoint_request_func.py
RequestFuncOutput
dataclass
¶
The output of the request function including metrics.
Source code in vllm/benchmarks/lib/endpoint_request_func.py
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
Source code in vllm/benchmarks/lib/endpoint_request_func.py
add_chunk(chunk_bytes)
¶
Add a chunk of bytes to the buffer and return any complete messages.
Source code in vllm/benchmarks/lib/endpoint_request_func.py
_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:
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.
Source code in vllm/benchmarks/lib/endpoint_request_func.py
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:
-
RequestFuncOutput–The output of the request function.
Source code in vllm/benchmarks/lib/endpoint_request_func.py
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 | |