Home / Function/ test_async_on_model_call_decorator() — langchain Function Reference

test_async_on_model_call_decorator() — langchain Function Reference

Architecture documentation for the test_async_on_model_call_decorator() function in test_decorators.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  5886caad_30dd_6937_6a8b_8ff2bb15c135["test_async_on_model_call_decorator()"]
  85a104a3_11cf_6539_d0c0_ba69a17a41d4["test_decorators.py"]
  5886caad_30dd_6937_6a8b_8ff2bb15c135 -->|defined in| 85a104a3_11cf_6539_d0c0_ba69a17a41d4
  style 5886caad_30dd_6937_6a8b_8ff2bb15c135 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_decorators.py lines 302–317

def test_async_on_model_call_decorator() -> None:
    """Test wrap_model_call decorator with async function."""

    @wrap_model_call(state_schema=CustomState, tools=[test_tool], name="AsyncOnModelCall")
    async def async_on_model_call(
        request: ModelRequest,
        handler: Callable[[ModelRequest], Awaitable[ModelResponse]],
    ) -> ModelCallResult:
        return await handler(
            request.override(system_message=SystemMessage(content="Modified async"))
        )

    assert isinstance(async_on_model_call, AgentMiddleware)
    assert async_on_model_call.state_schema == CustomState
    assert async_on_model_call.tools == [test_tool]
    assert async_on_model_call.__class__.__name__ == "AsyncOnModelCall"

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free