Home / Function/ test_override_tool_call() — langchain Function Reference

test_override_tool_call() — langchain Function Reference

Architecture documentation for the test_override_tool_call() function in test_overrides.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  8eea0c71_9fe8_58cf_3847_30e6704386b1["test_override_tool_call()"]
  fe9405ec_9f76_8e01_a9d8_c9a8313d07fc["TestToolCallRequestOverride"]
  8eea0c71_9fe8_58cf_3847_30e6704386b1 -->|defined in| fe9405ec_9f76_8e01_a9d8_c9a8313d07fc
  style 8eea0c71_9fe8_58cf_3847_30e6704386b1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_overrides.py lines 259–285

    def test_override_tool_call(self) -> None:
        """Test overriding tool_call dict."""

        @tool
        def test_tool(x: int) -> str:
            """A test tool."""
            return f"Result: {x}"

        original_call = ToolCall(name="test_tool", args={"x": 5}, id="1", type="tool_call")
        modified_call = ToolCall(name="test_tool", args={"x": 10}, id="1", type="tool_call")

        original_request = ToolCallRequest(
            tool_call=original_call,
            tool=test_tool,
            state={"messages": []},
            runtime=Mock(),
        )

        new_request = original_request.override(tool_call=modified_call)

        # New request should have modified tool_call
        assert new_request.tool_call["args"]["x"] == 10
        # Original should be unchanged
        assert original_request.tool_call["args"]["x"] == 5
        # Other attributes should be the same
        assert new_request.tool is original_request.tool
        assert new_request.state is original_request.state

Domain

Subdomains

Frequently Asked Questions

What does test_override_tool_call() do?
test_override_tool_call() is a function in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_overrides.py.
Where is test_override_tool_call() defined?
test_override_tool_call() is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_overrides.py at line 259.

Analyze Your Own Codebase

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

Try Supermodel Free