Home / File/ foundry.py — anthropic-sdk-python Source File

foundry.py — anthropic-sdk-python Source File

Architecture documentation for foundry.py, a python file in the anthropic-sdk-python codebase. 17 imports, 0 dependents.

File python AnthropicClient AsyncAPI 17 imports 10 classes

Entity Profile

Dependency Diagram

graph LR
  28707db8_9678_34e5_eb77_ee47156aa183["foundry.py"]
  b39817e4_aad6_041a_fe95_e3025b6a7382["_types"]
  28707db8_9678_34e5_eb77_ee47156aa183 --> b39817e4_aad6_041a_fe95_e3025b6a7382
  8d1d3b1f_a6c7_1746_fc57_9add8386ca77["_utils"]
  28707db8_9678_34e5_eb77_ee47156aa183 --> 8d1d3b1f_a6c7_1746_fc57_9add8386ca77
  162ed12b_9fea_fcce_78d8_8ed69f72cdcd["_client"]
  28707db8_9678_34e5_eb77_ee47156aa183 --> 162ed12b_9fea_fcce_78d8_8ed69f72cdcd
  9c3449c7_1f6e_5026_774a_d461722f1b2d["_compat"]
  28707db8_9678_34e5_eb77_ee47156aa183 --> 9c3449c7_1f6e_5026_774a_d461722f1b2d
  aa4ec452_6100_d630_542d_bab364e72729["_models"]
  28707db8_9678_34e5_eb77_ee47156aa183 --> aa4ec452_6100_d630_542d_bab364e72729
  37a12671_d05b_d8b9_e97c_a68f52bec11f["_streaming"]
  28707db8_9678_34e5_eb77_ee47156aa183 --> 37a12671_d05b_d8b9_e97c_a68f52bec11f
  b72a8135_94f0_00ad_3c3b_a2abd6a9a0db["_exceptions"]
  28707db8_9678_34e5_eb77_ee47156aa183 --> b72a8135_94f0_00ad_3c3b_a2abd6a9a0db
  9fac49b5_d9cf_9fe7_f59f_8dcd23d2e861["_base_client"]
  28707db8_9678_34e5_eb77_ee47156aa183 --> 9fac49b5_d9cf_9fe7_f59f_8dcd23d2e861
  15b5441e_2fe5_3a60_41bf_4ed74fcb781b["resources.beta"]
  28707db8_9678_34e5_eb77_ee47156aa183 --> 15b5441e_2fe5_3a60_41bf_4ed74fcb781b
  5e15fa53_15ab_b7c4_80af_2f6467a18131["resources.messages"]
  28707db8_9678_34e5_eb77_ee47156aa183 --> 5e15fa53_15ab_b7c4_80af_2f6467a18131
  32f90967_9b2b_acad_a25f_4490a6ec98d5["resources.beta.messages"]
  28707db8_9678_34e5_eb77_ee47156aa183 --> 32f90967_9b2b_acad_a25f_4490a6ec98d5
  bb0af148_44a9_df40_49c4_0fa6ceb5a403["os"]
  28707db8_9678_34e5_eb77_ee47156aa183 --> bb0af148_44a9_df40_49c4_0fa6ceb5a403
  506d0594_2a0d_4f14_1041_ed428dcfcac8["inspect"]
  28707db8_9678_34e5_eb77_ee47156aa183 --> 506d0594_2a0d_4f14_1041_ed428dcfcac8
  89ddcdd7_3ae1_4c7b_41bb_9f1e25f16875["typing"]
  28707db8_9678_34e5_eb77_ee47156aa183 --> 89ddcdd7_3ae1_4c7b_41bb_9f1e25f16875
  style 28707db8_9678_34e5_eb77_ee47156aa183 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

from __future__ import annotations

import os
import inspect
from typing import Any, Union, Mapping, TypeVar, Callable, Awaitable, cast, overload
from functools import cached_property
from typing_extensions import Self, override

import httpx

from .._types import NOT_GIVEN, Omit, Timeout, NotGiven
from .._utils import is_given
from .._client import Anthropic, AsyncAnthropic
from .._compat import model_copy
from .._models import FinalRequestOptions
from .._streaming import Stream, AsyncStream
from .._exceptions import AnthropicError
from .._base_client import DEFAULT_MAX_RETRIES, BaseClient
from ..resources.beta import Beta, AsyncBeta
from ..resources.messages import Messages, AsyncMessages
from ..resources.beta.messages import Messages as BetaMessages, AsyncMessages as AsyncBetaMessages

AzureADTokenProvider = Callable[[], str]
AsyncAzureADTokenProvider = Callable[[], "str | Awaitable[str]"]
_HttpxClientT = TypeVar("_HttpxClientT", bound=Union[httpx.Client, httpx.AsyncClient])
_DefaultStreamT = TypeVar("_DefaultStreamT", bound=Union[Stream[Any], AsyncStream[Any]])


class MutuallyExclusiveAuthError(AnthropicError):
    def __init__(self) -> None:
        super().__init__(
            "The `api_key` and `azure_ad_token_provider` arguments are mutually exclusive; Only one can be passed at a time"
        )


class BaseFoundryClient(BaseClient[_HttpxClientT, _DefaultStreamT]): ...


class MessagesFoundry(Messages):
    @cached_property
    @override
    def batches(self) -> None:  # type: ignore[override]
        """Batches endpoint is not supported for Anthropic Foundry client."""
        return None


class BetaFoundryMessages(BetaMessages):
    @cached_property
    @override
    def batches(self) -> None:  # type: ignore[override]
        """Batches endpoint is not supported for Anthropic Foundry client."""
        return None


class BetaFoundry(Beta):
    @cached_property
    @override
    def messages(self) -> BetaMessages:  # type: ignore[override]
        """Return beta messages resource instance with excluded unsupported endpoints."""
        return BetaFoundryMessages(self._client)
// ... (384 more lines)

Subdomains

Dependencies

  • _base_client
  • _client
  • _compat
  • _exceptions
  • _models
  • _streaming
  • _types
  • _utils
  • functools
  • httpx
  • inspect
  • os
  • resources.beta
  • resources.beta.messages
  • resources.messages
  • typing
  • typing_extensions

Frequently Asked Questions

What does foundry.py do?
foundry.py is a source file in the anthropic-sdk-python codebase, written in python. It belongs to the AnthropicClient domain, AsyncAPI subdomain.
What does foundry.py depend on?
foundry.py imports 17 module(s): _base_client, _client, _compat, _exceptions, _models, _streaming, _types, _utils, and 9 more.
Where is foundry.py in the architecture?
foundry.py is located at src/anthropic/lib/foundry.py (domain: AnthropicClient, subdomain: AsyncAPI, directory: src/anthropic/lib).

Analyze Your Own Codebase

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

Try Supermodel Free