Treat null completion max_tokens like the default (#45491)
Signed-off-by: Andreas Karatzas <akaratza@amd.com>
This commit is contained in:
@@ -346,6 +346,14 @@ class CompletionRequest(OpenAIBaseModel):
|
||||
thinking_token_budget=self.thinking_token_budget,
|
||||
)
|
||||
|
||||
@model_validator(mode="before")
|
||||
@classmethod
|
||||
def normalize_null_max_tokens(cls, data):
|
||||
if isinstance(data, dict) and data.get("max_tokens") is None:
|
||||
data = data.copy()
|
||||
data["max_tokens"] = cls.model_fields["max_tokens"].default
|
||||
return data
|
||||
|
||||
@model_validator(mode="before")
|
||||
@classmethod
|
||||
def validate_response_format(cls, data):
|
||||
|
||||
Reference in New Issue
Block a user