StructuredMiddleware Class — langchain Architecture
Architecture documentation for the StructuredMiddleware class in test_wrap_model_call_state_update.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 76699f6f_3f6f_b620_d4bc_c75f91d80b20["StructuredMiddleware"] 949c7cf4_56fe_f3b4_cd89_9631a7e9cb1e["AgentMiddleware"] 76699f6f_3f6f_b620_d4bc_c75f91d80b20 -->|extends| 949c7cf4_56fe_f3b4_cd89_9631a7e9cb1e 08361e76_a995_1e57_f200_e292474e2f00["test_wrap_model_call_state_update.py"] 76699f6f_3f6f_b620_d4bc_c75f91d80b20 -->|defined in| 08361e76_a995_1e57_f200_e292474e2f00 8baac756_dcec_8c6a_e27b_64e0fa0d2d6d["wrap_model_call()"] 76699f6f_3f6f_b620_d4bc_c75f91d80b20 -->|method| 8baac756_dcec_8c6a_e27b_64e0fa0d2d6d
Relationship Graph
Source Code
libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_wrap_model_call_state_update.py lines 613–626
class StructuredMiddleware(AgentMiddleware):
def wrap_model_call(
self,
request: ModelRequest,
handler: Callable[[ModelRequest], ModelResponse],
) -> ExtendedModelResponse:
response = handler(request)
response_with_structured = ModelResponse(
result=response.result,
structured_response={"key": "value"},
)
return ExtendedModelResponse(
model_response=response_with_structured,
)
Defined In
Extends
Source
Frequently Asked Questions
What is the StructuredMiddleware class?
StructuredMiddleware is a class in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_wrap_model_call_state_update.py.
Where is StructuredMiddleware defined?
StructuredMiddleware is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_wrap_model_call_state_update.py at line 613.
What does StructuredMiddleware extend?
StructuredMiddleware extends AgentMiddleware.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free