Home / Function/ test_no_retry_propagates_error() — langchain Function Reference

test_no_retry_propagates_error() — langchain Function Reference

Architecture documentation for the test_no_retry_propagates_error() function in test_wrap_model_call.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  853e8053_a1bc_555e_641b_7290843523a6["test_no_retry_propagates_error()"]
  1c3bae87_d793_bb0b_1a39_594b67feb9d4["TestRetryLogic"]
  853e8053_a1bc_555e_641b_7290843523a6 -->|defined in| 1c3bae87_d793_bb0b_1a39_594b67feb9d4
  0c6a77a0_b896_2b90_e50b_5498727d67ab["_llm_type()"]
  853e8053_a1bc_555e_641b_7290843523a6 -->|calls| 0c6a77a0_b896_2b90_e50b_5498727d67ab
  style 853e8053_a1bc_555e_641b_7290843523a6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_wrap_model_call.py lines 201–233

    def test_no_retry_propagates_error(self) -> None:
        """Test that error is propagated when middleware doesn't retry."""

        class FailingModel(BaseChatModel):
            """Model that always fails."""

            @override
            def _generate(
                self,
                messages: list[BaseMessage],
                stop: list[str] | None = None,
                run_manager: CallbackManagerForLLMRun | None = None,
                **kwargs: Any,
            ) -> ChatResult:
                msg = "Model error"
                raise ValueError(msg)

            @property
            def _llm_type(self) -> str:
                return "failing"

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

        agent = create_agent(model=FailingModel(), middleware=[NoRetryMiddleware()])

        with pytest.raises(ValueError, match="Model error"):
            agent.invoke({"messages": [HumanMessage("Test")]})

Domain

Subdomains

Calls

Frequently Asked Questions

What does test_no_retry_propagates_error() do?
test_no_retry_propagates_error() is a function in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_wrap_model_call.py.
Where is test_no_retry_propagates_error() defined?
test_no_retry_propagates_error() is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_wrap_model_call.py at line 201.
What does test_no_retry_propagates_error() call?
test_no_retry_propagates_error() calls 1 function(s): _llm_type.

Analyze Your Own Codebase

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

Try Supermodel Free