main
1# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
3from __future__ import annotations
4
5from ..._compat import cached_property
6from .assistants import (
7 Assistants,
8 AsyncAssistants,
9 AssistantsWithRawResponse,
10 AsyncAssistantsWithRawResponse,
11 AssistantsWithStreamingResponse,
12 AsyncAssistantsWithStreamingResponse,
13)
14from ..._resource import SyncAPIResource, AsyncAPIResource
15from .chatkit.chatkit import (
16 ChatKit,
17 AsyncChatKit,
18 ChatKitWithRawResponse,
19 AsyncChatKitWithRawResponse,
20 ChatKitWithStreamingResponse,
21 AsyncChatKitWithStreamingResponse,
22)
23from .threads.threads import (
24 Threads,
25 AsyncThreads,
26 ThreadsWithRawResponse,
27 AsyncThreadsWithRawResponse,
28 ThreadsWithStreamingResponse,
29 AsyncThreadsWithStreamingResponse,
30)
31from ...resources.chat import Chat, AsyncChat
32from .realtime.realtime import (
33 Realtime,
34 AsyncRealtime,
35)
36
37__all__ = ["Beta", "AsyncBeta"]
38
39
40class Beta(SyncAPIResource):
41 @cached_property
42 def chat(self) -> Chat:
43 return Chat(self._client)
44
45 @cached_property
46 def realtime(self) -> Realtime:
47 return Realtime(self._client)
48
49 @cached_property
50 def chatkit(self) -> ChatKit:
51 return ChatKit(self._client)
52
53 @cached_property
54 def assistants(self) -> Assistants:
55 return Assistants(self._client)
56
57 @cached_property
58 def threads(self) -> Threads:
59 return Threads(self._client)
60
61 @cached_property
62 def with_raw_response(self) -> BetaWithRawResponse:
63 """
64 This property can be used as a prefix for any HTTP method call to return
65 the raw response object instead of the parsed content.
66
67 For more information, see https://www.github.com/openai/openai-python#accessing-raw-response-data-eg-headers
68 """
69 return BetaWithRawResponse(self)
70
71 @cached_property
72 def with_streaming_response(self) -> BetaWithStreamingResponse:
73 """
74 An alternative to `.with_raw_response` that doesn't eagerly read the response body.
75
76 For more information, see https://www.github.com/openai/openai-python#with_streaming_response
77 """
78 return BetaWithStreamingResponse(self)
79
80
81class AsyncBeta(AsyncAPIResource):
82 @cached_property
83 def chat(self) -> AsyncChat:
84 return AsyncChat(self._client)
85
86 @cached_property
87 def realtime(self) -> AsyncRealtime:
88 return AsyncRealtime(self._client)
89
90 @cached_property
91 def chatkit(self) -> AsyncChatKit:
92 return AsyncChatKit(self._client)
93
94 @cached_property
95 def assistants(self) -> AsyncAssistants:
96 return AsyncAssistants(self._client)
97
98 @cached_property
99 def threads(self) -> AsyncThreads:
100 return AsyncThreads(self._client)
101
102 @cached_property
103 def with_raw_response(self) -> AsyncBetaWithRawResponse:
104 """
105 This property can be used as a prefix for any HTTP method call to return
106 the raw response object instead of the parsed content.
107
108 For more information, see https://www.github.com/openai/openai-python#accessing-raw-response-data-eg-headers
109 """
110 return AsyncBetaWithRawResponse(self)
111
112 @cached_property
113 def with_streaming_response(self) -> AsyncBetaWithStreamingResponse:
114 """
115 An alternative to `.with_raw_response` that doesn't eagerly read the response body.
116
117 For more information, see https://www.github.com/openai/openai-python#with_streaming_response
118 """
119 return AsyncBetaWithStreamingResponse(self)
120
121
122class BetaWithRawResponse:
123 def __init__(self, beta: Beta) -> None:
124 self._beta = beta
125
126 @cached_property
127 def chatkit(self) -> ChatKitWithRawResponse:
128 return ChatKitWithRawResponse(self._beta.chatkit)
129
130 @cached_property
131 def assistants(self) -> AssistantsWithRawResponse:
132 return AssistantsWithRawResponse(self._beta.assistants)
133
134 @cached_property
135 def threads(self) -> ThreadsWithRawResponse:
136 return ThreadsWithRawResponse(self._beta.threads)
137
138
139class AsyncBetaWithRawResponse:
140 def __init__(self, beta: AsyncBeta) -> None:
141 self._beta = beta
142
143 @cached_property
144 def chatkit(self) -> AsyncChatKitWithRawResponse:
145 return AsyncChatKitWithRawResponse(self._beta.chatkit)
146
147 @cached_property
148 def assistants(self) -> AsyncAssistantsWithRawResponse:
149 return AsyncAssistantsWithRawResponse(self._beta.assistants)
150
151 @cached_property
152 def threads(self) -> AsyncThreadsWithRawResponse:
153 return AsyncThreadsWithRawResponse(self._beta.threads)
154
155
156class BetaWithStreamingResponse:
157 def __init__(self, beta: Beta) -> None:
158 self._beta = beta
159
160 @cached_property
161 def chatkit(self) -> ChatKitWithStreamingResponse:
162 return ChatKitWithStreamingResponse(self._beta.chatkit)
163
164 @cached_property
165 def assistants(self) -> AssistantsWithStreamingResponse:
166 return AssistantsWithStreamingResponse(self._beta.assistants)
167
168 @cached_property
169 def threads(self) -> ThreadsWithStreamingResponse:
170 return ThreadsWithStreamingResponse(self._beta.threads)
171
172
173class AsyncBetaWithStreamingResponse:
174 def __init__(self, beta: AsyncBeta) -> None:
175 self._beta = beta
176
177 @cached_property
178 def chatkit(self) -> AsyncChatKitWithStreamingResponse:
179 return AsyncChatKitWithStreamingResponse(self._beta.chatkit)
180
181 @cached_property
182 def assistants(self) -> AsyncAssistantsWithStreamingResponse:
183 return AsyncAssistantsWithStreamingResponse(self._beta.assistants)
184
185 @cached_property
186 def threads(self) -> AsyncThreadsWithStreamingResponse:
187 return AsyncThreadsWithStreamingResponse(self._beta.threads)