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

__init__() — anthropic-sdk-python Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  eb7eebdb_2b36_d8b3_8894_5676fc49202f["__init__()"]
  842ce0be_ea56_b939_960f_13eb61230daf["BaseClient"]
  eb7eebdb_2b36_d8b3_8894_5676fc49202f -->|defined in| 842ce0be_ea56_b939_960f_13eb61230daf
  1ca77086_160d_5755_68b6_1a9bcd328911["_enforce_trailing_slash()"]
  eb7eebdb_2b36_d8b3_8894_5676fc49202f -->|calls| 1ca77086_160d_5755_68b6_1a9bcd328911
  style eb7eebdb_2b36_d8b3_8894_5676fc49202f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/anthropic/_base_client.py lines 378–402

    def __init__(
        self,
        *,
        version: str,
        base_url: str | URL,
        _strict_response_validation: bool,
        max_retries: int = DEFAULT_MAX_RETRIES,
        timeout: float | Timeout | None = DEFAULT_TIMEOUT,
        custom_headers: Mapping[str, str] | None = None,
        custom_query: Mapping[str, object] | None = None,
    ) -> None:
        self._version = version
        self._base_url = self._enforce_trailing_slash(URL(base_url))
        self.max_retries = max_retries
        self.timeout = timeout
        self._custom_headers = custom_headers or {}
        self._custom_query = custom_query or {}
        self._strict_response_validation = _strict_response_validation
        self._idempotency_header = None
        self._platform: Platform | None = None

        if max_retries is None:  # pyright: ignore[reportUnnecessaryComparison]
            raise TypeError(
                "max_retries cannot be None. If you want to disable retries, pass `0`; if you want unlimited retries, pass `math.inf` or a very high number; if you want the default behavior, pass `anthropic.DEFAULT_MAX_RETRIES`"
            )

Subdomains

Frequently Asked Questions

What does __init__() do?
__init__() is a function in the anthropic-sdk-python codebase, defined in src/anthropic/_base_client.py.
Where is __init__() defined?
__init__() is defined in src/anthropic/_base_client.py at line 378.
What does __init__() call?
__init__() calls 1 function(s): _enforce_trailing_slash.

Analyze Your Own Codebase

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

Try Supermodel Free