@@ -220,8 +220,8 @@ class CompletionRequest(OpenAIBaseModel):
220220 stream : Optional [bool ] = False
221221 stream_options : Optional [StreamOptions ] = None
222222 suffix : Optional [str ] = None
223- temperature : Optional [float ] = 1.0
224- top_p : Optional [float ] = 1.0
223+ temperature : Optional [float ] = None
224+ top_p : Optional [float ] = None
225225 user : Optional [str ] = None
226226 lora_request : Optional [LoRARequest ] = None
227227
@@ -275,8 +275,9 @@ def to_sampling_params(self, vocab_size: int = 32000) -> SamplingParams:
275275 presence_penalty = self .presence_penalty ,
276276 seed = self .seed ,
277277 stop = self .stop ,
278- temperature = self .temperature ,
279- top_p = self .top_p ,
278+ temperature = (self .temperature
279+ if self .temperature is not None else 1.0 ),
280+ top_p = (self .top_p if self .top_p is not None else 1.0 ),
280281
281282 # completion-sampling-params
282283 use_beam_search = self .use_beam_search ,
@@ -510,8 +511,8 @@ class ChatCompletionRequest(OpenAIBaseModel):
510511 stop : Optional [Union [str , List [str ]]] = Field (default_factory = list )
511512 stream : Optional [bool ] = False
512513 stream_options : Optional [StreamOptions ] = None
513- temperature : Optional [float ] = 1.0
514- top_p : Optional [float ] = 1.0
514+ temperature : Optional [float ] = None
515+ top_p : Optional [float ] = None
515516 tools : Optional [List [ChatCompletionToolsParam ]] = None
516517 tool_choice : Optional [Union [Literal ["none" , "auto" ],
517518 ChatCompletionNamedToolChoiceParam ]] = "none"
@@ -614,13 +615,14 @@ def to_sampling_params(self,
614615 presence_penalty = self .presence_penalty ,
615616 seed = self .seed ,
616617 stop = self .stop ,
617- temperature = self .temperature ,
618+ temperature = (self .temperature
619+ if self .temperature is not None else 1.0 ),
618620
619621 # chat-completion-sampling-params
620622 best_of = self .best_of ,
621623 use_beam_search = self .use_beam_search ,
622624 top_k = self .top_k ,
623- top_p = self .top_p ,
625+ top_p = ( self .top_p if self . top_p is not None else 1.0 ) ,
624626 top_p_min = self .top_p_min if self .top_p_min > 0 else None ,
625627 min_p = self .min_p ,
626628 repetition_penalty = self .repetition_penalty ,
0 commit comments