mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-16 15:04:13 +00:00
core[patch]: fix mutating tool calls (#24677)
In some cases tool calls are mutated when passed through a tool.
This commit is contained in:
@@ -977,6 +977,16 @@ class AFooBase(FooBase):
|
||||
def test_tool_pass_config(tool: BaseTool) -> None:
|
||||
assert tool.invoke({"bar": "baz"}, {"configurable": {"foo": "not-bar"}}) == "baz"
|
||||
|
||||
# Test tool calls
|
||||
tool_call = {
|
||||
"name": tool.name,
|
||||
"args": {"bar": "baz"},
|
||||
"id": "abc123",
|
||||
"type": "tool_call",
|
||||
}
|
||||
_ = tool.invoke(tool_call, {"configurable": {"foo": "not-bar"}})
|
||||
assert tool_call["args"] == {"bar": "baz"}
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"tool", [foo, afoo, simple_foo, asimple_foo, FooBase(), AFooBase()]
|
||||
|
Reference in New Issue
Block a user