Skip to content

Commit

Permalink
x
Browse files Browse the repository at this point in the history
  • Loading branch information
efriis committed Dec 19, 2024
1 parent fe84a9a commit acbb087
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions libs/core/tests/unit_tests/test_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -2255,3 +2255,20 @@ def foo(x: int) -> Bar:
assert foo.invoke(
{"type": "tool_call", "args": {"x": 0}, "name": "foo", "id": "bar"}
) == Bar(x=0)


def test_tool_mutate_input() -> None:
class MyTool(BaseTool):
name: str = "MyTool"
description: str = "a tool"

def _run(
self,
x: str,
run_manager: Optional[CallbackManagerForToolRun] = None,
) -> str:
return "hi"

my_input = {"x": "hi"}
MyTool().invoke(my_input)
assert my_input == {"x": "hi"}

0 comments on commit acbb087

Please sign in to comment.