From c5f8d1ea8b1f54a328915c325fde48140d7f4db2 Mon Sep 17 00:00:00 2001 From: Bharadwaj Pendyala Date: Sat, 12 Sep 2026 14:05:40 -0500 Subject: [PATCH] chore(interactions): keep the text param build inside the LIT002 budget The rebase onto current staging picked up a tighter type-discipline ceiling, and the six mutable-collection builds this change added put LIT002 at 26723 against a limit of 26715. Wrap the single-entry fallback in a tuple, and mark the text param builds mutable-ok: litellm_completion_transformation reads both the param and its format field back with isinstance(..., dict), so a MappingProxyType there would drop the format silently. Request output is unchanged for every response_format shape the tests cover. --- .../litellm_responses_transformation/transformation.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/litellm/interactions/litellm_responses_transformation/transformation.py b/litellm/interactions/litellm_responses_transformation/transformation.py index 450517f1725..2431c0f723c 100644 --- a/litellm/interactions/litellm_responses_transformation/transformation.py +++ b/litellm/interactions/litellm_responses_transformation/transformation.py @@ -129,7 +129,7 @@ class LiteLLMResponsesInteractionsConfig: schema=response_format, ) - entries: Final = response_format if isinstance(response_format, list) else [response_format] + entries: Final = response_format if isinstance(response_format, list) else (response_format,) text_entry: Final = next( (entry for entry in entries if isinstance(entry, Mapping) and entry.get("type") == "text"), None, @@ -146,16 +146,16 @@ class LiteLLMResponsesInteractionsConfig: if mime_type is not None and mime_type != _JSON_MIME_TYPE: return None if isinstance(schema, Mapping) and schema: - return { - "format": { + return { # mutable-ok: litellm_completion_transformation reads this back with isinstance(..., dict) + "format": { # mutable-ok: and checks this field the same way "type": "json_schema", "name": "response_schema", - "schema": dict(schema), + "schema": dict(schema), # mutable-ok: shallow copy of the caller's top-level keys "strict": False, } } if mime_type == _JSON_MIME_TYPE: - return {"format": {"type": "json_object"}} + return {"format": {"type": "json_object"}} # mutable-ok: same isinstance(..., dict) round trip return None @staticmethod