mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-04 02:31:27 +00:00
fix(snowflake): map max_tokens to max_completion_tokens for native endpoint
This commit is contained in:
parent
34f4c65909
commit
a7de06c337
1 changed files with 11 additions and 1 deletions
|
|
@ -55,6 +55,7 @@ class SnowflakeConfig(SnowflakeBaseConfig, OpenAIGPTConfig):
|
|||
return [
|
||||
"temperature",
|
||||
"max_tokens",
|
||||
"max_completion_tokens",
|
||||
"top_p",
|
||||
"stream",
|
||||
"response_format",
|
||||
|
|
@ -103,7 +104,11 @@ class SnowflakeConfig(SnowflakeBaseConfig, OpenAIGPTConfig):
|
|||
stream: bool = optional_params.pop("stream", False) or False
|
||||
extra_body = optional_params.pop("extra_body", {})
|
||||
|
||||
return {
|
||||
max_tokens = optional_params.pop("max_tokens", None)
|
||||
max_completion_tokens = optional_params.pop("max_completion_tokens", None)
|
||||
resolved_max = max_completion_tokens or max_tokens
|
||||
|
||||
body: dict = {
|
||||
"model": model,
|
||||
"messages": messages,
|
||||
"stream": stream,
|
||||
|
|
@ -111,6 +116,11 @@ class SnowflakeConfig(SnowflakeBaseConfig, OpenAIGPTConfig):
|
|||
**extra_body,
|
||||
}
|
||||
|
||||
if resolved_max is not None:
|
||||
body["max_completion_tokens"] = resolved_max
|
||||
|
||||
return body
|
||||
|
||||
def transform_response(
|
||||
self,
|
||||
model: str,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue