File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
python/sglang/srt/openai_api Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -1099,7 +1099,7 @@ def v1_chat_generate_request(
1099
1099
1100
1100
sampling_params = {
1101
1101
"temperature" : request .temperature ,
1102
- "max_new_tokens" : request .max_tokens ,
1102
+ "max_new_tokens" : request .max_tokens or request . max_completion_tokens ,
1103
1103
"min_new_tokens" : request .min_tokens ,
1104
1104
"stop" : stop ,
1105
1105
"stop_token_ids" : request .stop_token_ids ,
Original file line number Diff line number Diff line change @@ -320,7 +320,16 @@ class ChatCompletionRequest(BaseModel):
320
320
logit_bias : Optional [Dict [str , float ]] = None
321
321
logprobs : bool = False
322
322
top_logprobs : Optional [int ] = None
323
- max_tokens : Optional [int ] = None
323
+ max_tokens : Optional [int ] = Field (
324
+ default = None ,
325
+ deprecated = "max_tokens is deprecated in favor of the max_completion_tokens field" ,
326
+ description = "The maximum number of tokens that can be generated in the chat completion. " ,
327
+ )
328
+ max_completion_tokens : Optional [int ] = Field (
329
+ default = None ,
330
+ description = "The maximum number of completion tokens for a chat completion request, "
331
+ "including visible output tokens and reasoning tokens. Input tokens are not included. " ,
332
+ )
324
333
n : int = 1
325
334
presence_penalty : float = 0.0
326
335
response_format : Optional [Union [ResponseFormat , StructuralTagResponseFormat ]] = None
You can’t perform that action at this time.
0 commit comments