test_tool_ainvoke_does_not_mutate_inputs() — langchain Function Reference
Architecture documentation for the test_tool_ainvoke_does_not_mutate_inputs() function in test_tools.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 28885470_2814_decb_fd3b_7829372a6d32["test_tool_ainvoke_does_not_mutate_inputs()"] 8e7836ae_e72c_f670_72a5_4ca6d46e3555["test_tools.py"] 28885470_2814_decb_fd3b_7829372a6d32 -->|defined in| 8e7836ae_e72c_f670_72a5_4ca6d46e3555 style 28885470_2814_decb_fd3b_7829372a6d32 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/tests/unit_tests/test_tools.py lines 2855–2900
async def test_tool_ainvoke_does_not_mutate_inputs() -> None:
"""Verify that the inputs are not mutated when invoking a tool asynchronously."""
def sync_no_op(foo: int) -> str:
return "good"
async def async_no_op(foo: int) -> str:
return "good"
tool = StructuredTool(
name="sample_tool",
description="",
args_schema={
"type": "object",
"required": ["foo"],
"properties": {
"seconds": {"type": "number", "description": "How big is foo"}
},
},
coroutine=async_no_op,
func=sync_no_op,
)
tool_call: ToolCall = {
"name": "sample_tool",
"args": {"foo": 2},
"id": "call_0_82c17db8-95df-452f-a4c2-03f809022134",
"type": "tool_call",
}
assert tool.invoke(tool_call["args"]) == "good"
assert tool_call == {
"name": "sample_tool",
"args": {"foo": 2},
"id": "call_0_82c17db8-95df-452f-a4c2-03f809022134",
"type": "tool_call",
}
assert await tool.ainvoke(tool_call["args"]) == "good"
assert tool_call == {
"name": "sample_tool",
"args": {"foo": 2},
"id": "call_0_82c17db8-95df-452f-a4c2-03f809022134",
"type": "tool_call",
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does test_tool_ainvoke_does_not_mutate_inputs() do?
test_tool_ainvoke_does_not_mutate_inputs() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/test_tools.py.
Where is test_tool_ainvoke_does_not_mutate_inputs() defined?
test_tool_ainvoke_does_not_mutate_inputs() is defined in libs/core/tests/unit_tests/test_tools.py at line 2855.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free