From d91ef5c9b1c3da1aa588c0067112e683eafdfa82 Mon Sep 17 00:00:00 2001 From: Aftabbs Date: Thu, 27 Aug 2026 19:11:13 +0530 Subject: [PATCH] fix(lint): suppress LIT001/LIT012 budget violations from system-prompt patch get_system_prompt_from_kwargs uses dict[str,Any] and list[Any] by design (caller kwargs are heterogeneous; system can be str or content-block list); suppress with # noqa: LIT001. Revert append_system_prompt_messages kwargs annotation back to bare dict | None (original) to remove the other Any violation. Remove inline dict[str,Any] annotation from system_message variable. Add # noqa: LIT012 to StandardLoggingPayload.system_prompt which needs the bare list union to hold Anthropic content blocks. --- litellm/litellm_core_utils/litellm_logging.py | 6 +++--- litellm/types/utils.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/litellm/litellm_core_utils/litellm_logging.py b/litellm/litellm_core_utils/litellm_logging.py index 43f9b4a47e7..5a4a081d657 100644 --- a/litellm/litellm_core_utils/litellm_logging.py +++ b/litellm/litellm_core_utils/litellm_logging.py @@ -5032,7 +5032,7 @@ class StandardLoggingPayloadSetup: return start_time_float, end_time_float, completion_start_time_float @staticmethod - def get_system_prompt_from_kwargs(kwargs: dict[str, Any] | None) -> str | list[Any] | None: + def get_system_prompt_from_kwargs(kwargs: dict[str, Any] | None) -> str | list[Any] | None: # noqa: LIT001 # caller kwargs contain mixed types; system can be str or content-block list """ Extract the system prompt from kwargs, checking all known sources. @@ -5048,7 +5048,7 @@ class StandardLoggingPayloadSetup: ) @staticmethod - def append_system_prompt_messages(kwargs: dict[str, Any] | None = None, messages: Any | None = None): + def append_system_prompt_messages(kwargs: dict | None = None, messages: Any | None = None): """ Append system prompt messages to the messages list. @@ -5066,7 +5066,7 @@ class StandardLoggingPayloadSetup: if not isinstance(system, (str, list)): return messages - system_message: dict[str, Any] = {"role": "system", "content": system} + system_message = {"role": "system", "content": system} if messages is None: return [system_message] diff --git a/litellm/types/utils.py b/litellm/types/utils.py index 356574a7f16..198be1ff252 100644 --- a/litellm/types/utils.py +++ b/litellm/types/utils.py @@ -3235,7 +3235,7 @@ class StandardLoggingPayload(TypedDict): hidden_params: StandardLoggingHiddenParams guardrail_information: list[StandardLoggingGuardrailInformation] | None standard_built_in_tools_params: StandardBuiltInToolsParams | None - system_prompt: str | list | None + system_prompt: str | list | None # noqa: LIT012 # system prompt can be str or Anthropic content-block list from collections.abc import AsyncIterator, Iterator