mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-12 03:48:56 +00:00
chore: drop stale mutable-ok suppressions after LIT002 removal
Some checks failed
LiteLLM Rust / rust-lint (push) Has been cancelled
LiteLLM Rust / rust-test (push) Has been cancelled
LiteLLM Rust / rust-wheel (push) Has been cancelled
Terraform Provider / gofmt, vet, build, test (push) Has been cancelled
Terraform Provider / Provider endpoints vs proxy OpenAPI schema (push) Has been cancelled
Some checks failed
LiteLLM Rust / rust-lint (push) Has been cancelled
LiteLLM Rust / rust-test (push) Has been cancelled
LiteLLM Rust / rust-wheel (push) Has been cancelled
Terraform Provider / gofmt, vet, build, test (push) Has been cancelled
Terraform Provider / Provider endpoints vs proxy OpenAPI schema (push) Has been cancelled
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
e1b9449c3f
commit
60a47e2900
4 changed files with 15 additions and 21 deletions
|
|
@ -110,7 +110,7 @@ def _json_fallback(value: object) -> dict[str, object] | str:
|
|||
mapping: Final = _as_object_mapping(value)
|
||||
if mapping is None:
|
||||
return str(value)
|
||||
return dict(mapping) # mutable-ok: json.dumps default hook must return a plain dict
|
||||
return dict(mapping)
|
||||
|
||||
|
||||
class _BatchLineFailure(Exception):
|
||||
|
|
@ -285,7 +285,7 @@ def _new_child_logging(
|
|||
dynamic_async_success_callbacks=parent.dynamic_async_success_callbacks, # pyright: ignore[reportUnknownMemberType, reportUnknownArgumentType] # same as above
|
||||
dynamic_failure_callbacks=parent.dynamic_failure_callbacks, # pyright: ignore[reportUnknownMemberType, reportUnknownArgumentType] # same as above
|
||||
dynamic_async_failure_callbacks=parent.dynamic_async_failure_callbacks, # pyright: ignore[reportUnknownMemberType, reportUnknownArgumentType] # same as above
|
||||
kwargs={"litellm_session_id": parent.litellm_session_id}, # mutable-ok: kwargs takes a plain dict
|
||||
kwargs={"litellm_session_id": parent.litellm_session_id},
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -295,7 +295,7 @@ def _line_hidden_params(
|
|||
status_code: int | None,
|
||||
response_cost: float | None = None,
|
||||
) -> dict[str, object]: # mutable-ok: response objects declare _hidden_params as a plain dict
|
||||
return { # mutable-ok: same contract
|
||||
return {
|
||||
"batch_id": batch.id,
|
||||
"batch_custom_id": custom_id,
|
||||
"batch_line_status_code": status_code,
|
||||
|
|
@ -306,14 +306,12 @@ def _line_hidden_params(
|
|||
def _optional_params_for_body(
|
||||
request_body: Mapping[str, object],
|
||||
) -> dict[str, object]: # mutable-ok: update_environment_variables takes a plain dict
|
||||
return { # mutable-ok: same contract
|
||||
key: value for key, value in request_body.items() if key not in ("model", "messages", "input")
|
||||
}
|
||||
return {key: value for key, value in request_body.items() if key not in ("model", "messages", "input")}
|
||||
|
||||
|
||||
def _metadata_copy(params: Mapping[str, object]) -> dict[str, object]: # mutable-ok: dict out for litellm_params
|
||||
metadata: Final = _as_object_mapping(params.get("metadata")) or _EMPTY_BODY
|
||||
return {**metadata} # mutable-ok: plain-dict copy
|
||||
return {**metadata}
|
||||
|
||||
|
||||
async def _emit_line_event(
|
||||
|
|
@ -355,7 +353,7 @@ async def _emit_line_event(
|
|||
start_time=start_time,
|
||||
)
|
||||
child.update_environment_variables( # pyright: ignore[reportUnknownMemberType] # Logging.update_environment_variables is untyped upstream
|
||||
litellm_params={ # mutable-ok: update_environment_variables takes a plain dict
|
||||
litellm_params={
|
||||
**parent_params,
|
||||
"batch_parent_id": batch.id,
|
||||
"metadata": _metadata_copy(parent_params),
|
||||
|
|
@ -466,9 +464,7 @@ async def log_batch_line_items(
|
|||
internal_credentials: Final = parent._litellm_internal_model_credentials # pyright: ignore[reportPrivateUsage] # declared transport attribute on Logging
|
||||
internal_mapping: Final = _as_object_mapping(internal_credentials)
|
||||
fetch_params: Final[dict[str, object] | None] = ( # mutable-ok: file fetcher requires a plain dict
|
||||
dict(internal_mapping) # mutable-ok: the file fetcher reads credential kwargs off a plain dict
|
||||
if internal_mapping is not None
|
||||
else litellm_params
|
||||
dict(internal_mapping) if internal_mapping is not None else litellm_params
|
||||
)
|
||||
|
||||
input_file_content: Final = await _fetch_managed_file_or_empty(batch.input_file_id, line_provider, fetch_params)
|
||||
|
|
|
|||
|
|
@ -6445,7 +6445,7 @@ def _extract_response_obj_and_hidden_params(
|
|||
original_exception, "_hidden_params", None
|
||||
)
|
||||
if isinstance(exception_hidden_params, dict) and exception_hidden_params:
|
||||
hidden_params = dict(exception_hidden_params) # mutable-ok: hidden_params downstream expects a plain dict
|
||||
hidden_params = dict(exception_hidden_params)
|
||||
elif (response_headers := _get_response_headers(original_exception)) is not None:
|
||||
hidden_params = dict(
|
||||
StandardLoggingHiddenParams(
|
||||
|
|
|
|||
|
|
@ -2816,7 +2816,7 @@ def anthropic_message_to_model_response(result: Mapping[str, object], speed: str
|
|||
completion_response=pydantic_result.model_dump(),
|
||||
raw_response=httpx.Response(
|
||||
status_code=200,
|
||||
headers={}, # mutable-ok: httpx.Response wants a plain dict of headers
|
||||
headers={},
|
||||
),
|
||||
model_response=ModelResponse(id=result_id if isinstance(result_id, str) and result_id else None),
|
||||
json_mode=None,
|
||||
|
|
|
|||
|
|
@ -106,13 +106,11 @@ def bedrock_batch_line_to_response(
|
|||
embedding: Final = model_output.get("embedding")
|
||||
return EmbeddingResponse(
|
||||
model=model,
|
||||
data=[ # mutable-ok: EmbeddingResponse takes a plain data list
|
||||
{ # mutable-ok: plain row dict for EmbeddingResponse.data
|
||||
data=[
|
||||
{
|
||||
"object": "embedding",
|
||||
"index": 0,
|
||||
"embedding": embedding
|
||||
if isinstance(embedding, list)
|
||||
else [], # mutable-ok: empty fallback for the row
|
||||
"embedding": embedding if isinstance(embedding, list) else [],
|
||||
}
|
||||
],
|
||||
usage=titan_embedding_usage_from_batch_output(model_output),
|
||||
|
|
@ -122,14 +120,14 @@ def bedrock_batch_line_to_response(
|
|||
|
||||
return AmazonConverseConfig()._transform_response( # pyright: ignore[reportPrivateUsage] # same reconstruction the converse chat path performs on the live response
|
||||
model=model,
|
||||
response=Response(200, json=dict(model_output)), # mutable-ok: httpx.Response json= wants a plain dict
|
||||
response=Response(200, json=dict(model_output)),
|
||||
model_response=ModelResponse(),
|
||||
stream=False,
|
||||
logging_obj=None,
|
||||
optional_params={}, # mutable-ok: the converse transform signature takes a plain dict
|
||||
optional_params={},
|
||||
api_key=None,
|
||||
data="",
|
||||
messages=[], # mutable-ok: the converse transform signature takes a plain list
|
||||
messages=[],
|
||||
encoding=None,
|
||||
)
|
||||
if "content" in model_output:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue