Skip to content
Merged
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
11 changes: 7 additions & 4 deletions vllm/entrypoints/openai/run_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
ScoreResponse,
)
from vllm.entrypoints.utils import create_error_response
from vllm.exceptions import VLLMValidationError
from vllm.logger import init_logger
from vllm.reasoning import ReasoningParserManager
from vllm.utils import random_uuid
Expand Down Expand Up @@ -86,9 +87,10 @@ class BatchTranscriptionRequest(TranscriptionRequest):
def validate_no_file(cls, data: Any):
"""Ensure file field is not provided in batch requests."""
if isinstance(data, dict) and "file" in data:
raise ValueError(
raise VLLMValidationError(
"The 'file' field is not supported in batch requests. "
"Use 'file_url' instead."
"Use 'file_url' instead.",
parameter="file",
)
return data

Expand Down Expand Up @@ -116,9 +118,10 @@ class BatchTranslationRequest(TranslationRequest):
def validate_no_file(cls, data: Any):
"""Ensure file field is not provided in batch requests."""
if isinstance(data, dict) and "file" in data:
raise ValueError(
raise VLLMValidationError(
"The 'file' field is not supported in batch requests. "
"Use 'file_url' instead."
"Use 'file_url' instead.",
parameter="file",
)
return data

Expand Down
5 changes: 3 additions & 2 deletions vllm/entrypoints/pooling/base/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
ChatTemplateContentFormatOption,
)
from vllm.entrypoints.openai.engine.protocol import OpenAIBaseModel
from vllm.exceptions import VLLMValidationError
from vllm.renderers import ChatParams, merge_kwargs
from vllm.utils import random_uuid
from vllm.utils.serial_utils import EmbedDType, EncodingFormat, Endianness
Expand Down Expand Up @@ -147,9 +148,9 @@ class ChatRequestMixin(OpenAIBaseModel):
@classmethod
def check_generation_prompt(cls, data):
if data.get("continue_final_message") and data.get("add_generation_prompt"):
raise ValueError(
raise VLLMValidationError(
"Cannot set both `continue_final_message` and "
"`add_generation_prompt` to True."
"`add_generation_prompt` to True.",
)
Comment on lines +151 to 154
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The validation error is raised when both continue_final_message and add_generation_prompt are True. However, the parameter argument for VLLMValidationError is set only to "continue_final_message". This can be misleading for API clients that use this field to highlight the source of the error, as the issue stems from the combination of two parameters. To avoid ambiguity, consider omitting the parameter argument for this validation check. This makes the structured error less specific but more accurate.

            raise VLLMValidationError(
                "Cannot set both `continue_final_message` and "
                "`add_generation_prompt` to True."
            )

return data

Expand Down
5 changes: 3 additions & 2 deletions vllm/entrypoints/serve/tokenize/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from vllm.entrypoints.openai.engine.protocol import (
OpenAIBaseModel,
)
from vllm.exceptions import VLLMValidationError
from vllm.renderers import ChatParams, TokenizeParams, merge_kwargs


Expand Down Expand Up @@ -120,9 +121,9 @@ class TokenizeChatRequest(OpenAIBaseModel):
@classmethod
def check_generation_prompt(cls, data):
if data.get("continue_final_message") and data.get("add_generation_prompt"):
raise ValueError(
raise VLLMValidationError(
"Cannot set both `continue_final_message` and "
"`add_generation_prompt` to True."
"`add_generation_prompt` to True.",
)
return data

Expand Down
Loading