Fix Anthropic tool-less usage
This commit is contained in:
@@ -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]]:
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user