@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / abd4030d94
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 15, 08:30 UTC

refactor: simplify request handler, use positive condition check for handler assignment (#18690)

Signed-off-by: googs1025 <googs1025@gmail.com>

CYJiang committed May 26, 2025 at 14:32 UTC abd4030d94206db4b0ea6c42640e2782ccd62532
1 file changed +6 -6
vllm/entrypoints/openai/run_batch.py
+6 -6
@@ -365,8 +365,8 @@ async def main(args):
365
366 # Determine the type of request and run it.
367 if request.url == "/v1/chat/completions":
368 - chat_handler_fn = (None if openai_serving_chat is None else
369 - openai_serving_chat.create_chat_completion)
368 + chat_handler_fn = openai_serving_chat.create_chat_completion if \
369 + openai_serving_chat is not None else None
370 if chat_handler_fn is None:
371 response_futures.append(
372 make_async_error_request_output(
@@ -380,8 +380,8 @@ async def main(args):
380 run_request(chat_handler_fn, request, tracker))
381 tracker.submitted()
382 elif request.url == "/v1/embeddings":
383 - embed_handler_fn = (None if openai_serving_embedding is None else
384 - openai_serving_embedding.create_embedding)
383 + embed_handler_fn = openai_serving_embedding.create_embedding if \
384 + openai_serving_embedding is not None else None
385 if embed_handler_fn is None:
386 response_futures.append(
387 make_async_error_request_output(
@@ -394,8 +394,8 @@ async def main(args):
394 run_request(embed_handler_fn, request, tracker))
395 tracker.submitted()
396 elif request.url == "/v1/score":
397 - score_handler_fn = (None if openai_serving_scores is None else
398 - openai_serving_scores.create_score)
397 + score_handler_fn = openai_serving_scores.create_score if \
398 + openai_serving_scores is not None else None
399 if score_handler_fn is None:
400 response_futures.append(
401 make_async_error_request_output(