From 05d6977052aac902a53fa14d14c9eddb7c173019 Mon Sep 17 00:00:00 2001 From: yucheng Date: Thu, 24 Sep 2026 01:03:31 +0000 Subject: [PATCH] fix(batches): place mutable-ok tags on the lines the discipline gate flags Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- litellm/batches/batch_line_item_logging.py | 4 +--- litellm/llms/anthropic/chat/transformation.py | 5 +++-- litellm/llms/bedrock/batches/transformation.py | 12 +++++++++--- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/litellm/batches/batch_line_item_logging.py b/litellm/batches/batch_line_item_logging.py index 98b6f0a1757..cf4de486328 100644 --- a/litellm/batches/batch_line_item_logging.py +++ b/litellm/batches/batch_line_item_logging.py @@ -307,9 +307,7 @@ async def _emit_line_event( custom_llm_provider=custom_llm_provider, ) for secret_key in _SECRET_PARAM_KEYS: - child.litellm_params.pop( - secret_key, None - ) # mutable-ok: model_call_details holds this same dict # pyright: ignore[reportUnknownMemberType] # Logging.litellm_params is untyped upstream + child.litellm_params.pop(secret_key, None) # pyright: ignore[reportUnknownMemberType] # Logging.litellm_params is untyped upstream now: Final = datetime.now() # noqa: DTZ005 # naive to match the logging pipeline start_time if result is None: diff --git a/litellm/llms/anthropic/chat/transformation.py b/litellm/llms/anthropic/chat/transformation.py index 14c28b0ce68..77b8f906cbe 100644 --- a/litellm/llms/anthropic/chat/transformation.py +++ b/litellm/llms/anthropic/chat/transformation.py @@ -2798,8 +2798,9 @@ def anthropic_message_to_model_response(result: Mapping[str, object], speed: str return AnthropicConfig().transform_parsed_response( completion_response=pydantic_result.model_dump(), raw_response=httpx.Response( - status_code=200, headers={} - ), # mutable-ok: httpx.Response wants a plain dict of headers + status_code=200, + headers={}, # mutable-ok: httpx.Response wants a plain dict of headers + ), model_response=ModelResponse(id=result_id if isinstance(result_id, str) and result_id else None), json_mode=None, speed=speed, diff --git a/litellm/llms/bedrock/batches/transformation.py b/litellm/llms/bedrock/batches/transformation.py index c61cd0dfeef..b4c16f010cc 100644 --- a/litellm/llms/bedrock/batches/transformation.py +++ b/litellm/llms/bedrock/batches/transformation.py @@ -106,9 +106,15 @@ def bedrock_batch_line_to_response( embedding: Final = model_output.get("embedding") return EmbeddingResponse( model=model, - data=[ - {"object": "embedding", "index": 0, "embedding": embedding if isinstance(embedding, list) else []} - ], # mutable-ok: EmbeddingResponse takes a plain data list + data=[ # mutable-ok: EmbeddingResponse takes a plain data list + { # mutable-ok: plain row dict for EmbeddingResponse.data + "object": "embedding", + "index": 0, + "embedding": embedding + if isinstance(embedding, list) + else [], # mutable-ok: empty fallback for the row + } + ], usage=titan_embedding_usage_from_batch_output(model_output), ) if "output" in model_output: