Skip to content

Commit

Permalink
fix: only check for extra fields when deserializing payloads
Browse files Browse the repository at this point in the history
Signed-off-by: Guillaume Calmettes <[email protected]>
  • Loading branch information
gcalmettes committed Nov 20, 2024
1 parent 4e37017 commit a9deeef
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions vllm/entrypoints/openai/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,14 @@ class OpenAIBaseModel(BaseModel):

@model_validator(mode="before")
@classmethod
def __log_extra_fields__(cls, values):
extra_fields = values.keys() - cls.model_fields.keys()
if extra_fields:
logger.warning(
"The following fields were present in the request "
"but ignored: %s", extra_fields)
return values
def __log_extra_fields__(cls, data):
if isinstance(data, dict):
extra_fields = data.keys() - cls.model_fields.keys()
if extra_fields:
logger.warning(
"The following fields were present in the request "
"but ignored: %s", extra_fields)
return data


class ErrorResponse(OpenAIBaseModel):
Expand Down

0 comments on commit a9deeef

Please sign in to comment.