Merge pull request #2597 from pipecat-ai/pk/fix-anthropic-tool-less-usage

Fix Anthropic tool-less usage
This commit is contained in:
kompfner
2025-09-05 15:30:29 -04:00
committed by GitHub
2 changed files with 3 additions and 3 deletions

View File

@@ -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]]:

View File

@@ -311,7 +311,7 @@ class AnthropicLLMService(LLMService):
return AnthropicLLMInvocationParams(
system=context.system,
messages=messages,
tools=context.tools,
tools=context.tools or [],
)
@traced_llm