test_model_retry_failing_model_raises() — langchain Function Reference
Architecture documentation for the test_model_retry_failing_model_raises() function in test_model_retry.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD a02a4c81_5b87_0711_7816_44c867a485b5["test_model_retry_failing_model_raises()"] 6a114635_155a_5b86_2f48_fb8ca99f7545["test_model_retry.py"] a02a4c81_5b87_0711_7816_44c867a485b5 -->|defined in| 6a114635_155a_5b86_2f48_fb8ca99f7545 style a02a4c81_5b87_0711_7816_44c867a485b5 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_model_retry.py lines 203–226
def test_model_retry_failing_model_raises() -> None:
"""Test ModelRetryMiddleware with on_failure='error' re-raises exception."""
model = AlwaysFailingModel(error_message="Model error", error_type=ValueError)
retry = ModelRetryMiddleware(
max_retries=2,
initial_delay=0.01,
jitter=False,
on_failure="error",
)
agent = create_agent(
model=model,
tools=[],
middleware=[retry],
checkpointer=InMemorySaver(),
)
# Should raise the ValueError from the model
with pytest.raises(ValueError, match="Model error"):
agent.invoke(
{"messages": [HumanMessage("Hello")]},
{"configurable": {"thread_id": "test"}},
)
Domain
Subdomains
Source
Frequently Asked Questions
What does test_model_retry_failing_model_raises() do?
test_model_retry_failing_model_raises() is a function in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_model_retry.py.
Where is test_model_retry_failing_model_raises() defined?
test_model_retry_failing_model_raises() is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_model_retry.py at line 203.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free