Home / Function/ test_tool_from_function_with_run_manager() — langchain Function Reference

test_tool_from_function_with_run_manager() — langchain Function Reference

Architecture documentation for the test_tool_from_function_with_run_manager() function in test_tools.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  1c8feb1d_0d08_8b52_494c_bf5181147ef6["test_tool_from_function_with_run_manager()"]
  8e7836ae_e72c_f670_72a5_4ca6d46e3555["test_tools.py"]
  1c8feb1d_0d08_8b52_494c_bf5181147ef6 -->|defined in| 8e7836ae_e72c_f670_72a5_4ca6d46e3555
  b621c544_d6db_7e8d_7240_9ce08870d71a["foo()"]
  1c8feb1d_0d08_8b52_494c_bf5181147ef6 -->|calls| b621c544_d6db_7e8d_7240_9ce08870d71a
  style 1c8feb1d_0d08_8b52_494c_bf5181147ef6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/test_tools.py lines 569–585

def test_tool_from_function_with_run_manager() -> None:
    """Test run of tool when using run_manager."""

    def foo(bar: str, callbacks: CallbackManagerForToolRun | None = None) -> str:  # noqa: D417
        """Docstring.

        Args:
            bar: str.
        """
        assert callbacks is not None
        return "foo" + bar

    handler = FakeCallbackHandler()
    tool = Tool.from_function(foo, name="foo", description="Docstring")

    assert tool.run(tool_input={"bar": "bar"}, run_manager=[handler]) == "foobar"
    assert tool.run("baz", run_manager=[handler]) == "foobaz"

Domain

Subdomains

Calls

Frequently Asked Questions

What does test_tool_from_function_with_run_manager() do?
test_tool_from_function_with_run_manager() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/test_tools.py.
Where is test_tool_from_function_with_run_manager() defined?
test_tool_from_function_with_run_manager() is defined in libs/core/tests/unit_tests/test_tools.py at line 569.
What does test_tool_from_function_with_run_manager() call?
test_tool_from_function_with_run_manager() calls 1 function(s): foo.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free