Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion vllm/entrypoints/openai/serving_classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ async def _preprocess(

except (ValueError, TypeError) as e:
logger.exception("Error in preprocessing prompt inputs")
return self.create_error_response(str(e))
return self.create_error_response(f"{e} {e.__cause__}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

While including e.__cause__ is a great improvement for error message clarity, it can be None. In that case, the current f-string would append the literal string " None" to the error message, which could be confusing for the end-user. To provide a cleaner error message, it's better to conditionally include the cause only when it exists.

Suggested change
return self.create_error_response(f"{e} {e.__cause__}")
return self.create_error_response(f"{e}{f' {e.__cause__}' if e.__cause__ else ''}")


@override
def _build_response(
Expand Down
13 changes: 2 additions & 11 deletions vllm/entrypoints/openai/serving_completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,18 +127,9 @@ async def create_completion(
prompt_embeds=request.prompt_embeds,
config=self._build_render_config(request),
)
except ValueError as e:
logger.exception("Error in preprocessing prompt inputs")
return self.create_error_response(str(e))
except TypeError as e:
logger.exception("Error in preprocessing prompt inputs")
return self.create_error_response(str(e))
except RuntimeError as e:
logger.exception("Error in preprocessing prompt inputs")
return self.create_error_response(str(e))
except jinja2.TemplateError as e:
except (ValueError, TypeError, RuntimeError, jinja2.TemplateError) as e:
logger.exception("Error in preprocessing prompt inputs")
return self.create_error_response(str(e))
return self.create_error_response(f"{e} {e.__cause__}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

While including e.__cause__ is a great improvement for error message clarity, it can be None. In that case, the current f-string would append the literal string " None" to the error message, which could be confusing for the end-user. To provide a cleaner error message, it's better to conditionally include the cause only when it exists.

Suggested change
return self.create_error_response(f"{e} {e.__cause__}")
return self.create_error_response(f"{e}{f' {e.__cause__}' if e.__cause__ else ''}")


# Schedule the request and get the result generator.
generators: list[AsyncGenerator[RequestOutput, None]] = []
Expand Down
2 changes: 1 addition & 1 deletion vllm/entrypoints/openai/serving_embedding.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ async def _preprocess(
return None
except (ValueError, TypeError) as e:
logger.exception("Error in preprocessing prompt inputs")
return self.create_error_response(str(e))
return self.create_error_response(f"{e} {e.__cause__}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

While including e.__cause__ is a great improvement for error message clarity, it can be None. In that case, the current f-string would append the literal string " None" to the error message, which could be confusing for the end-user. To provide a cleaner error message, it's better to conditionally include the cause only when it exists.

Suggested change
return self.create_error_response(f"{e} {e.__cause__}")
return self.create_error_response(f"{e}{f' {e.__cause__}' if e.__cause__ else ''}")


def _build_render_config(self, request: EmbeddingCompletionRequest) -> RenderConfig:
# Set max_length based on chunked processing capability
Expand Down
2 changes: 1 addition & 1 deletion vllm/entrypoints/openai/serving_pooling.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ async def create_pooling(
raise ValueError(f"Unsupported request of type {type(request)}")
except (ValueError, TypeError, jinja2.TemplateError) as e:
logger.exception("Error in preprocessing prompt inputs")
return self.create_error_response(str(e))
return self.create_error_response(f"{e} {e.__cause__}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

While including e.__cause__ is a great improvement for error message clarity, it can be None. In that case, the current f-string would append the literal string " None" to the error message, which could be confusing for the end-user. To provide a cleaner error message, it's better to conditionally include the cause only when it exists.

Suggested change
return self.create_error_response(f"{e} {e.__cause__}")
return self.create_error_response(f"{e}{f' {e.__cause__}' if e.__cause__ else ''}")


# Schedule the request and get the result generator.
generators: list[AsyncGenerator[PoolingRequestOutput, None]] = []
Expand Down
2 changes: 1 addition & 1 deletion vllm/entrypoints/openai/speech_to_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ async def _create_speech_to_text(

except ValueError as e:
logger.exception("Error in preprocessing prompt inputs")
return self.create_error_response(str(e))
return self.create_error_response(f"{e} {e.__cause__}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

While including e.__cause__ is a great improvement for error message clarity, it can be None. In that case, the current f-string would append the literal string " None" to the error message, which could be confusing for the end-user. To provide a cleaner error message, it's better to conditionally include the cause only when it exists.

Suggested change
return self.create_error_response(f"{e} {e.__cause__}")
return self.create_error_response(f"{e}{f' {e.__cause__}' if e.__cause__ else ''}")


list_result_generator: list[AsyncGenerator[RequestOutput, None]] | None = None
try:
Expand Down