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
  b236dbaf_763e_a93f_2228_184f29f8884a["copy()"]
  5fb2d3b6_3351_6580_364d_089a42b38b46["AnthropicVertex"]
  b236dbaf_763e_a93f_2228_184f29f8884a -->|defined in| 5fb2d3b6_3351_6580_364d_089a42b38b46
  36d0becb_82f8_5e48_ffe9_ad9bc847f367["copy()"]
  36d0becb_82f8_5e48_ffe9_ad9bc847f367 -->|calls| b236dbaf_763e_a93f_2228_184f29f8884a
  36d0becb_82f8_5e48_ffe9_ad9bc847f367["copy()"]
  b236dbaf_763e_a93f_2228_184f29f8884a -->|calls| 36d0becb_82f8_5e48_ffe9_ad9bc847f367
  style b236dbaf_763e_a93f_2228_184f29f8884a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/anthropic/lib/vertex/_client.py lines 176–228

    def copy(
        self,
        *,
        region: str | NotGiven = NOT_GIVEN,
        project_id: str | NotGiven = NOT_GIVEN,
        access_token: str | None = None,
        credentials: GoogleCredentials | None = None,
        base_url: str | httpx.URL | None = None,
        timeout: float | httpx.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

        http_client = http_client or self._client

        return self.__class__(
            region=region if is_given(region) else self.region,
            project_id=project_id if is_given(project_id) else self.project_id or NOT_GIVEN,
            access_token=access_token or self.access_token,
            credentials=credentials or self.credentials,
            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/vertex/_client.py.
Where is copy() defined?
copy() is defined in src/anthropic/lib/vertex/_client.py at line 176.
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