Home / Function/ test_tool_content_block_output() — langchain Function Reference

test_tool_content_block_output() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/core/tests/unit_tests/test_tools.py lines 1475–1494

def test_tool_content_block_output(block_type: str) -> None:
    @tool
    def my_tool(query: str) -> list[dict[str, Any]]:
        """Test tool."""
        return [{"type": block_type, "foo": "bar"}]

    tool_call = {
        "type": "tool_call",
        "name": "my_tool",
        "args": {"query": "baz"},
        "id": "call_abc123",
    }

    result = my_tool.invoke(tool_call)
    assert isinstance(result, ToolMessage)

    if block_type in TOOL_MESSAGE_BLOCK_TYPES:
        assert result.content == [{"type": block_type, "foo": "bar"}]
    else:
        assert result.content == '[{"type": "bad", "foo": "bar"}]'

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free