From 698c46830be03f366edbd1c41d3f00c32471676e Mon Sep 17 00:00:00 2001 From: Shivam Rawat <161387515+shivamrawat1@users.noreply.github.com> Date: Sat, 21 Feb 2026 14:49:11 -0800 Subject: [PATCH] remove prompt from getting logged (#21831) --- litellm/litellm_core_utils/token_counter.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/litellm/litellm_core_utils/token_counter.py b/litellm/litellm_core_utils/token_counter.py index 6b9e51034c0..da357e51c22 100644 --- a/litellm/litellm_core_utils/token_counter.py +++ b/litellm/litellm_core_utils/token_counter.py @@ -726,10 +726,12 @@ def _count_content_list( if thinking_text: num_tokens += count_function(thinking_text) else: + content_type = ( + c.get("type", type(c).__name__) if isinstance(c, dict) else type(c).__name__ + ) raise ValueError( - f"Invalid content item type: {type(c).__name__}. " - f"Expected str or dict with 'type' field. " - f"Value: {c!r}" + f"Invalid content item type: {content_type}. " + f"Expected str or dict with 'type' field (text, image_url, tool_use, tool_result, thinking)." ) return num_tokens except Exception as e: