@@ -220,8 +220,8 @@ class CompletionRequest(OpenAIBaseModel):
220
220
stream : Optional [bool ] = False
221
221
stream_options : Optional [StreamOptions ] = None
222
222
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
225
225
user : Optional [str ] = None
226
226
lora_request : Optional [LoRARequest ] = None
227
227
@@ -275,8 +275,9 @@ def to_sampling_params(self, vocab_size: int = 32000) -> SamplingParams:
275
275
presence_penalty = self .presence_penalty ,
276
276
seed = self .seed ,
277
277
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 ),
280
281
281
282
# completion-sampling-params
282
283
use_beam_search = self .use_beam_search ,
@@ -510,8 +511,8 @@ class ChatCompletionRequest(OpenAIBaseModel):
510
511
stop : Optional [Union [str , List [str ]]] = Field (default_factory = list )
511
512
stream : Optional [bool ] = False
512
513
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
515
516
tools : Optional [List [ChatCompletionToolsParam ]] = None
516
517
tool_choice : Optional [Union [Literal ["none" , "auto" ],
517
518
ChatCompletionNamedToolChoiceParam ]] = "none"
@@ -614,13 +615,14 @@ def to_sampling_params(self,
614
615
presence_penalty = self .presence_penalty ,
615
616
seed = self .seed ,
616
617
stop = self .stop ,
617
- temperature = self .temperature ,
618
+ temperature = (self .temperature
619
+ if self .temperature is not None else 1.0 ),
618
620
619
621
# chat-completion-sampling-params
620
622
best_of = self .best_of ,
621
623
use_beam_search = self .use_beam_search ,
622
624
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 ) ,
624
626
top_p_min = self .top_p_min if self .top_p_min > 0 else None ,
625
627
min_p = self .min_p ,
626
628
repetition_penalty = self .repetition_penalty ,
0 commit comments