From d573aeadcc891976f09d6d50f1a4f98c8ff809aa Mon Sep 17 00:00:00 2001 From: Michael Goin Date: Fri, 20 Dec 2024 14:03:50 -0500 Subject: [PATCH] [Bugfix] Don't log OpenAI field aliases as ignored (#11378) Signed-off-by: mgoin --- vllm/entrypoints/openai/protocol.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/vllm/entrypoints/openai/protocol.py b/vllm/entrypoints/openai/protocol.py index 1314de714215e..1d8b0d19f9516 100644 --- a/vllm/entrypoints/openai/protocol.py +++ b/vllm/entrypoints/openai/protocol.py @@ -46,7 +46,15 @@ class OpenAIBaseModel(BaseModel): @classmethod def __log_extra_fields__(cls, data): if isinstance(data, dict): - extra_fields = data.keys() - cls.model_fields.keys() + # Get all class field names and their potential aliases + field_names = set() + for field_name, field in cls.model_fields.items(): + field_names.add(field_name) + if hasattr(field, 'alias') and field.alias: + field_names.add(field.alias) + + # Compare against both field names and aliases + extra_fields = data.keys() - field_names if extra_fields: logger.warning( "The following fields were present in the request "