Skip to content
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

Fix the pydantic logging validator #12420

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
10 changes: 5 additions & 5 deletions vllm/entrypoints/openai/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ class OpenAIBaseModel(BaseModel):
# Cache class field names
field_names: ClassVar[Optional[Set[str]]] = None

@model_validator(mode="before")
@model_validator(mode="wrap")
@classmethod
def __log_extra_fields__(cls, data):

def __log_extra_fields__(cls, data, handler):
result = handler(data)
field_names = cls.field_names
if field_names is None:
if not isinstance(data, dict):
return data
return result
# Get all class field names and their potential aliases
field_names = set()
for field_name, field in cls.model_fields.items():
Expand All @@ -67,7 +67,7 @@ def __log_extra_fields__(cls, data):
"The following fields were present in the request "
"but ignored: %s",
data.keys() - field_names)
return data
return result


class ErrorResponse(OpenAIBaseModel):
Expand Down
Loading