From c91106b258ed6725b0359ca4d74578b511643bcd Mon Sep 17 00:00:00 2001 From: Christian-Sidak <61099993+Christian-Sidak@users.noreply.github.com> Date: Sun, 18 Oct 2026 20:07:17 -0700 Subject: [PATCH] fix(utils): explicitly type new_messages list to clear reportUnknownArgumentType The Final=[] annotation let basedpyright infer the list type from appended values, which introduced one new reportUnknownArgumentType error past the project ceiling. Using an explicit list[AllMessageValues] annotation and casting the cleanup return value makes the type explicit and removes the ambiguity. --- litellm/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/litellm/utils.py b/litellm/utils.py index fdefb5102bc..a70b58c2f52 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -8425,7 +8425,7 @@ def validate_and_fix_openai_messages(messages: list[Any]): Handles missing role for assistant messages. """ - new_messages: Final = [] + new_messages: list[AllMessageValues] = [] for message in messages: # Copy before mutating: assigning dicts into a pydantic Message's # tool_calls triggers PydanticSerializationUnexpectedValue warnings on @@ -8446,7 +8446,7 @@ def validate_and_fix_openai_messages(messages: list[Any]): ), ) cleaned_message = cleanup_none_field_in_message(message=convert_msg_to_dict) - new_messages.append(cleaned_message) + new_messages.append(cast(AllMessageValues, cleaned_message)) return validate_chat_completion_user_messages(messages=new_messages)