Skip to content

Commit 14d5574

Browse files
committed
fix oai protocol
Signed-off-by: Pengyun Lin <[email protected]>
1 parent 2e230b7 commit 14d5574

File tree

1 file changed

+4
-23
lines changed

1 file changed

+4
-23
lines changed

tensorrt_llm/serve/openai_protocol.py

+4-23
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ def to_sampling_params(self) -> SamplingParams:
187187
sampling_params = SamplingParams(
188188
best_of=self.best_of,
189189
frequency_penalty=self.frequency_penalty,
190-
return_log_probs=self.logprobs,
190+
return_log_probs=False,
191191
max_tokens=self.max_tokens,
192192
n=self.n,
193193
presence_penalty=self.presence_penalty,
@@ -232,9 +232,8 @@ def check_beam_search(self):
232232
@model_validator(mode="before")
233233
@classmethod
234234
def check_logprobs(cls, data):
235-
if ("top_logprobs" in data and data.get("top_logprobs")) or \
236-
("logprobs" in data and data.get("logprobs")):
237-
raise ValueError("returning log probs is not supported")
235+
if data.get("logprobs"):
236+
raise ValueError("logprobs is not supported")
238237
return data
239238

240239
@model_validator(mode="before")
@@ -268,15 +267,6 @@ def check_suffix(cls, data):
268267
raise ValueError("suffix is not supported")
269268
return data
270269

271-
@model_validator(mode="before")
272-
@classmethod
273-
def check_special_tokens(cls, data):
274-
if data.get("skip_special_tokens") or data.get("add_special_tokens") or \
275-
data.get("spaces_between_special_tokens"):
276-
raise ValueError(
277-
"special_tokens related settings are not supported")
278-
return data
279-
280270

281271
class FunctionCall(OpenAIBaseModel):
282272
name: str
@@ -421,7 +411,7 @@ class ChatCompletionRequest(OpenAIBaseModel):
421411
stop: Optional[Union[str, List[str]]] = Field(default_factory=list)
422412
stream: Optional[bool] = False
423413
stream_options: Optional[StreamOptions] = None
424-
temperature: Optional[float] = 0.7
414+
temperature: Optional[float] = 1.0
425415
top_p: Optional[float] = 1.0
426416
tools: Optional[List[ChatCompletionToolsParam]] = None
427417
tool_choice: Optional[Union[Literal["none"],
@@ -600,15 +590,6 @@ def check_suffix(cls, data):
600590
raise ValueError("suffix is not supported")
601591
return data
602592

603-
@model_validator(mode="before")
604-
@classmethod
605-
def check_special_tokens(cls, data):
606-
if data.get("skip_special_tokens") or data.get("add_special_tokens") or \
607-
data.get("spaces_between_special_tokens"):
608-
raise ValueError(
609-
"special_tokens related settings are not supported")
610-
return data
611-
612593

613594
def encode_opaque_state(opaque_state: Optional[bytes]) -> Optional[str]:
614595
if opaque_state is None:

0 commit comments

Comments
 (0)