Home / Function/ test_async_before_model_decorator() — langchain Function Reference

test_async_before_model_decorator() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  be823dae_2db1_374d_3e35_112b896bee3f["test_async_before_model_decorator()"]
  85a104a3_11cf_6539_d0c0_ba69a17a41d4["test_decorators.py"]
  be823dae_2db1_374d_3e35_112b896bee3f -->|defined in| 85a104a3_11cf_6539_d0c0_ba69a17a41d4
  68028dcd_ea5b_7d3a_0d75_c9ebd1cef92b["before_model()"]
  be823dae_2db1_374d_3e35_112b896bee3f -->|calls| 68028dcd_ea5b_7d3a_0d75_c9ebd1cef92b
  style be823dae_2db1_374d_3e35_112b896bee3f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_decorators.py lines 276–286

def test_async_before_model_decorator() -> None:
    """Test before_model decorator with async function."""

    @before_model(state_schema=CustomState, tools=[test_tool], name="AsyncBeforeModel")
    async def async_before_model(*_args: Any, **_kwargs: Any) -> dict[str, Any]:
        return {"custom_field": "async_value"}

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

Domain

Subdomains

Frequently Asked Questions

What does test_async_before_model_decorator() do?
test_async_before_model_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_before_model_decorator() defined?
test_async_before_model_decorator() is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_decorators.py at line 276.
What does test_async_before_model_decorator() call?
test_async_before_model_decorator() calls 1 function(s): before_model.

Analyze Your Own Codebase

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

Try Supermodel Free