mirror of
https://github.com/hwchase17/langchain
synced 2024-11-10 01:10:59 +00:00
standard-tests[patch]: update test_bind_runnables_as_tools (#24241)
Reduce number of tool arguments from two to one.
This commit is contained in:
parent
0da5078cad
commit
6fc7610b1c
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user