9
9
from ... import _exceptions
10
10
from ._auth import load_auth , refresh_auth
11
11
from ._beta import Beta , AsyncBeta
12
- from ..._types import NOT_GIVEN , NotGiven , Transport , ProxiesTypes , AsyncTransport
12
+ from ..._types import NOT_GIVEN , NotGiven
13
13
from ..._utils import is_dict , asyncify , is_given
14
14
from ..._compat import model_copy , typed_cached_property
15
15
from ..._models import FinalRequestOptions
18
18
from ..._exceptions import AnthropicError , APIStatusError
19
19
from ..._base_client import (
20
20
DEFAULT_MAX_RETRIES ,
21
- DEFAULT_CONNECTION_LIMITS ,
22
21
BaseClient ,
23
22
SyncAPIClient ,
24
23
AsyncAPIClient ,
25
- SyncHttpxClientWrapper ,
26
- AsyncHttpxClientWrapper ,
27
24
)
28
25
from ...resources .messages import Messages , AsyncMessages
29
26
@@ -102,12 +99,6 @@ def __init__(
102
99
default_query : Mapping [str , object ] | None = None ,
103
100
# Configure a custom httpx client. See the [httpx documentation](https://www.python-httpx.org/api/#client) for more details.
104
101
http_client : httpx .Client | None = None ,
105
- # See httpx documentation for [custom transports](https://www.python-httpx.org/advanced/#custom-transports)
106
- transport : Transport | None = None ,
107
- # See httpx documentation for [proxies](https://www.python-httpx.org/advanced/#http-proxying)
108
- proxies : ProxiesTypes | None = None ,
109
- # See httpx documentation for [limits](https://www.python-httpx.org/advanced/#pool-limit-configuration)
110
- connection_pool_limits : httpx .Limits | None = None ,
111
102
_strict_response_validation : bool = False ,
112
103
) -> None :
113
104
if not is_given (region ):
@@ -130,9 +121,6 @@ def __init__(
130
121
custom_headers = default_headers ,
131
122
custom_query = default_query ,
132
123
http_client = http_client ,
133
- transport = transport ,
134
- proxies = proxies ,
135
- limits = connection_pool_limits ,
136
124
_strict_response_validation = _strict_response_validation ,
137
125
)
138
126
@@ -186,7 +174,6 @@ def copy(
186
174
base_url : str | httpx .URL | None = None ,
187
175
timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
188
176
http_client : httpx .Client | None = None ,
189
- connection_pool_limits : httpx .Limits | None = None ,
190
177
max_retries : int | NotGiven = NOT_GIVEN ,
191
178
default_headers : Mapping [str , str ] | None = None ,
192
179
set_default_headers : Mapping [str , str ] | None = None ,
@@ -215,23 +202,7 @@ def copy(
215
202
elif set_default_query is not None :
216
203
params = set_default_query
217
204
218
- if connection_pool_limits is not None :
219
- if http_client is not None :
220
- raise ValueError ("The 'http_client' argument is mutually exclusive with 'connection_pool_limits'" )
221
-
222
- if not isinstance (self ._client , SyncHttpxClientWrapper ):
223
- raise ValueError (
224
- "A custom HTTP client has been set and is mutually exclusive with the 'connection_pool_limits' argument"
225
- )
226
-
227
- http_client = None
228
- else :
229
- if self ._limits is not DEFAULT_CONNECTION_LIMITS :
230
- connection_pool_limits = self ._limits
231
- else :
232
- connection_pool_limits = None
233
-
234
- http_client = http_client or self ._client
205
+ http_client = http_client or self ._client
235
206
236
207
return self .__class__ (
237
208
region = region if is_given (region ) else self .region ,
@@ -270,12 +241,6 @@ def __init__(
270
241
default_query : Mapping [str , object ] | None = None ,
271
242
# Configure a custom httpx client. See the [httpx documentation](https://www.python-httpx.org/api/#client) for more details.
272
243
http_client : httpx .AsyncClient | None = None ,
273
- # See httpx documentation for [custom transports](https://www.python-httpx.org/advanced/#custom-transports)
274
- transport : AsyncTransport | None = None ,
275
- # See httpx documentation for [proxies](https://www.python-httpx.org/advanced/#http-proxying)
276
- proxies : ProxiesTypes | None = None ,
277
- # See httpx documentation for [limits](https://www.python-httpx.org/advanced/#pool-limit-configuration)
278
- connection_pool_limits : httpx .Limits | None = None ,
279
244
_strict_response_validation : bool = False ,
280
245
) -> None :
281
246
if not is_given (region ):
@@ -298,9 +263,6 @@ def __init__(
298
263
custom_headers = default_headers ,
299
264
custom_query = default_query ,
300
265
http_client = http_client ,
301
- transport = transport ,
302
- proxies = proxies ,
303
- limits = connection_pool_limits ,
304
266
_strict_response_validation = _strict_response_validation ,
305
267
)
306
268
@@ -354,7 +316,6 @@ def copy(
354
316
base_url : str | httpx .URL | None = None ,
355
317
timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
356
318
http_client : httpx .AsyncClient | None = None ,
357
- connection_pool_limits : httpx .Limits | None = None ,
358
319
max_retries : int | NotGiven = NOT_GIVEN ,
359
320
default_headers : Mapping [str , str ] | None = None ,
360
321
set_default_headers : Mapping [str , str ] | None = None ,
@@ -383,23 +344,7 @@ def copy(
383
344
elif set_default_query is not None :
384
345
params = set_default_query
385
346
386
- if connection_pool_limits is not None :
387
- if http_client is not None :
388
- raise ValueError ("The 'http_client' argument is mutually exclusive with 'connection_pool_limits'" )
389
-
390
- if not isinstance (self ._client , AsyncHttpxClientWrapper ):
391
- raise ValueError (
392
- "A custom HTTP client has been set and is mutually exclusive with the 'connection_pool_limits' argument"
393
- )
394
-
395
- http_client = None
396
- else :
397
- if self ._limits is not DEFAULT_CONNECTION_LIMITS :
398
- connection_pool_limits = self ._limits
399
- else :
400
- connection_pool_limits = None
401
-
402
- http_client = http_client or self ._client
347
+ http_client = http_client or self ._client
403
348
404
349
return self .__class__ (
405
350
region = region if is_given (region ) else self .region ,
@@ -449,7 +394,7 @@ def _prepare_options(input_options: FinalRequestOptions, *, project_id: str | No
449
394
450
395
options .url = f"/projects/{ project_id } /locations/{ region } /publishers/anthropic/models/count-tokens:rawPredict"
451
396
452
- if options .url .startswith (' /v1/messages/batches' ):
453
- raise AnthropicError (' The Batch API is not supported in the Vertex client yet' )
454
-
397
+ if options .url .startswith (" /v1/messages/batches" ):
398
+ raise AnthropicError (" The Batch API is not supported in the Vertex client yet" )
399
+
455
400
return options
0 commit comments