test_before_model_decorator() — langchain Function Reference
Architecture documentation for the test_before_model_decorator() function in test_decorators.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD a41af999_9f1d_2536_5593_c14c9b89179f["test_before_model_decorator()"] 85a104a3_11cf_6539_d0c0_ba69a17a41d4["test_decorators.py"] a41af999_9f1d_2536_5593_c14c9b89179f -->|defined in| 85a104a3_11cf_6539_d0c0_ba69a17a41d4 68028dcd_ea5b_7d3a_0d75_c9ebd1cef92b["before_model()"] a41af999_9f1d_2536_5593_c14c9b89179f -->|calls| 68028dcd_ea5b_7d3a_0d75_c9ebd1cef92b style a41af999_9f1d_2536_5593_c14c9b89179f fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_decorators.py lines 50–66
def test_before_model_decorator() -> None:
"""Test before_model decorator with all configuration options."""
@before_model(
state_schema=CustomState, tools=[test_tool], can_jump_to=["end"], name="CustomBeforeModel"
)
def custom_before_model(*_args: Any, **_kwargs: Any) -> dict[str, Any]:
return {"jump_to": "end"}
assert isinstance(custom_before_model, AgentMiddleware)
assert custom_before_model.state_schema == CustomState
assert custom_before_model.tools == [test_tool]
assert getattr(custom_before_model.__class__.before_model, "__can_jump_to__", []) == ["end"]
assert custom_before_model.__class__.__name__ == "CustomBeforeModel"
result = custom_before_model.before_model({"messages": [HumanMessage("Hello")]}, Runtime())
assert result == {"jump_to": "end"}
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does test_before_model_decorator() do?
test_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_before_model_decorator() defined?
test_before_model_decorator() is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_decorators.py at line 50.
What does test_before_model_decorator() call?
test_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