Home / Function/ test_tool_injected_tool_call_id() — langchain Function Reference

test_tool_injected_tool_call_id() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/core/tests/unit_tests/test_tools.py lines 2512–2546

def test_tool_injected_tool_call_id() -> None:
    @tool
    def foo(x: int, tool_call_id: Annotated[str, InjectedToolCallId]) -> ToolMessage:
        """Foo."""
        return ToolMessage(str(x), tool_call_id=tool_call_id)

    assert foo.invoke(
        {
            "type": "tool_call",
            "args": {"x": 0},
            "name": "foo",
            "id": "bar",
        }
    ) == ToolMessage("0", tool_call_id="bar")

    with pytest.raises(
        ValueError,
        match="When tool includes an InjectedToolCallId argument, "
        "tool must always be invoked with a full model ToolCall",
    ):
        assert foo.invoke({"x": 0})

    @tool
    def foo2(x: int, tool_call_id: Annotated[str, InjectedToolCallId()]) -> ToolMessage:
        """Foo."""
        return ToolMessage(str(x), tool_call_id=tool_call_id)

    assert foo2.invoke(
        {
            "type": "tool_call",
            "args": {"x": 0},
            "name": "foo",
            "id": "bar",
        }
    ) == ToolMessage("0", tool_call_id="bar")

Domain

Subdomains

Calls

Frequently Asked Questions

What does test_tool_injected_tool_call_id() do?
test_tool_injected_tool_call_id() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/test_tools.py.
Where is test_tool_injected_tool_call_id() defined?
test_tool_injected_tool_call_id() is defined in libs/core/tests/unit_tests/test_tools.py at line 2512.
What does test_tool_injected_tool_call_id() call?
test_tool_injected_tool_call_id() 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