mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-31 06:56:59 +00:00
style(passthrough): keep mutable-ok comments inside ruff's line budget
This commit is contained in:
parent
eaaa81e8d4
commit
2ed3241686
1 changed files with 11 additions and 7 deletions
|
|
@ -95,18 +95,22 @@ class OpenAILikeAnthropicMessagesConfig(AnthropicMessagesConfig):
|
|||
model the cost map does not know (see #40890). Pop them before the
|
||||
base transform so no drop warning fires, restore afterwards.
|
||||
"""
|
||||
params: Final[dict[str, object]] = anthropic_messages_optional_request_params # mutable-ok: popped below to detach the stashed keys
|
||||
params: Final[dict[str, object]] = (
|
||||
anthropic_messages_optional_request_params # mutable-ok: popped below to detach the stashed keys
|
||||
)
|
||||
stashed: Final[dict[str, object]] = {} # mutable-ok: filled key-by-key, then restored onto the request
|
||||
for _key in ("thinking", "output_config", "temperature"):
|
||||
if _key in params:
|
||||
stashed[_key] = params.pop(_key)
|
||||
# base returns an unparameterized dict; annotate at the boundary
|
||||
request: Final[dict[str, object]] = super().transform_anthropic_messages_request( # mutable-ok: base returns a dict the caller updates in place # pyright: ignore[reportUnknownMemberType] # base signature is unparameterized
|
||||
model=model,
|
||||
messages=messages,
|
||||
anthropic_messages_optional_request_params=params,
|
||||
litellm_params=litellm_params,
|
||||
headers=headers,
|
||||
request: Final[dict[str, object]] = (
|
||||
super().transform_anthropic_messages_request( # mutable-ok: base returns a dict the caller updates in place # pyright: ignore[reportUnknownMemberType] # base signature is unparameterized
|
||||
model=model,
|
||||
messages=messages,
|
||||
anthropic_messages_optional_request_params=params,
|
||||
litellm_params=litellm_params,
|
||||
headers=headers,
|
||||
)
|
||||
)
|
||||
if self.supports_cache_control_ttl():
|
||||
request.update(stashed)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue