Skip to content

The agent engineering platform.

standard-tests[patch]: update test_bind_runnables_as_tools (#24241)

ccurme6fc7610b1c66
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 461902da60..511eab620c 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