From 66b2e66db0a66f380cc0c20b5d82331b87f38208 Mon Sep 17 00:00:00 2001 From: Diwak4r Date: Fri, 7 Aug 2026 13:56:24 +0545 Subject: [PATCH] fix(anthropic): shallow-copy input_schema to prevent caller mutation (Closes #34510) --- .../experimental_pass_through/adapters/transformation.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/litellm/llms/anthropic/experimental_pass_through/adapters/transformation.py b/litellm/llms/anthropic/experimental_pass_through/adapters/transformation.py index 22f9bfd30ea..1d7b3b30194 100644 --- a/litellm/llms/anthropic/experimental_pass_through/adapters/transformation.py +++ b/litellm/llms/anthropic/experimental_pass_through/adapters/transformation.py @@ -762,7 +762,9 @@ class LiteLLMAnthropicMessagesAdapter: name=truncated_name, ) if "input_schema" in tool: - function_chunk["parameters"] = tool["input_schema"] + # Shallow-copy to avoid mutating the caller's original dict when + # extra kwargs are merged below (see #34510). + function_chunk["parameters"] = dict(tool["input_schema"]) if "description" in tool: function_chunk["description"] = tool["description"]