mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 11:14:04 +00:00
Handle empty input edge case
This commit is contained in:
parent
297bd67a45
commit
c7b6911c7b
1 changed files with 3 additions and 2 deletions
|
@ -162,9 +162,10 @@ class Router:
|
|||
current_tpm, current_rpm = self._get_deployment_usage(deployment_name=deployment["litellm_params"]["model"])
|
||||
|
||||
# get encoding
|
||||
if messages:
|
||||
token_count = 0
|
||||
if messages is not None:
|
||||
token_count = litellm.token_counter(model=deployment["model_name"], messages=messages)
|
||||
elif input:
|
||||
elif input is not None:
|
||||
if isinstance(input, List):
|
||||
input_text = "".join(text for text in input)
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue