test_decorator_returns_wrap_result() — langchain Function Reference
Architecture documentation for the test_decorator_returns_wrap_result() function in test_wrap_model_call_state_update.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD b7bc4ef2_62f9_b69f_d927_a3b579a6bb33["test_decorator_returns_wrap_result()"] 269d8393_43ba_e665_6d86_95d75ce0c396["TestComposition"] b7bc4ef2_62f9_b69f_d927_a3b579a6bb33 -->|defined in| 269d8393_43ba_e665_6d86_95d75ce0c396 style b7bc4ef2_62f9_b69f_d927_a3b579a6bb33 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_wrap_model_call_state_update.py lines 580–608
def test_decorator_returns_wrap_result(self) -> None:
"""@wrap_model_call decorator can return ExtendedModelResponse with command."""
@wrap_model_call
def command_middleware(
request: ModelRequest,
handler: Callable[[ModelRequest], ModelResponse],
) -> ExtendedModelResponse:
response = handler(request)
return ExtendedModelResponse(
model_response=response,
command=Command(
update={
"messages": [
HumanMessage(content="From decorator", id="dec"),
]
}
),
)
model = GenericFakeChatModel(messages=iter([AIMessage(content="Model response")]))
agent = create_agent(model=model, middleware=[command_middleware])
result = agent.invoke({"messages": [HumanMessage("Hi")]})
messages = result["messages"]
assert len(messages) == 3
assert messages[1].content == "Model response"
assert messages[2].content == "From decorator"
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does test_decorator_returns_wrap_result() do?
test_decorator_returns_wrap_result() is a function in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_wrap_model_call_state_update.py.
Where is test_decorator_returns_wrap_result() defined?
test_decorator_returns_wrap_result() is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_wrap_model_call_state_update.py at line 580.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free