Merge pull request #5219 from dhlidongming/fix-messages-length-check

Fix incorrect message length check in cost calculator
This commit is contained in:
Krish Dholakia 2024-08-17 14:01:59 -07:00 committed by GitHub
commit 1a3b686580
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -665,7 +665,7 @@ def completion_cost(
if custom_llm_provider is not None and custom_llm_provider == "vertex_ai":
# Calculate the prompt characters + response characters
if len("messages") > 0:
if len(messages) > 0:
prompt_string = litellm.utils.get_formatted_prompt(
data={"messages": messages}, call_type="completion"
)