3131)
3232
3333if TYPE_CHECKING :
34- from .resources import (
35- auth ,
36- agents ,
37- models ,
38- regions ,
39- api_keys ,
40- providers ,
41- embeddings ,
42- indexing_jobs ,
43- knowledge_bases ,
44- )
34+ from .resources import agents , models , regions , api_keys , providers , indexing_jobs , knowledge_bases
4535 from .resources .models import ModelsResource , AsyncModelsResource
4636 from .resources .regions import RegionsResource , AsyncRegionsResource
47- from .resources .auth .auth import AuthResource , AsyncAuthResource
48- from .resources .embeddings import EmbeddingsResource , AsyncEmbeddingsResource
4937 from .resources .agents .agents import AgentsResource , AsyncAgentsResource
5038 from .resources .indexing_jobs import IndexingJobsResource , AsyncIndexingJobsResource
5139 from .resources .api_keys .api_keys import APIKeysResource , AsyncAPIKeysResource
@@ -105,6 +93,7 @@ def __init__(
10593
10694 if base_url is None :
10795 base_url = os .environ .get ("GRADIENT_AI_BASE_URL" )
96+ self ._base_url_overridden = base_url is not None
10897 if base_url is None :
10998 base_url = f"https://api.digitalocean.com/"
11099
@@ -131,12 +120,6 @@ def providers(self) -> ProvidersResource:
131120
132121 return ProvidersResource (self )
133122
134- @cached_property
135- def auth (self ) -> AuthResource :
136- from .resources .auth import AuthResource
137-
138- return AuthResource (self )
139-
140123 @cached_property
141124 def regions (self ) -> RegionsResource :
142125 from .resources .regions import RegionsResource
@@ -161,12 +144,6 @@ def api_keys(self) -> APIKeysResource:
161144
162145 return APIKeysResource (self )
163146
164- @cached_property
165- def embeddings (self ) -> EmbeddingsResource :
166- from .resources .embeddings import EmbeddingsResource
167-
168- return EmbeddingsResource (self )
169-
170147 @cached_property
171148 def models (self ) -> ModelsResource :
172149 from .resources .models import ModelsResource
@@ -237,7 +214,7 @@ def copy(
237214 params = set_default_query
238215
239216 http_client = http_client or self ._client
240- return self .__class__ (
217+ client = self .__class__ (
241218 api_key = api_key or self .api_key ,
242219 base_url = base_url or self .base_url ,
243220 timeout = self .timeout if isinstance (timeout , NotGiven ) else timeout ,
@@ -247,6 +224,8 @@ def copy(
247224 default_query = params ,
248225 ** _extra_kwargs ,
249226 )
227+ client ._base_url_overridden = self ._base_url_overridden or base_url is not None
228+ return client
250229
251230 # Alias for `copy` for nicer inline usage, e.g.
252231 # client.with_options(timeout=10).foo.create(...)
@@ -327,6 +306,7 @@ def __init__(
327306
328307 if base_url is None :
329308 base_url = os .environ .get ("GRADIENT_AI_BASE_URL" )
309+ self ._base_url_overridden = base_url is not None
330310 if base_url is None :
331311 base_url = f"https://api.digitalocean.com/"
332312
@@ -353,12 +333,6 @@ def providers(self) -> AsyncProvidersResource:
353333
354334 return AsyncProvidersResource (self )
355335
356- @cached_property
357- def auth (self ) -> AsyncAuthResource :
358- from .resources .auth import AsyncAuthResource
359-
360- return AsyncAuthResource (self )
361-
362336 @cached_property
363337 def regions (self ) -> AsyncRegionsResource :
364338 from .resources .regions import AsyncRegionsResource
@@ -383,12 +357,6 @@ def api_keys(self) -> AsyncAPIKeysResource:
383357
384358 return AsyncAPIKeysResource (self )
385359
386- @cached_property
387- def embeddings (self ) -> AsyncEmbeddingsResource :
388- from .resources .embeddings import AsyncEmbeddingsResource
389-
390- return AsyncEmbeddingsResource (self )
391-
392360 @cached_property
393361 def models (self ) -> AsyncModelsResource :
394362 from .resources .models import AsyncModelsResource
@@ -459,7 +427,7 @@ def copy(
459427 params = set_default_query
460428
461429 http_client = http_client or self ._client
462- return self .__class__ (
430+ client = self .__class__ (
463431 api_key = api_key or self .api_key ,
464432 base_url = base_url or self .base_url ,
465433 timeout = self .timeout if isinstance (timeout , NotGiven ) else timeout ,
@@ -469,6 +437,8 @@ def copy(
469437 default_query = params ,
470438 ** _extra_kwargs ,
471439 )
440+ client ._base_url_overridden = self ._base_url_overridden or base_url is not None
441+ return client
472442
473443 # Alias for `copy` for nicer inline usage, e.g.
474444 # client.with_options(timeout=10).foo.create(...)
@@ -526,12 +496,6 @@ def providers(self) -> providers.ProvidersResourceWithRawResponse:
526496
527497 return ProvidersResourceWithRawResponse (self ._client .providers )
528498
529- @cached_property
530- def auth (self ) -> auth .AuthResourceWithRawResponse :
531- from .resources .auth import AuthResourceWithRawResponse
532-
533- return AuthResourceWithRawResponse (self ._client .auth )
534-
535499 @cached_property
536500 def regions (self ) -> regions .RegionsResourceWithRawResponse :
537501 from .resources .regions import RegionsResourceWithRawResponse
@@ -556,12 +520,6 @@ def api_keys(self) -> api_keys.APIKeysResourceWithRawResponse:
556520
557521 return APIKeysResourceWithRawResponse (self ._client .api_keys )
558522
559- @cached_property
560- def embeddings (self ) -> embeddings .EmbeddingsResourceWithRawResponse :
561- from .resources .embeddings import EmbeddingsResourceWithRawResponse
562-
563- return EmbeddingsResourceWithRawResponse (self ._client .embeddings )
564-
565523 @cached_property
566524 def models (self ) -> models .ModelsResourceWithRawResponse :
567525 from .resources .models import ModelsResourceWithRawResponse
@@ -587,12 +545,6 @@ def providers(self) -> providers.AsyncProvidersResourceWithRawResponse:
587545
588546 return AsyncProvidersResourceWithRawResponse (self ._client .providers )
589547
590- @cached_property
591- def auth (self ) -> auth .AsyncAuthResourceWithRawResponse :
592- from .resources .auth import AsyncAuthResourceWithRawResponse
593-
594- return AsyncAuthResourceWithRawResponse (self ._client .auth )
595-
596548 @cached_property
597549 def regions (self ) -> regions .AsyncRegionsResourceWithRawResponse :
598550 from .resources .regions import AsyncRegionsResourceWithRawResponse
@@ -617,12 +569,6 @@ def api_keys(self) -> api_keys.AsyncAPIKeysResourceWithRawResponse:
617569
618570 return AsyncAPIKeysResourceWithRawResponse (self ._client .api_keys )
619571
620- @cached_property
621- def embeddings (self ) -> embeddings .AsyncEmbeddingsResourceWithRawResponse :
622- from .resources .embeddings import AsyncEmbeddingsResourceWithRawResponse
623-
624- return AsyncEmbeddingsResourceWithRawResponse (self ._client .embeddings )
625-
626572 @cached_property
627573 def models (self ) -> models .AsyncModelsResourceWithRawResponse :
628574 from .resources .models import AsyncModelsResourceWithRawResponse
@@ -648,12 +594,6 @@ def providers(self) -> providers.ProvidersResourceWithStreamingResponse:
648594
649595 return ProvidersResourceWithStreamingResponse (self ._client .providers )
650596
651- @cached_property
652- def auth (self ) -> auth .AuthResourceWithStreamingResponse :
653- from .resources .auth import AuthResourceWithStreamingResponse
654-
655- return AuthResourceWithStreamingResponse (self ._client .auth )
656-
657597 @cached_property
658598 def regions (self ) -> regions .RegionsResourceWithStreamingResponse :
659599 from .resources .regions import RegionsResourceWithStreamingResponse
@@ -678,12 +618,6 @@ def api_keys(self) -> api_keys.APIKeysResourceWithStreamingResponse:
678618
679619 return APIKeysResourceWithStreamingResponse (self ._client .api_keys )
680620
681- @cached_property
682- def embeddings (self ) -> embeddings .EmbeddingsResourceWithStreamingResponse :
683- from .resources .embeddings import EmbeddingsResourceWithStreamingResponse
684-
685- return EmbeddingsResourceWithStreamingResponse (self ._client .embeddings )
686-
687621 @cached_property
688622 def models (self ) -> models .ModelsResourceWithStreamingResponse :
689623 from .resources .models import ModelsResourceWithStreamingResponse
@@ -709,12 +643,6 @@ def providers(self) -> providers.AsyncProvidersResourceWithStreamingResponse:
709643
710644 return AsyncProvidersResourceWithStreamingResponse (self ._client .providers )
711645
712- @cached_property
713- def auth (self ) -> auth .AsyncAuthResourceWithStreamingResponse :
714- from .resources .auth import AsyncAuthResourceWithStreamingResponse
715-
716- return AsyncAuthResourceWithStreamingResponse (self ._client .auth )
717-
718646 @cached_property
719647 def regions (self ) -> regions .AsyncRegionsResourceWithStreamingResponse :
720648 from .resources .regions import AsyncRegionsResourceWithStreamingResponse
@@ -739,12 +667,6 @@ def api_keys(self) -> api_keys.AsyncAPIKeysResourceWithStreamingResponse:
739667
740668 return AsyncAPIKeysResourceWithStreamingResponse (self ._client .api_keys )
741669
742- @cached_property
743- def embeddings (self ) -> embeddings .AsyncEmbeddingsResourceWithStreamingResponse :
744- from .resources .embeddings import AsyncEmbeddingsResourceWithStreamingResponse
745-
746- return AsyncEmbeddingsResourceWithStreamingResponse (self ._client .embeddings )
747-
748670 @cached_property
749671 def models (self ) -> models .AsyncModelsResourceWithStreamingResponse :
750672 from .resources .models import AsyncModelsResourceWithStreamingResponse
0 commit comments