From 6fc7610b1c66781fda62e542c8b4aed2c7b5f3f8 Mon Sep 17 00:00:00 2001 From: ccurme Date: Mon, 15 Jul 2024 08:35:07 -0400 Subject: [PATCH] standard-tests[patch]: update test_bind_runnables_as_tools (#24241) Reduce number of tool arguments from two to one. --- .../integration_tests/chat_models.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) 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.py index 461902da60f..511eab620cd 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 @@ -193,22 +193,16 @@ class ChatModelIntegrationTests(ChatModelTests): pytest.skip("Test requires tool calling.") prompt = ChatPromptTemplate.from_messages( - [ - ("system", "Repeat what the user says in the style of {answer_style}."), - ("human", "{user_input}"), - ] + [("human", "Hello. Please respond in the style of {answer_style}.")] ) llm = GenericFakeChatModel(messages=iter(["hello matey"])) chain = prompt | llm | StrOutputParser() tool_ = chain.as_tool( - name="repeat_in_answer_style", - description="Repeat the user_input in a particular style of speaking.", + name="greeting_generator", + description="Generate a greeting in a particular style of speaking.", ) model_with_tools = model.bind_tools([tool_]) - query = ( - "Using the repeat_in_answer_style tool, ask a Pirate how they would say " - "hello." - ) + query = "Using the tool, generate a Pirate greeting." result = model_with_tools.invoke(query) assert isinstance(result, AIMessage) assert result.tool_calls