The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
standard-tests[patch]: add test for async tool calling (#28133)
ccurme776e3271e3b9
diff --git a/libs/partners/huggingface/tests/integration_tests/test_standard.py b/libs/partners/huggingface/tests/integration_tests/test_standard.pyindex fd120f3f0f..34392e979f 100644--- a/libs/partners/huggingface/tests/integration_tests/test_standard.py+++ b/libs/partners/huggingface/tests/integration_tests/test_standard.py@@ -53,6 +53,10 @@ class TestHuggingFaceEndpoint(ChatModelIntegrationTests):def test_tool_calling(self, model: BaseChatModel) -> None:super().test_tool_calling(model)+ @pytest.mark.xfail(reason=("Not implemented"))+ async def test_tool_calling_async(self, model: BaseChatModel) -> None:+ await super().test_tool_calling_async(model)+@pytest.mark.xfail(reason=("Not implemented"))def test_tool_calling_with_no_arguments(self, model: BaseChatModel) -> None:super().test_tool_calling_with_no_arguments(model)diff --git a/libs/standard-tests/langchain_standard_tests/integration_tests/chat_models.py b/libs/standard-tests/langchain_standard_tests/integration_tests/chat_models.pyindex 5c0c8c6628..9eea91aebb 100644--- a/libs/standard-tests/langchain_standard_tests/integration_tests/chat_models.py+++ b/libs/standard-tests/langchain_standard_tests/integration_tests/chat_models.py@@ -286,6 +286,27 @@ class ChatModelIntegrationTests(ChatModelTests):assert isinstance(full, AIMessage)_validate_tool_call_message(full)+ async def test_tool_calling_async(self, model: BaseChatModel) -> None:+ if not self.has_tool_calling:+ pytest.skip("Test requires tool calling.")+ if self.tool_choice_value == "tool_name":+ tool_choice: Optional[str] = "magic_function"+ else:+ tool_choice = self.tool_choice_value+ model_with_tools = model.bind_tools([magic_function], tool_choice=tool_choice)++ # Test ainvoke+ query = "What is the value of magic_function(3)? Use the tool."+ result = await model_with_tools.ainvoke(query)+ _validate_tool_call_message(result)++ # Test astream+ full: Optional[BaseMessageChunk] = None+ async for chunk in model_with_tools.astream(query):+ full = chunk if full is None else full + chunk # type: ignore+ assert isinstance(full, AIMessage)+ _validate_tool_call_message(full)+def test_tool_calling_with_no_arguments(self, model: BaseChatModel) -> None:if not self.has_tool_calling:pytest.skip("Test requires tool calling.")