Home / Function/ test_filter_multiple_injected_args() — langchain Function Reference

test_filter_multiple_injected_args() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/core/tests/unit_tests/test_tools.py lines 3061–3104

def test_filter_multiple_injected_args() -> None:
    """Test filtering multiple injected arguments from callback inputs."""

    @tool
    def complex_tool(
        query: str,
        limit: int,
        state: Annotated[dict, InjectedToolArg()],
        context: Annotated[str, InjectedToolArg()],
        run_manager: CallbackManagerForToolRun | None = None,
    ) -> str:
        """Complex tool with multiple injected args.

        Args:
            query: The search query.
            limit: Maximum number of results.
            state: Injected state.
            context: Injected context.
            run_manager: The callback manager.
        """
        return f"Query: {query}, Limit: {limit}"

    handler = CallbackHandlerWithInputCapture(captured_inputs=[])
    result = complex_tool.invoke(
        {
            "query": "test",
            "limit": 10,
            "state": {"foo": "bar"},
            "context": "some context",
        },
        config={"callbacks": [handler]},
    )

    assert result == "Query: test, Limit: 10"
    assert handler.tool_starts == 1
    assert len(handler.captured_inputs) == 1

    # Verify that only non-injected args remain
    captured = handler.captured_inputs[0]
    assert captured is not None
    assert captured == {"query": "test", "limit": 10}
    assert "state" not in captured
    assert "context" not in captured
    assert "run_manager" not in captured

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free