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
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