Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 26, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions vllm/entrypoints/openai/run_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,8 @@ async def main(args):

# Determine the type of request and run it.
if request.url == "/v1/chat/completions":
chat_handler_fn = (None if openai_serving_chat is None else
openai_serving_chat.create_chat_completion)
chat_handler_fn = openai_serving_chat.create_chat_completion if \
openai_serving_chat is not None else None
if chat_handler_fn is None:
response_futures.append(
make_async_error_request_output(
Expand All @@ -380,8 +380,8 @@ async def main(args):
run_request(chat_handler_fn, request, tracker))
tracker.submitted()
elif request.url == "/v1/embeddings":
embed_handler_fn = (None if openai_serving_embedding is None else
openai_serving_embedding.create_embedding)
embed_handler_fn = openai_serving_embedding.create_embedding if \
openai_serving_embedding is not None else None
if embed_handler_fn is None:
response_futures.append(
make_async_error_request_output(
Expand All @@ -394,8 +394,8 @@ async def main(args):
run_request(embed_handler_fn, request, tracker))
tracker.submitted()
elif request.url == "/v1/score":
score_handler_fn = (None if openai_serving_scores is None else
openai_serving_scores.create_score)
score_handler_fn = openai_serving_scores.create_score if \
openai_serving_scores is not None else None
if score_handler_fn is None:
response_futures.append(
make_async_error_request_output(
Expand Down