Home / Function/ test_retry_parameters() — langchain Function Reference

test_retry_parameters() — langchain Function Reference

Architecture documentation for the test_retry_parameters() function in test_chat_models.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  649f5111_0784_1f3d_a4a4_37de195cf39f["test_retry_parameters()"]
  9003580b_9bcf_c959_a278_ba1963301452["test_chat_models.py"]
  649f5111_0784_1f3d_a4a4_37de195cf39f -->|defined in| 9003580b_9bcf_c959_a278_ba1963301452
  style 649f5111_0784_1f3d_a4a4_37de195cf39f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/mistralai/tests/integration_tests/test_chat_models.py lines 113–147

def test_retry_parameters(caplog: pytest.LogCaptureFixture) -> None:
    """Test that retry parameters are honored in ChatMistralAI."""
    # Create a model with intentionally short timeout and multiple retries
    mistral = ChatMistralAI(
        timeout=1,  # Very short timeout to trigger timeouts
        max_retries=3,  # Should retry 3 times
    )

    # Simple test input that should take longer than 1 second to process
    test_input = "Write a 2 sentence story about a cat"

    # Measure start time
    t0 = time.time()
    logger = logging.getLogger(__name__)

    try:
        # Try to get a response
        response = mistral.invoke(test_input)

        # If successful, validate the response
        elapsed_time = time.time() - t0
        logger.info("Request succeeded in %.2f seconds", elapsed_time)
        # Check that we got a valid response
        assert response.content
        assert isinstance(response.content, str)
        assert "cat" in response.content.lower()

    except ReadTimeout:
        elapsed_time = time.time() - t0
        logger.info("Request timed out after %.2f seconds", elapsed_time)
        assert elapsed_time >= 3.0
        pytest.skip("Test timed out as expected with short timeout")
    except Exception:
        logger.exception("Unexpected exception")
        raise

Domain

Subdomains

Frequently Asked Questions

What does test_retry_parameters() do?
test_retry_parameters() is a function in the langchain codebase, defined in libs/partners/mistralai/tests/integration_tests/test_chat_models.py.
Where is test_retry_parameters() defined?
test_retry_parameters() is defined in libs/partners/mistralai/tests/integration_tests/test_chat_models.py at line 113.

Analyze Your Own Codebase

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

Try Supermodel Free