Home / Class/ MismatchedRequestMiddleware Class — langchain Architecture

MismatchedRequestMiddleware Class — langchain Architecture

Architecture documentation for the MismatchedRequestMiddleware class in test_middleware_type_errors.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  3f82dbf0_729c_2498_dfed_8439e89bc949["MismatchedRequestMiddleware"]
  47e0e3d7_cac1_0ec3_228a_0fd46437bc22["test_middleware_type_errors.py"]
  3f82dbf0_729c_2498_dfed_8439e89bc949 -->|defined in| 47e0e3d7_cac1_0ec3_228a_0fd46437bc22
  ba935862_45da_ff7b_2040_f79385bf070c["wrap_model_call()"]
  3f82dbf0_729c_2498_dfed_8439e89bc949 -->|method| ba935862_45da_ff7b_2040_f79385bf070c

Relationship Graph

Source Code

libs/langchain_v1/tests/unit_tests/agents/middleware_typing/test_middleware_type_errors.py lines 76–83

class MismatchedRequestMiddleware(AgentMiddleware[AgentState[Any], UserContext, Any]):
    def wrap_model_call(  # type: ignore[override]
        self,
        # TYPE ERROR: Should be ModelRequest[UserContext], not SessionContext
        request: ModelRequest[SessionContext],
        handler: Callable[[ModelRequest[SessionContext]], ModelResponse[Any]],
    ) -> ModelResponse[Any]:
        return handler(request)

Frequently Asked Questions

What is the MismatchedRequestMiddleware class?
MismatchedRequestMiddleware is a class in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/middleware_typing/test_middleware_type_errors.py.
Where is MismatchedRequestMiddleware defined?
MismatchedRequestMiddleware is defined in libs/langchain_v1/tests/unit_tests/agents/middleware_typing/test_middleware_type_errors.py at line 76.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free