Home / Function/ test_async_custom_tool() — langchain Function Reference

test_async_custom_tool() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  9fe6b844_58e0_74c3_65f5_02e3e43944d2["test_async_custom_tool()"]
  ced23dac_81f2_ce6f_ba7e_95368f42c953["test_tools.py"]
  9fe6b844_58e0_74c3_65f5_02e3e43944d2 -->|defined in| ced23dac_81f2_ce6f_ba7e_95368f42c953
  style 9fe6b844_58e0_74c3_65f5_02e3e43944d2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/openai/tests/unit_tests/test_tools.py lines 99–123

async def test_async_custom_tool() -> None:
    @custom_tool
    async def my_async_tool(x: str) -> str:
        """Do async thing."""
        return "a" + x

    # Test decorator
    assert isinstance(my_async_tool, Tool)
    assert my_async_tool.metadata == {"type": "custom_tool"}
    assert my_async_tool.description == "Do async thing."

    result = await my_async_tool.ainvoke(
        {
            "type": "tool_call",
            "name": "my_async_tool",
            "args": {"whatever": "b"},
            "id": "abc",
            "extras": {"type": "custom_tool_call"},
        }
    )
    assert result == ToolMessage(
        [{"type": "custom_tool_call_output", "output": "ab"}],
        name="my_async_tool",
        tool_call_id="abc",
    )

Domain

Subdomains

Frequently Asked Questions

What does test_async_custom_tool() do?
test_async_custom_tool() is a function in the langchain codebase, defined in libs/partners/openai/tests/unit_tests/test_tools.py.
Where is test_async_custom_tool() defined?
test_async_custom_tool() is defined in libs/partners/openai/tests/unit_tests/test_tools.py at line 99.

Analyze Your Own Codebase

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

Try Supermodel Free