|
1 | 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. |
2 | 2 |
|
| 3 | +from __future__ import annotations |
| 4 | + |
3 | 5 | import typing as _t |
4 | 6 |
|
5 | | -from . import types |
6 | 7 | from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes, omit, not_given |
7 | 8 | from ._utils import file_from_path |
8 | 9 | from ._client import ( |
|
45 | 46 | ) |
46 | 47 | from ._base_client import DefaultHttpxClient, DefaultAioHttpClient, DefaultAsyncHttpxClient |
47 | 48 | from ._utils._logs import setup_logging as _setup_logging |
48 | | -from .lib._parse._transform import transform_schema |
| 49 | + |
| 50 | +if _t.TYPE_CHECKING: |
| 51 | + from . import types as types |
| 52 | + from .lib.aws import AnthropicAWS as AnthropicAWS, AsyncAnthropicAWS as AsyncAnthropicAWS |
| 53 | + from .lib.tools import beta_tool as beta_tool, beta_async_tool as beta_async_tool |
| 54 | + from .lib.vertex import AnthropicVertex as AnthropicVertex, AsyncAnthropicVertex as AsyncAnthropicVertex |
| 55 | + from .lib.bedrock import ( |
| 56 | + AnthropicBedrock as AnthropicBedrock, |
| 57 | + AsyncAnthropicBedrock as AsyncAnthropicBedrock, |
| 58 | + AnthropicBedrockMantle as AnthropicBedrockMantle, |
| 59 | + AsyncAnthropicBedrockMantle as AsyncAnthropicBedrockMantle, |
| 60 | + ) |
| 61 | + from .lib.foundry import AnthropicFoundry as AnthropicFoundry, AsyncAnthropicFoundry as AsyncAnthropicFoundry |
| 62 | + from .lib.streaming import ( |
| 63 | + TextEvent as TextEvent, |
| 64 | + BetaTextEvent as BetaTextEvent, |
| 65 | + MessageStream as MessageStream, |
| 66 | + InputJsonEvent as InputJsonEvent, |
| 67 | + MessageStopEvent as MessageStopEvent, |
| 68 | + BetaMessageStream as BetaMessageStream, |
| 69 | + AsyncMessageStream as AsyncMessageStream, |
| 70 | + BetaInputJsonEvent as BetaInputJsonEvent, |
| 71 | + MessageStreamEvent as MessageStreamEvent, |
| 72 | + ParsedBetaTextEvent as ParsedBetaTextEvent, |
| 73 | + MessageStreamManager as MessageStreamManager, |
| 74 | + ContentBlockStopEvent as ContentBlockStopEvent, |
| 75 | + BetaAsyncMessageStream as BetaAsyncMessageStream, |
| 76 | + BetaMessageStreamEvent as BetaMessageStreamEvent, |
| 77 | + ParsedMessageStopEvent as ParsedMessageStopEvent, |
| 78 | + BetaMessageStreamManager as BetaMessageStreamManager, |
| 79 | + ParsedMessageStreamEvent as ParsedMessageStreamEvent, |
| 80 | + AsyncMessageStreamManager as AsyncMessageStreamManager, |
| 81 | + BetaContentBlockStopEvent as BetaContentBlockStopEvent, |
| 82 | + ParsedBetaMessageStopEvent as ParsedBetaMessageStopEvent, |
| 83 | + ParsedContentBlockStopEvent as ParsedContentBlockStopEvent, |
| 84 | + ParsedBetaMessageStreamEvent as ParsedBetaMessageStreamEvent, |
| 85 | + BetaAsyncMessageStreamManager as BetaAsyncMessageStreamManager, |
| 86 | + ParsedBetaContentBlockStopEvent as ParsedBetaContentBlockStopEvent, |
| 87 | + ) |
| 88 | + from .lib.credentials import ( |
| 89 | + EnvToken as EnvToken, |
| 90 | + TokenCache as TokenCache, |
| 91 | + AccessToken as AccessToken, |
| 92 | + StaticToken as StaticToken, |
| 93 | + InMemoryConfig as InMemoryConfig, |
| 94 | + AccessTokenAuth as AccessTokenAuth, |
| 95 | + CredentialsFile as CredentialsFile, |
| 96 | + CredentialResult as CredentialResult, |
| 97 | + IdentityTokenFile as IdentityTokenFile, |
| 98 | + AccessTokenProvider as AccessTokenProvider, |
| 99 | + IdentityTokenProvider as IdentityTokenProvider, |
| 100 | + WorkloadIdentityError as WorkloadIdentityError, |
| 101 | + WorkloadIdentityCredentials as WorkloadIdentityCredentials, |
| 102 | + default_credentials as default_credentials, |
| 103 | + exchange_federation_assertion as exchange_federation_assertion, |
| 104 | + ) |
| 105 | + from .lib._parse._transform import transform_schema as transform_schema |
| 106 | + from ._utils._resources_proxy import resources as resources |
49 | 107 |
|
50 | 108 | __all__ = [ |
51 | 109 | "types", |
|
100 | 158 | if not _t.TYPE_CHECKING: |
101 | 159 | from ._utils._resources_proxy import resources as resources |
102 | 160 |
|
103 | | -from .lib.aws import AnthropicAWS as AnthropicAWS, AsyncAnthropicAWS as AsyncAnthropicAWS |
104 | | -from .lib.tools import beta_tool, beta_async_tool |
105 | | -from .lib.vertex import * |
106 | | -from .lib.bedrock import * |
107 | | -from .lib.foundry import AnthropicFoundry as AnthropicFoundry, AsyncAnthropicFoundry as AsyncAnthropicFoundry |
108 | | -from .lib.streaming import * |
109 | | -from .lib.credentials import * |
| 161 | +_LAZY_ATTRS: dict[str, tuple[str, str | None]] = { |
| 162 | + "types": (".types", None), |
| 163 | + "AnthropicAWS": (".lib.aws", "AnthropicAWS"), |
| 164 | + "AsyncAnthropicAWS": (".lib.aws", "AsyncAnthropicAWS"), |
| 165 | + "beta_tool": (".lib.tools", "beta_tool"), |
| 166 | + "beta_async_tool": (".lib.tools", "beta_async_tool"), |
| 167 | + "AnthropicVertex": (".lib.vertex", "AnthropicVertex"), |
| 168 | + "AsyncAnthropicVertex": (".lib.vertex", "AsyncAnthropicVertex"), |
| 169 | + "AnthropicBedrock": (".lib.bedrock", "AnthropicBedrock"), |
| 170 | + "AsyncAnthropicBedrock": (".lib.bedrock", "AsyncAnthropicBedrock"), |
| 171 | + "AnthropicBedrockMantle": (".lib.bedrock", "AnthropicBedrockMantle"), |
| 172 | + "AsyncAnthropicBedrockMantle": (".lib.bedrock", "AsyncAnthropicBedrockMantle"), |
| 173 | + "AnthropicFoundry": (".lib.foundry", "AnthropicFoundry"), |
| 174 | + "AsyncAnthropicFoundry": (".lib.foundry", "AsyncAnthropicFoundry"), |
| 175 | + "TextEvent": (".lib.streaming", "TextEvent"), |
| 176 | + "InputJsonEvent": (".lib.streaming", "InputJsonEvent"), |
| 177 | + "MessageStream": (".lib.streaming", "MessageStream"), |
| 178 | + "BetaTextEvent": (".lib.streaming", "BetaTextEvent"), |
| 179 | + "AsyncMessageStream": (".lib.streaming", "AsyncMessageStream"), |
| 180 | + "MessageStopEvent": (".lib.streaming", "MessageStopEvent"), |
| 181 | + "MessageStreamEvent": (".lib.streaming", "MessageStreamEvent"), |
| 182 | + "BetaInputJsonEvent": (".lib.streaming", "BetaInputJsonEvent"), |
| 183 | + "MessageStreamManager": (".lib.streaming", "MessageStreamManager"), |
| 184 | + "ContentBlockStopEvent": (".lib.streaming", "ContentBlockStopEvent"), |
| 185 | + "ParsedBetaTextEvent": (".lib.streaming", "ParsedBetaTextEvent"), |
| 186 | + "BetaMessageStream": (".lib.streaming", "BetaMessageStream"), |
| 187 | + "BetaAsyncMessageStream": (".lib.streaming", "BetaAsyncMessageStream"), |
| 188 | + "AsyncMessageStreamManager": (".lib.streaming", "AsyncMessageStreamManager"), |
| 189 | + "BetaMessageStreamEvent": (".lib.streaming", "BetaMessageStreamEvent"), |
| 190 | + "ParsedMessageStopEvent": (".lib.streaming", "ParsedMessageStopEvent"), |
| 191 | + "BetaMessageStreamManager": (".lib.streaming", "BetaMessageStreamManager"), |
| 192 | + "ParsedMessageStreamEvent": (".lib.streaming", "ParsedMessageStreamEvent"), |
| 193 | + "BetaContentBlockStopEvent": (".lib.streaming", "BetaContentBlockStopEvent"), |
| 194 | + "ParsedBetaMessageStopEvent": (".lib.streaming", "ParsedBetaMessageStopEvent"), |
| 195 | + "ParsedContentBlockStopEvent": (".lib.streaming", "ParsedContentBlockStopEvent"), |
| 196 | + "BetaAsyncMessageStreamManager": (".lib.streaming", "BetaAsyncMessageStreamManager"), |
| 197 | + "ParsedBetaMessageStreamEvent": (".lib.streaming", "ParsedBetaMessageStreamEvent"), |
| 198 | + "ParsedBetaContentBlockStopEvent": (".lib.streaming", "ParsedBetaContentBlockStopEvent"), |
| 199 | + "EnvToken": (".lib.credentials", "EnvToken"), |
| 200 | + "TokenCache": (".lib.credentials", "TokenCache"), |
| 201 | + "AccessToken": (".lib.credentials", "AccessToken"), |
| 202 | + "StaticToken": (".lib.credentials", "StaticToken"), |
| 203 | + "AccessTokenAuth": (".lib.credentials", "AccessTokenAuth"), |
| 204 | + "InMemoryConfig": (".lib.credentials", "InMemoryConfig"), |
| 205 | + "CredentialsFile": (".lib.credentials", "CredentialsFile"), |
| 206 | + "CredentialResult": (".lib.credentials", "CredentialResult"), |
| 207 | + "IdentityTokenFile": (".lib.credentials", "IdentityTokenFile"), |
| 208 | + "AccessTokenProvider": (".lib.credentials", "AccessTokenProvider"), |
| 209 | + "default_credentials": (".lib.credentials", "default_credentials"), |
| 210 | + "IdentityTokenProvider": (".lib.credentials", "IdentityTokenProvider"), |
| 211 | + "WorkloadIdentityError": (".lib.credentials", "WorkloadIdentityError"), |
| 212 | + "WorkloadIdentityCredentials": (".lib.credentials", "WorkloadIdentityCredentials"), |
| 213 | + "exchange_federation_assertion": (".lib.credentials", "exchange_federation_assertion"), |
| 214 | + "transform_schema": (".lib._parse._transform", "transform_schema"), |
| 215 | +} |
| 216 | + |
| 217 | + |
| 218 | +def __getattr__(name: str) -> _t.Any: |
| 219 | + if name not in _LAZY_ATTRS: |
| 220 | + raise AttributeError(f"module {__name__!r} has no attribute {name!r}") |
| 221 | + |
| 222 | + import importlib |
| 223 | + |
| 224 | + module_name, attr_name = _LAZY_ATTRS[name] |
| 225 | + module = importlib.import_module(module_name, __name__) |
| 226 | + attr = module if attr_name is None else getattr(module, attr_name) |
| 227 | + globals()[name] = attr |
| 228 | + |
| 229 | + try: |
| 230 | + attr.__module__ = "anthropic" |
| 231 | + except (TypeError, AttributeError): |
| 232 | + pass |
| 233 | + |
| 234 | + return attr |
| 235 | + |
110 | 236 |
|
111 | 237 | _setup_logging() |
112 | 238 |
|
|
119 | 245 | if not __name.startswith("__"): |
120 | 246 | try: |
121 | 247 | __locals[__name].__module__ = "anthropic" |
| 248 | + except KeyError: |
| 249 | + pass |
122 | 250 | except (TypeError, AttributeError): |
123 | 251 | # Some of our exported symbols are builtins which we can't set attributes for. |
124 | 252 | pass |
0 commit comments