Litellm Backend (#502)

This commit is contained in:
胡译文
2024-06-08 03:24:28 +08:00
committed by GitHub
parent 651a23ee7c
commit 87260b7bfd
5 changed files with 136 additions and 2 deletions

View File

@@ -81,6 +81,21 @@ class SglSamplingParams:
"top_p": self.top_p,
"top_k": self.top_k,
}
def to_litellm_kwargs(self):
if self.regex is not None:
warnings.warn(
"Regular expression is not supported in the LiteLLM backend."
)
return {
"max_tokens": self.max_new_tokens,
"stop": self.stop or None,
"temperature": self.temperature,
"top_p": self.top_p,
"top_k": self.top_k,
"frequency_penalty": self.frequency_penalty,
"presence_penalty": self.presence_penalty,
}
def to_srt_kwargs(self):
return {