From 6174609685bd68e326fe762f86e3556718312470 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Thu, 24 Jul 2025 19:55:52 -0700 Subject: [PATCH] [LLM Translation] - Bug fix Anthropic Tool calling (#12959) * fix _map_tool_helper * fix linting --- litellm/llms/anthropic/chat/transformation.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/litellm/llms/anthropic/chat/transformation.py b/litellm/llms/anthropic/chat/transformation.py index b3cf302532..ce874bfde9 100644 --- a/litellm/llms/anthropic/chat/transformation.py +++ b/litellm/llms/anthropic/chat/transformation.py @@ -198,10 +198,14 @@ class AnthropicConfig(AnthropicModelInfo, BaseConfig): "properties": {}, }, ) - input_schema: AnthropicInputSchema = AnthropicInputSchema(**_input_schema) + + _allowed_properties = set(AnthropicInputSchema.__annotations__.keys()) + input_schema_filtered = {k: v for k, v in _input_schema.items() if k in _allowed_properties} + input_anthropic_schema: AnthropicInputSchema = AnthropicInputSchema(**input_schema_filtered) + _tool = AnthropicMessagesTool( name=tool["function"]["name"], - input_schema=input_schema, + input_schema=input_anthropic_schema, ) _description = tool["function"].get("description")