From e1f53fcc8096500e7bb781f0de81e074226657c4 Mon Sep 17 00:00:00 2001 From: lidongming Date: Thu, 15 Aug 2024 16:59:38 +0800 Subject: [PATCH] Fix incorrect message length check in cost calculator --- litellm/cost_calculator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litellm/cost_calculator.py b/litellm/cost_calculator.py index 5545b8428..cd8af19f4 100644 --- a/litellm/cost_calculator.py +++ b/litellm/cost_calculator.py @@ -624,7 +624,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" )