Home / Function/ test_filter_run_manager_from_callbacks() — langchain Function Reference

test_filter_run_manager_from_callbacks() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  69d9294f_af5b_0a2d_c59f_64a47fee4999["test_filter_run_manager_from_callbacks()"]
  8e7836ae_e72c_f670_72a5_4ca6d46e3555["test_tools.py"]
  69d9294f_af5b_0a2d_c59f_64a47fee4999 -->|defined in| 8e7836ae_e72c_f670_72a5_4ca6d46e3555
  style 69d9294f_af5b_0a2d_c59f_64a47fee4999 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/test_tools.py lines 3028–3058

def test_filter_run_manager_from_callbacks() -> None:
    """Test that run_manager is filtered from callback inputs."""

    @tool
    def tool_with_run_manager(
        message: str,
        run_manager: CallbackManagerForToolRun | None = None,
    ) -> str:
        """Tool with run_manager parameter.

        Args:
            message: The message to process.
            run_manager: The callback manager.
        """
        return f"Processed: {message}"

    handler = CallbackHandlerWithInputCapture(captured_inputs=[])
    result = tool_with_run_manager.invoke(
        {"message": "hello"},
        config={"callbacks": [handler]},
    )

    assert result == "Processed: hello"
    assert handler.tool_starts == 1
    assert len(handler.captured_inputs) == 1

    # Verify that run_manager is filtered out
    captured = handler.captured_inputs[0]
    assert captured is not None
    assert "message" in captured
    assert "run_manager" not in captured

Domain

Subdomains

Frequently Asked Questions

What does test_filter_run_manager_from_callbacks() do?
test_filter_run_manager_from_callbacks() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/test_tools.py.
Where is test_filter_run_manager_from_callbacks() defined?
test_filter_run_manager_from_callbacks() is defined in libs/core/tests/unit_tests/test_tools.py at line 3028.

Analyze Your Own Codebase

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

Try Supermodel Free