From eb69a24fddee8945c19150aec7b363336ba45ea3 Mon Sep 17 00:00:00 2001 From: Sarah Wooders Date: Sat, 12 Apr 2025 16:39:36 -0700 Subject: [PATCH] fix: force `tool_choice` to be `auto` for claude-3.7-sonnet (#1694) --- letta/llm_api/anthropic_client.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/letta/llm_api/anthropic_client.py b/letta/llm_api/anthropic_client.py index 9c72ba42..89e437df 100644 --- a/letta/llm_api/anthropic_client.py +++ b/letta/llm_api/anthropic_client.py @@ -159,6 +159,10 @@ class AnthropicClient(LLMClientBase): # Special case for summarization path tools_for_request = None tool_choice = None + elif llm_config.enable_reasoner: + # NOTE: reasoning models currently do not allow for `any` + tool_choice = {"type": "auto", "disable_parallel_tool_use": True} + tools_for_request = [Tool(function=f) for f in tools] elif force_tool_call is not None: tool_choice = {"type": "tool", "name": force_tool_call} tools_for_request = [Tool(function=f) for f in tools if f["name"] == force_tool_call]