Skip to content

Commit 4d0f409

Browse files
chore: use lazy imports for module level client
1 parent 67997a4 commit 4d0f409

File tree

1 file changed

+66
-46
lines changed

1 file changed

+66
-46
lines changed

src/openai/_module_client.py

+66-46
Original file line numberDiff line numberDiff line change
@@ -1,113 +1,133 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3+
from __future__ import annotations
4+
5+
from typing import TYPE_CHECKING
36
from typing_extensions import override
47

5-
from . import resources, _load_client
8+
if TYPE_CHECKING:
9+
from .resources.files import Files
10+
from .resources.images import Images
11+
from .resources.models import Models
12+
from .resources.batches import Batches
13+
from .resources.beta.beta import Beta
14+
from .resources.chat.chat import Chat
15+
from .resources.embeddings import Embeddings
16+
from .resources.audio.audio import Audio
17+
from .resources.completions import Completions
18+
from .resources.evals.evals import Evals
19+
from .resources.moderations import Moderations
20+
from .resources.uploads.uploads import Uploads
21+
from .resources.responses.responses import Responses
22+
from .resources.fine_tuning.fine_tuning import FineTuning
23+
from .resources.vector_stores.vector_stores import VectorStores
24+
25+
from . import _load_client
626
from ._utils import LazyProxy
727

828

9-
class ChatProxy(LazyProxy[resources.Chat]):
29+
class ChatProxy(LazyProxy["Chat"]):
1030
@override
11-
def __load__(self) -> resources.Chat:
31+
def __load__(self) -> Chat:
1232
return _load_client().chat
1333

1434

15-
class BetaProxy(LazyProxy[resources.Beta]):
35+
class BetaProxy(LazyProxy["Beta"]):
1636
@override
17-
def __load__(self) -> resources.Beta:
37+
def __load__(self) -> Beta:
1838
return _load_client().beta
1939

2040

21-
class FilesProxy(LazyProxy[resources.Files]):
41+
class FilesProxy(LazyProxy["Files"]):
2242
@override
23-
def __load__(self) -> resources.Files:
43+
def __load__(self) -> Files:
2444
return _load_client().files
2545

2646

27-
class AudioProxy(LazyProxy[resources.Audio]):
47+
class AudioProxy(LazyProxy["Audio"]):
2848
@override
29-
def __load__(self) -> resources.Audio:
49+
def __load__(self) -> Audio:
3050
return _load_client().audio
3151

3252

33-
class EvalsProxy(LazyProxy[resources.Evals]):
53+
class EvalsProxy(LazyProxy["Evals"]):
3454
@override
35-
def __load__(self) -> resources.Evals:
55+
def __load__(self) -> Evals:
3656
return _load_client().evals
3757

3858

39-
class ImagesProxy(LazyProxy[resources.Images]):
59+
class ImagesProxy(LazyProxy["Images"]):
4060
@override
41-
def __load__(self) -> resources.Images:
61+
def __load__(self) -> Images:
4262
return _load_client().images
4363

4464

45-
class ModelsProxy(LazyProxy[resources.Models]):
65+
class ModelsProxy(LazyProxy["Models"]):
4666
@override
47-
def __load__(self) -> resources.Models:
67+
def __load__(self) -> Models:
4868
return _load_client().models
4969

5070

51-
class BatchesProxy(LazyProxy[resources.Batches]):
71+
class BatchesProxy(LazyProxy["Batches"]):
5272
@override
53-
def __load__(self) -> resources.Batches:
73+
def __load__(self) -> Batches:
5474
return _load_client().batches
5575

5676

57-
class UploadsProxy(LazyProxy[resources.Uploads]):
77+
class UploadsProxy(LazyProxy["Uploads"]):
5878
@override
59-
def __load__(self) -> resources.Uploads:
79+
def __load__(self) -> Uploads:
6080
return _load_client().uploads
6181

6282

