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

__init__() — anthropic-sdk-python Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  86791f8b_40ce_c991_4689_7abd6c6ba63d["__init__()"]
  a96b76ba_8027_bd6b_8747_23d68b1a6cbe["AsyncAnthropicBedrock"]
  86791f8b_40ce_c991_4689_7abd6c6ba63d -->|defined in| a96b76ba_8027_bd6b_8747_23d68b1a6cbe
  898388b8_6a9d_318b_f831_38ab3b6ec302["_infer_region()"]
  86791f8b_40ce_c991_4689_7abd6c6ba63d -->|calls| 898388b8_6a9d_318b_f831_38ab3b6ec302
  style 86791f8b_40ce_c991_4689_7abd6c6ba63d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/anthropic/lib/bedrock/_client.py lines 278–329

    def __init__(
        self,
        aws_secret_key: str | None = None,
        aws_access_key: str | None = None,
        aws_region: str | None = None,
        aws_profile: str | None = None,
        aws_session_token: str | None = None,
        base_url: str | httpx.URL | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
        max_retries: int = DEFAULT_MAX_RETRIES,
        default_headers: Mapping[str, str] | None = None,
        default_query: Mapping[str, object] | None = None,
        # Configure a custom httpx client. See the [httpx documentation](https://www.python-httpx.org/api/#client) for more details.
        http_client: httpx.AsyncClient | None = None,
        # Enable or disable schema validation for data returned by the API.
        # When enabled an error APIResponseValidationError is raised
        # if the API responds with invalid data for the expected schema.
        #
        # This parameter may be removed or changed in the future.
        # If you rely on this feature, please open a GitHub issue
        # outlining your use-case to help us decide if it should be
        # part of our public interface in the future.
        _strict_response_validation: bool = False,
    ) -> None:
        self.aws_secret_key = aws_secret_key

        self.aws_access_key = aws_access_key

        self.aws_region = _infer_region() if aws_region is None else aws_region
        self.aws_profile = aws_profile

        self.aws_session_token = aws_session_token

        if base_url is None:
            base_url = os.environ.get("ANTHROPIC_BEDROCK_BASE_URL")
        if base_url is None:
            base_url = f"https://bedrock-runtime.{self.aws_region}.amazonaws.com"

        super().__init__(
            version=__version__,
            base_url=base_url,
            timeout=timeout,
            max_retries=max_retries,
            custom_headers=default_headers,
            custom_query=default_query,
            http_client=http_client,
            _strict_response_validation=_strict_response_validation,
        )

        self.messages = AsyncMessages(self)
        self.completions = AsyncCompletions(self)
        self.beta = AsyncBeta(self)

Subdomains

Frequently Asked Questions

What does __init__() do?
__init__() is a function in the anthropic-sdk-python codebase, defined in src/anthropic/lib/bedrock/_client.py.
Where is __init__() defined?
__init__() is defined in src/anthropic/lib/bedrock/_client.py at line 278.
What does __init__() call?
__init__() calls 1 function(s): _infer_region.

Analyze Your Own Codebase

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

Try Supermodel Free