Home / Function/ _calculate_nonstreaming_timeout() — anthropic-sdk-python Function Reference

_calculate_nonstreaming_timeout() — anthropic-sdk-python Function Reference

Architecture documentation for the _calculate_nonstreaming_timeout() function in _base_client.py from the anthropic-sdk-python codebase.

Entity Profile

Dependency Diagram

graph TD
  d268fdd5_9d04_3649_ef34_cf3f4c0182c6["_calculate_nonstreaming_timeout()"]
  842ce0be_ea56_b939_960f_13eb61230daf["BaseClient"]
  d268fdd5_9d04_3649_ef34_cf3f4c0182c6 -->|defined in| 842ce0be_ea56_b939_960f_13eb61230daf
  style d268fdd5_9d04_3649_ef34_cf3f4c0182c6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/anthropic/_base_client.py lines 726–739

    def _calculate_nonstreaming_timeout(self, max_tokens: int, max_nonstreaming_tokens: int | None) -> Timeout:
        maximum_time = 60 * 60
        default_time = 60 * 10

        expected_time = maximum_time * max_tokens / 128_000
        if expected_time > default_time or (max_nonstreaming_tokens and max_tokens > max_nonstreaming_tokens):
            raise ValueError(
                "Streaming is required for operations that may take longer than 10 minutes. "
                + "See https://github.com/anthropics/anthropic-sdk-python#long-requests for more details",
            )
        return Timeout(
            default_time,
            connect=5.0,
        )

Subdomains

Frequently Asked Questions

What does _calculate_nonstreaming_timeout() do?
_calculate_nonstreaming_timeout() is a function in the anthropic-sdk-python codebase, defined in src/anthropic/_base_client.py.
Where is _calculate_nonstreaming_timeout() defined?
_calculate_nonstreaming_timeout() is defined in src/anthropic/_base_client.py at line 726.

Analyze Your Own Codebase

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

Try Supermodel Free