@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 9261dbbc55
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Treat null completion max_tokens like the default (#45491)

Signed-off-by: Andreas Karatzas <akaratza@amd.com>

Andreas Karatzas committed Jun 13, 2026 at 04:34 UTC 9261dbbc557b6bdd6b4f176a61e8008f2e99f3ed
1 file changed +8
vllm/entrypoints/openai/completion/protocol.py
+8
@@ -346,6 +346,14 @@ class CompletionRequest(OpenAIBaseModel):
346 thinking_token_budget=self.thinking_token_budget,
347 )
348
349 + @model_validator(mode="before")
350 + @classmethod
351 + def normalize_null_max_tokens(cls, data):
352 + if isinstance(data, dict) and data.get("max_tokens") is None:
353 + data = data.copy()
354 + data["max_tokens"] = cls.model_fields["max_tokens"].default
355 + return data
356 +
357 @model_validator(mode="before")
358 @classmethod
359 def validate_response_format(cls, data):