Home / Function/ test_model_response_return_unchanged() — langchain Function Reference

test_model_response_return_unchanged() — langchain Function Reference

Architecture documentation for the test_model_response_return_unchanged() function in test_wrap_model_call_state_update.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  36204887_ef1c_7118_b2dc_38c1c6574b66["test_model_response_return_unchanged()"]
  2bf07a68_4a56_38b0_435c_b9917d8b0fd3["TestBackwardsCompatibility"]
  36204887_ef1c_7118_b2dc_38c1c6574b66 -->|defined in| 2bf07a68_4a56_38b0_435c_b9917d8b0fd3
  style 36204887_ef1c_7118_b2dc_38c1c6574b66 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 201–218

    def test_model_response_return_unchanged(self) -> None:
        """Existing middleware returning ModelResponse works identically."""

        class PassthroughMiddleware(AgentMiddleware):
            def wrap_model_call(
                self,
                request: ModelRequest,
                handler: Callable[[ModelRequest], ModelResponse],
            ) -> ModelResponse:
                return handler(request)

        model = GenericFakeChatModel(messages=iter([AIMessage(content="Hello")]))
        agent = create_agent(model=model, middleware=[PassthroughMiddleware()])

        result = agent.invoke({"messages": [HumanMessage("Hi")]})

        assert len(result["messages"]) == 2
        assert result["messages"][1].content == "Hello"

Domain

Subdomains

Frequently Asked Questions

What does test_model_response_return_unchanged() do?
test_model_response_return_unchanged() 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_model_response_return_unchanged() defined?
test_model_response_return_unchanged() is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_wrap_model_call_state_update.py at line 201.

Analyze Your Own Codebase

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

Try Supermodel Free