Home / Function/ test_async_invoke_matches_output_schema() — langchain Function Reference

test_async_invoke_matches_output_schema() — langchain Function Reference

Architecture documentation for the test_async_invoke_matches_output_schema() function in tools.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  783dd635_4bb1_86f5_88be_258d97f7581b["test_async_invoke_matches_output_schema()"]
  1d8fc9eb_6e1b_e6b2_25c1_496643fddc53["ToolsIntegrationTests"]
  783dd635_4bb1_86f5_88be_258d97f7581b -->|defined in| 1d8fc9eb_6e1b_e6b2_25c1_496643fddc53
  style 783dd635_4bb1_86f5_88be_258d97f7581b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/standard-tests/langchain_tests/integration_tests/tools.py lines 45–70

    async def test_async_invoke_matches_output_schema(self, tool: BaseTool) -> None:
        """Test async invoke matches output schema.

        If ainvoked with a `ToolCall`, the tool should return a valid `ToolMessage`
        content.

        For debugging tips, see `test_invoke_matches_output_schema`.
        """
        tool_call = ToolCall(
            name=tool.name,
            args=self.tool_invoke_params_example,
            id="123",
            type="tool_call",
        )
        result = await tool.ainvoke(tool_call)

        tool_message = result
        if tool.response_format == "content_and_artifact":
            # artifact can be anything, except none
            assert tool_message.artifact is not None

        # check content is a valid ToolMessage content
        assert isinstance(tool_message.content, str | list)
        if isinstance(tool_message.content, list):
            # content blocks must be str or dict
            assert all(isinstance(c, str | dict) for c in tool_message.content)

Domain

Subdomains

Frequently Asked Questions

What does test_async_invoke_matches_output_schema() do?
test_async_invoke_matches_output_schema() is a function in the langchain codebase, defined in libs/standard-tests/langchain_tests/integration_tests/tools.py.
Where is test_async_invoke_matches_output_schema() defined?
test_async_invoke_matches_output_schema() is defined in libs/standard-tests/langchain_tests/integration_tests/tools.py at line 45.

Analyze Your Own Codebase

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

Try Supermodel Free