mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-06 08:16:43 +00:00
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.
This commit is contained in:
parent
45f9c66d09
commit
d91ef5c9b1
2 changed files with 4 additions and 4 deletions
|
|
@ -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]
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue