Anthropic add_code_execution_tool only add one tool

When calling Anthropic with files, and this files it's of type `container_upload`, Anthropic requires the `code_execution` tool.

The tool its created correctly, but then because it only returns one tool, the `if` check won't apply that tool, resulting in a failed call to the AI
This commit is contained in:
rodriciru 2026-04-06 12:00:01 +02:00 committed by GitHub
parent d251238bd7
commit b008d2cc03
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1399,7 +1399,7 @@ class AnthropicConfig(AnthropicModelInfo, BaseConfig):
or []
)
tools = self.add_code_execution_tool(messages=anthropic_messages, tools=_tools)
if len(tools) > 1:
if len(tools) >= 1:
optional_params["tools"] = tools
## Load Config