test_hook_config_decorator_on_class_method() — langchain Function Reference
Architecture documentation for the test_hook_config_decorator_on_class_method() function in test_decorators.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD a07be0fe_4b9e_17f0_8a15_c277b29b23dc["test_hook_config_decorator_on_class_method()"] 85a104a3_11cf_6539_d0c0_ba69a17a41d4["test_decorators.py"] a07be0fe_4b9e_17f0_8a15_c277b29b23dc -->|defined in| 85a104a3_11cf_6539_d0c0_ba69a17a41d4 5db83528_8e08_d7fe_e2fc_f806b038e621["after_model()"] a07be0fe_4b9e_17f0_8a15_c277b29b23dc -->|calls| 5db83528_8e08_d7fe_e2fc_f806b038e621 68028dcd_ea5b_7d3a_0d75_c9ebd1cef92b["before_model()"] a07be0fe_4b9e_17f0_8a15_c277b29b23dc -->|calls| 68028dcd_ea5b_7d3a_0d75_c9ebd1cef92b style a07be0fe_4b9e_17f0_8a15_c277b29b23dc fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_decorators.py lines 189–209
def test_hook_config_decorator_on_class_method() -> None:
"""Test hook_config decorator on AgentMiddleware class methods."""
class JumpMiddleware(AgentMiddleware):
@hook_config(can_jump_to=["end", "model"])
def before_model(
self, state: AgentState[Any], runtime: Runtime[None]
) -> dict[str, Any] | None:
if len(state["messages"]) > 5:
return {"jump_to": "end"}
return None
@hook_config(can_jump_to=["tools"])
def after_model(
self, state: AgentState[Any], runtime: Runtime[None]
) -> dict[str, Any] | None:
return {"jump_to": "tools"}
# Verify can_jump_to metadata is preserved
assert getattr(JumpMiddleware.before_model, "__can_jump_to__", []) == ["end", "model"]
assert getattr(JumpMiddleware.after_model, "__can_jump_to__", []) == ["tools"]
Domain
Subdomains
Source
Frequently Asked Questions
What does test_hook_config_decorator_on_class_method() do?
test_hook_config_decorator_on_class_method() is a function in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_decorators.py.
Where is test_hook_config_decorator_on_class_method() defined?
test_hook_config_decorator_on_class_method() is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_decorators.py at line 189.
What does test_hook_config_decorator_on_class_method() call?
test_hook_config_decorator_on_class_method() calls 2 function(s): after_model, before_model.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free