Skip to content

Commit

Permalink
Merge pull request #729 from mc-marcocheng/router/empty_str
Browse files Browse the repository at this point in the history
Router.get_available_deployment: Handle empty input edge case
  • Loading branch information
krrishdholakia authored Oct 31, 2023
2 parents caa199d + 0a2cb95 commit 730fd28
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions litellm/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,10 @@ def get_available_deployment(self,
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:
Expand Down

0 comments on commit 730fd28

Please sign in to comment.