fix(utils.py): round max tokens to be int always

This commit is contained in:
Krrish Dholakia 2024-02-06 13:10:29 -08:00
parent b28de5e329
commit 22913945b0
2 changed files with 6 additions and 3 deletions

View file

@ -2348,7 +2348,9 @@ def client(original_function):
elif user_max_tokens + input_tokens > max_output_tokens:
user_max_tokens = max_output_tokens - input_tokens
print_verbose(f"user_max_tokens: {user_max_tokens}")
kwargs["max_tokens"] = user_max_tokens
kwargs["max_tokens"] = int(
round(user_max_tokens)
) # make sure max tokens is always an int
except Exception as e:
print_verbose(f"Error while checking max token limit: {str(e)}")
# MODEL CALL