Test that the model generates tool calls for tools with no arguments.
This test is skipped if the has_tool_calling property on the test class
is set to False.
This test is optional and should be skipped if the model does not support tool calling (see configuration below).
To disable tool calling tests, set has_tool_calling to False in your
test class:
class TestMyChatModelIntegration(ChatModelIntegrationTests):
@property
def has_tool_calling(self) -> bool:
return FalseIf this test fails, check that bind_tools is implemented to correctly
translate LangChain tool objects into the appropriate schema for your
chat model. It should correctly handle the case where a tool has no
arguments.
This test may fail if the chat model does not support a tool_choice
parameter. This parameter can be used to force a tool call. It may also
fail if a provider does not support this form of tool. In these cases,
you can xfail the test:
@pytest.mark.xfail(reason=("Does not support tool_choice."))
def test_tool_calling_with_no_arguments(self, model: BaseChatModel) -> None:
super().test_tool_calling_with_no_arguments(model)
Otherwise, in the case that only one tool is bound, ensure that
tool_choice supports the string 'any' to force calling that tool.
test_tool_calling_with_no_arguments(
self,
model: BaseChatModel,
) -> None