mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 19:24:27 +00:00
fix(utils.py): fix get for dict
This commit is contained in:
parent
a0daac212d
commit
9dc972de70
1 changed files with 7 additions and 4 deletions
|
@ -2189,7 +2189,7 @@ def client(original_function):
|
||||||
|
|
||||||
# CHECK MAX TOKENS
|
# CHECK MAX TOKENS
|
||||||
if (
|
if (
|
||||||
kwargs("max_tokens", None) is not None
|
kwargs.get("max_tokens", None) is not None
|
||||||
and model is not None
|
and model is not None
|
||||||
and litellm.drop_params
|
and litellm.drop_params
|
||||||
== True # user is okay with params being modified
|
== True # user is okay with params being modified
|
||||||
|
@ -2205,9 +2205,12 @@ def client(original_function):
|
||||||
if user_max_tokens > max_output_tokens:
|
if user_max_tokens > max_output_tokens:
|
||||||
user_max_tokens = max_output_tokens
|
user_max_tokens = max_output_tokens
|
||||||
## Scenario 2: User limit + prompt > model limit
|
## Scenario 2: User limit + prompt > model limit
|
||||||
input_tokens = token_counter(
|
messages = None
|
||||||
model=model, messages=kwargs.get("messages")
|
if len(args) > 1:
|
||||||
)
|
messages = args[1]
|
||||||
|
elif kwargs.get("messages", None):
|
||||||
|
messages = kwargs["messages"]
|
||||||
|
input_tokens = token_counter(model=model, messages=messages)
|
||||||
if input_tokens > max_output_tokens:
|
if input_tokens > max_output_tokens:
|
||||||
pass # allow call to fail normally
|
pass # allow call to fail normally
|
||||||
elif user_max_tokens + input_tokens > max_output_tokens:
|
elif user_max_tokens + input_tokens > max_output_tokens:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue