OverrideMiddleware Class — langchain Architecture
Architecture documentation for the OverrideMiddleware class in test_wrap_model_call_state_update.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 6a62e52a_9351_68cb_86d4_e269ae299227["OverrideMiddleware"] 949c7cf4_56fe_f3b4_cd89_9631a7e9cb1e["AgentMiddleware"] 6a62e52a_9351_68cb_86d4_e269ae299227 -->|extends| 949c7cf4_56fe_f3b4_cd89_9631a7e9cb1e 08361e76_a995_1e57_f200_e292474e2f00["test_wrap_model_call_state_update.py"] 6a62e52a_9351_68cb_86d4_e269ae299227 -->|defined in| 08361e76_a995_1e57_f200_e292474e2f00 ecc17116_2c81_52ac_da33_bfbae6d3487b["wrap_model_call()"] 6a62e52a_9351_68cb_86d4_e269ae299227 -->|method| ecc17116_2c81_52ac_da33_bfbae6d3487b
Relationship Graph
Source Code
libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_wrap_model_call_state_update.py lines 87–105
class OverrideMiddleware(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={"from": "model"},
)
return ExtendedModelResponse(
model_response=response_with_structured,
command=Command(
update={
"structured_response": {"from": "command"},
}
),
)
Defined In
Extends
Source
Frequently Asked Questions
What is the OverrideMiddleware class?
OverrideMiddleware 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 OverrideMiddleware defined?
OverrideMiddleware is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_wrap_model_call_state_update.py at line 87.
What does OverrideMiddleware extend?
OverrideMiddleware extends AgentMiddleware.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free