63-
class ResponsesProxy(LazyProxy[resources.Responses]):
83+
class ResponsesProxy(LazyProxy["Responses"]):
6484
@override
65-
def __load__(self) -> resources.Responses:
85+
def __load__(self) -> Responses:
6686
return _load_client().responses
6787

6888

69-
class EmbeddingsProxy(LazyProxy[resources.Embeddings]):
89+
class EmbeddingsProxy(LazyProxy["Embeddings"]):
7090
@override
71-
def __load__(self) -> resources.Embeddings:
91+
def __load__(self) -> Embeddings:
7292
return _load_client().embeddings
7393

7494

75-
class CompletionsProxy(LazyProxy[resources.Completions]):
95+
class CompletionsProxy(LazyProxy["Completions"]):
7696
@override
77-
def __load__(self) -> resources.Completions:
97+
def __load__(self) -> Completions:
7898
return _load_client().completions
7999

80100

81-
class ModerationsProxy(LazyProxy[resources.Moderations]):
101+
class ModerationsProxy(LazyProxy["Moderations"]):
82102
@override
83-
def __load__(self) -> resources.Moderations:
103+
def __load__(self) -> Moderations:
84104
return _load_client().moderations
85105

86106

87-
class FineTuningProxy(LazyProxy[resources.FineTuning]):
107+
class FineTuningProxy(LazyProxy["FineTuning"]):
88108
@override
89-
def __load__(self) -> resources.FineTuning:
109+
def __load__(self) -> FineTuning:
90110
return _load_client().fine_tuning
91111

92112

93-
class VectorStoresProxy(LazyProxy[resources.VectorStores]):
113+
class VectorStoresProxy(LazyProxy["VectorStores"]):
94114
@override
95-
def __load__(self) -> resources.VectorStores:
115+
def __load__(self) -> VectorStores:
96116
return _load_client().vector_stores
97117

98118

99-
chat: resources.Chat = ChatProxy().__as_proxied__()
100-
beta: resources.Beta = BetaProxy().__as_proxied__()
101-
files: resources.Files = FilesProxy().__as_proxied__()
102-
audio: resources.Audio = AudioProxy().__as_proxied__()
103-
evals: resources.Evals = EvalsProxy().__as_proxied__()
104-
images: resources.Images = ImagesProxy().__as_proxied__()
105-
models: resources.Models = ModelsProxy().__as_proxied__()
106-
batches: resources.Batches = BatchesProxy().__as_proxied__()
107-
uploads: resources.Uploads = UploadsProxy().__as_proxied__()
108-
responses: resources.Responses = ResponsesProxy().__as_proxied__()
109-
embeddings: resources.Embeddings = EmbeddingsProxy().__as_proxied__()
110-
completions: resources.Completions = CompletionsProxy().__as_proxied__()
111-
moderations: resources.Moderations = ModerationsProxy().__as_proxied__()
112-
fine_tuning: resources.FineTuning = FineTuningProxy().__as_proxied__()
113-
vector_stores: resources.VectorStores = VectorStoresProxy().__as_proxied__()
119+
chat: Chat = ChatProxy().__as_proxied__()
120+
beta: Beta = BetaProxy().__as_proxied__()
121+
files: Files = FilesProxy().__as_proxied__()
122+
audio: Audio = AudioProxy().__as_proxied__()
123+
evals: Evals = EvalsProxy().__as_proxied__()
124+
images: Images = ImagesProxy().__as_proxied__()
125+
models: Models = ModelsProxy().__as_proxied__()
126+
batches: Batches = BatchesProxy().__as_proxied__()
127+
uploads: Uploads = UploadsProxy().__as_proxied__()
128+
responses: Responses = ResponsesProxy().__as_proxied__()
129+
embeddings: Embeddings = EmbeddingsProxy().__as_proxied__()
130+
completions: Completions = CompletionsProxy().__as_proxied__()
131+
moderations: Moderations = ModerationsProxy().__as_proxied__()
132+
fine_tuning: FineTuning = FineTuningProxy().__as_proxied__()
133+
vector_stores: VectorStores = VectorStoresProxy().__as_proxied__()

0 commit comments

Comments
 (0)