Unverified Commit d054da19 authored by CYJiang's avatar CYJiang Committed by GitHub
Browse files

[Misc] fix: add miss best_of param validation (#18555)


Signed-off-by: default avatargoogs1025 <googs1025@gmail.com>
parent 4b7817c1
......@@ -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}.")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment