Fix Anthropic tool-less usage

This commit is contained in:
Paul Kompfner
2025-09-05 11:47:31 -04:00
parent 516f0e08ab
commit dc2e1d4ad3
2 changed files with 3 additions and 3 deletions

View File

@@ -35,7 +35,7 @@ class AnthropicLLMInvocationParams(TypedDict):
system: str | NotGiven system: str | NotGiven
messages: List[MessageParam] messages: List[MessageParam]
tools: List[ToolUnionParam] | NotGiven tools: List[ToolUnionParam]
class AnthropicLLMAdapter(BaseLLMAdapter[AnthropicLLMInvocationParams]): class AnthropicLLMAdapter(BaseLLMAdapter[AnthropicLLMInvocationParams]):
@@ -68,7 +68,7 @@ class AnthropicLLMAdapter(BaseLLMAdapter[AnthropicLLMInvocationParams]):
else messages.messages else messages.messages
), ),
# NOTE: LLMContext's tools are guaranteed to be a ToolsSchema (or NOT_GIVEN) # 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]]: def get_messages_for_logging(self, context: LLMContext) -> List[Dict[str, Any]]:

View File

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