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

copy() — anthropic-sdk-python Function Reference

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

Function python AnthropicClient SyncAPI calls 1 called by 1

Entity Profile

Dependency Diagram

graph TD
  7d88f9ba_782d_b203_6007_9c1dee5c62ea["copy()"]
  52b957ca_f6e2_8cc2_8b0b_1f00048d1b4f["AnthropicBedrock"]
  7d88f9ba_782d_b203_6007_9c1dee5c62ea -->|defined in| 52b957ca_f6e2_8cc2_8b0b_1f00048d1b4f
  371ed11a_c027_e563_426e_e3d8865425fd["copy()"]
  371ed11a_c027_e563_426e_e3d8865425fd -->|calls| 7d88f9ba_782d_b203_6007_9c1dee5c62ea
  371ed11a_c027_e563_426e_e3d8865425fd["copy()"]
  7d88f9ba_782d_b203_6007_9c1dee5c62ea -->|calls| 371ed11a_c027_e563_426e_e3d8865425fd
  style 7d88f9ba_782d_b203_6007_9c1dee5c62ea fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/anthropic/lib/bedrock/_client.py lines 216–266

    def copy(
        self,
        *,
        aws_secret_key: str | None = None,
        aws_access_key: str | None = None,
        aws_region: str | None = None,
        aws_session_token: str | None = None,
        base_url: str | httpx.URL | None = None,
        timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
        http_client: httpx.Client | None = None,
        max_retries: int | NotGiven = NOT_GIVEN,
        default_headers: Mapping[str, str] | None = None,
        set_default_headers: Mapping[str, str] | None = None,
        default_query: Mapping[str, object] | None = None,
        set_default_query: Mapping[str, object] | None = None,
        _extra_kwargs: Mapping[str, Any] = {},
    ) -> Self:
        """
        Create a new client instance re-using the same options given to the current client with optional overriding.
        """
        if default_headers is not None and set_default_headers is not None:
            raise ValueError("The `default_headers` and `set_default_headers` arguments are mutually exclusive")

        if default_query is not None and set_default_query is not None:
            raise ValueError("The `default_query` and `set_default_query` arguments are mutually exclusive")

        headers = self._custom_headers
        if default_headers is not None:
            headers = {**headers, **default_headers}
        elif set_default_headers is not None:
            headers = set_default_headers

        params = self._custom_query
        if default_query is not None:
            params = {**params, **default_query}
        elif set_default_query is not None:
            params = set_default_query

        return self.__class__(
            aws_secret_key=aws_secret_key or self.aws_secret_key,
            aws_access_key=aws_access_key or self.aws_access_key,
            aws_region=aws_region or self.aws_region,
            aws_session_token=aws_session_token or self.aws_session_token,
            base_url=base_url or self.base_url,
            timeout=self.timeout if isinstance(timeout, NotGiven) else timeout,
            http_client=http_client,
            max_retries=max_retries if is_given(max_retries) else self.max_retries,
            default_headers=headers,
            default_query=params,
            **_extra_kwargs,
        )

Subdomains

Calls

Called By

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free