From d2160f155df93d26071048e004cb45a5b5064f5d Mon Sep 17 00:00:00 2001 From: dlowzzxx <210235699+dlowzzxx@users.noreply.github.com> Date: Wed, 14 Oct 2026 11:00:52 +0200 Subject: [PATCH] fix(token_counter): avoid new unknown type diagnostics Assisted-by: OpenAI Codex --- litellm/litellm_core_utils/token_counter.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/litellm/litellm_core_utils/token_counter.py b/litellm/litellm_core_utils/token_counter.py index 0ee36e0964e..3ba853bdeff 100644 --- a/litellm/litellm_core_utils/token_counter.py +++ b/litellm/litellm_core_utils/token_counter.py @@ -1112,9 +1112,8 @@ def _format_type(props, indent): return " | ".join([f'"{item}"' for item in props["enum"]]) return "string" elif type == "array": - items: Final = props.get("items") - if isinstance(items, dict): - return f"{_format_type(items, indent)}[]" + if "items" in props and isinstance(props["items"], dict): + return f"{_format_type(props['items'], indent)}[]" return "any[]" elif type == "object": return f"{{\n{_format_object_parameters(props, indent + 2)}\n}}"