From dc2e1d4ad342d8be4bcf6cd51a622e2ec9d348eb Mon Sep 17 00:00:00 2001 From: Paul Kompfner Date: Fri, 5 Sep 2025 11:47:31 -0400 Subject: [PATCH] Fix Anthropic tool-less usage --- src/pipecat/adapters/services/anthropic_adapter.py | 4 ++-- src/pipecat/services/anthropic/llm.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pipecat/adapters/services/anthropic_adapter.py b/src/pipecat/adapters/services/anthropic_adapter.py index a507f7211..b8761e552 100644 --- a/src/pipecat/adapters/services/anthropic_adapter.py +++ b/src/pipecat/adapters/services/anthropic_adapter.py @@ -35,7 +35,7 @@ class AnthropicLLMInvocationParams(TypedDict): system: str | NotGiven messages: List[MessageParam] - tools: List[ToolUnionParam] | NotGiven + tools: List[ToolUnionParam] class AnthropicLLMAdapter(BaseLLMAdapter[AnthropicLLMInvocationParams]): @@ -68,7 +68,7 @@ class AnthropicLLMAdapter(BaseLLMAdapter[AnthropicLLMInvocationParams]): else messages.messages ), # NOTE: LLMContext's tools are guaranteed to be a ToolsSchema (or NOT_GIVEN) - "tools": self.from_standard_tools(context.tools), + "tools": self.from_standard_tools(context.tools) or [], } def get_messages_for_logging(self, context: LLMContext) -> List[Dict[str, Any]]: diff --git a/src/pipecat/services/anthropic/llm.py b/src/pipecat/services/anthropic/llm.py index 013c3f155..4ec477dac 100644 --- a/src/pipecat/services/anthropic/llm.py +++ b/src/pipecat/services/anthropic/llm.py @@ -311,7 +311,7 @@ class AnthropicLLMService(LLMService): return AnthropicLLMInvocationParams( system=context.system, messages=messages, - tools=context.tools, + tools=context.tools or [], ) @traced_llm