[Misc] fix: add miss best_of param validation (#18555)
Signed-off-by: googs1025 <googs1025@gmail.com>
This commit is contained in:
@ -389,6 +389,17 @@ class SamplingParams(
|
||||
f"type {type(self.n)}")
|
||||
if self.n < 1:
|
||||
raise ValueError(f"n must be at least 1, got {self.n}.")
|
||||
if self.best_of is not None:
|
||||
if not isinstance(self.best_of, int):
|
||||
raise ValueError(
|
||||
f"best_of must be an integer, got {type(self.best_of)}")
|
||||
if self.best_of < 1:
|
||||
raise ValueError(
|
||||
f"best_of must be at least 1, got {self.best_of}")
|
||||
if self.best_of < self.n:
|
||||
raise ValueError(
|
||||
f"best_of must be greater than or equal to n, "
|
||||
f"got n={self.n} and best_of={self.best_of}.")
|
||||
if not -2.0 <= self.presence_penalty <= 2.0:
|
||||
raise ValueError("presence_penalty must be in [-2, 2], got "
|
||||
f"{self.presence_penalty}.")
|
||||
|
Reference in New Issue
Block a user