scale-gp-beta 0.1.0a2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. scale_gp/__init__.py +96 -0
  2. scale_gp/_base_client.py +2058 -0
  3. scale_gp/_client.py +544 -0
  4. scale_gp/_compat.py +219 -0
  5. scale_gp/_constants.py +14 -0
  6. scale_gp/_exceptions.py +108 -0
  7. scale_gp/_files.py +123 -0
  8. scale_gp/_models.py +801 -0
  9. scale_gp/_qs.py +150 -0
  10. scale_gp/_resource.py +43 -0
  11. scale_gp/_response.py +830 -0
  12. scale_gp/_streaming.py +333 -0
  13. scale_gp/_types.py +217 -0
  14. scale_gp/_utils/__init__.py +57 -0
  15. scale_gp/_utils/_logs.py +25 -0
  16. scale_gp/_utils/_proxy.py +62 -0
  17. scale_gp/_utils/_reflection.py +42 -0
  18. scale_gp/_utils/_streams.py +12 -0
  19. scale_gp/_utils/_sync.py +86 -0
  20. scale_gp/_utils/_transform.py +402 -0
  21. scale_gp/_utils/_typing.py +149 -0
  22. scale_gp/_utils/_utils.py +414 -0
  23. scale_gp/_version.py +4 -0
  24. scale_gp/lib/.keep +4 -0
  25. scale_gp/pagination.py +83 -0
  26. scale_gp/py.typed +0 -0
  27. scale_gp/resources/__init__.py +103 -0
  28. scale_gp/resources/chat/__init__.py +33 -0
  29. scale_gp/resources/chat/chat.py +102 -0
  30. scale_gp/resources/chat/completions.py +1054 -0
  31. scale_gp/resources/completions.py +765 -0
  32. scale_gp/resources/files/__init__.py +33 -0
  33. scale_gp/resources/files/content.py +162 -0
  34. scale_gp/resources/files/files.py +558 -0
  35. scale_gp/resources/inference.py +210 -0
  36. scale_gp/resources/models.py +834 -0
  37. scale_gp/resources/question_sets.py +680 -0
  38. scale_gp/resources/questions.py +396 -0
  39. scale_gp/types/__init__.py +33 -0
  40. scale_gp/types/chat/__init__.py +8 -0
  41. scale_gp/types/chat/chat_completion.py +257 -0
  42. scale_gp/types/chat/chat_completion_chunk.py +240 -0
  43. scale_gp/types/chat/completion_create_params.py +156 -0
  44. scale_gp/types/chat/completion_create_response.py +11 -0
  45. scale_gp/types/completion.py +116 -0
  46. scale_gp/types/completion_create_params.py +108 -0
  47. scale_gp/types/file.py +30 -0
  48. scale_gp/types/file_create_params.py +13 -0
  49. scale_gp/types/file_delete_response.py +16 -0
  50. scale_gp/types/file_list.py +27 -0
  51. scale_gp/types/file_list_params.py +16 -0
  52. scale_gp/types/file_update_params.py +12 -0
  53. scale_gp/types/files/__init__.py +3 -0
  54. scale_gp/types/inference_create_params.py +25 -0
  55. scale_gp/types/inference_create_response.py +11 -0
  56. scale_gp/types/inference_model.py +167 -0
  57. scale_gp/types/inference_model_list.py +27 -0
  58. scale_gp/types/inference_response.py +14 -0
  59. scale_gp/types/inference_response_chunk.py +14 -0
  60. scale_gp/types/model_create_params.py +165 -0
  61. scale_gp/types/model_delete_response.py +16 -0
  62. scale_gp/types/model_list_params.py +20 -0
  63. scale_gp/types/model_update_params.py +161 -0
  64. scale_gp/types/question.py +68 -0
  65. scale_gp/types/question_create_params.py +59 -0
  66. scale_gp/types/question_list.py +27 -0
  67. scale_gp/types/question_list_params.py +16 -0
  68. scale_gp/types/question_set.py +106 -0
  69. scale_gp/types/question_set_create_params.py +115 -0
  70. scale_gp/types/question_set_delete_response.py +16 -0
  71. scale_gp/types/question_set_list.py +27 -0
  72. scale_gp/types/question_set_list_params.py +20 -0
  73. scale_gp/types/question_set_retrieve_params.py +12 -0
  74. scale_gp/types/question_set_update_params.py +23 -0
  75. scale_gp_beta-0.1.0a2.dist-info/METADATA +440 -0
  76. scale_gp_beta-0.1.0a2.dist-info/RECORD +78 -0
  77. scale_gp_beta-0.1.0a2.dist-info/WHEEL +4 -0
  78. scale_gp_beta-0.1.0a2.dist-info/licenses/LICENSE +201 -0
@@ -0,0 +1,396 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Dict, Iterable, Optional
6
+ from typing_extensions import Literal
7
+
8
+ import httpx
9
+
10
+ from ..types import question_list_params, question_create_params
11
+ from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
12
+ from .._utils import (
13
+ maybe_transform,
14
+ async_maybe_transform,
15
+ )
16
+ from .._compat import cached_property
17
+ from .._resource import SyncAPIResource, AsyncAPIResource
18
+ from .._response import (
19
+ to_raw_response_wrapper,
20
+ to_streamed_response_wrapper,
21
+ async_to_raw_response_wrapper,
22
+ async_to_streamed_response_wrapper,
23
+ )
24
+ from ..pagination import SyncCursorPage, AsyncCursorPage
25
+ from .._base_client import AsyncPaginator, make_request_options
26
+ from ..types.question import Question
27
+
28
+ __all__ = ["QuestionsResource", "AsyncQuestionsResource"]
29
+
30
+
31
+ class QuestionsResource(SyncAPIResource):
32
+ @cached_property
33
+ def with_raw_response(self) -> QuestionsResourceWithRawResponse:
34
+ """
35
+ This property can be used as a prefix for any HTTP method call to return
36
+ the raw response object instead of the parsed content.
37
+
38
+ For more information, see https://www.github.com/scaleapi/sgp-python-beta#accessing-raw-response-data-eg-headers
39
+ """
40
+ return QuestionsResourceWithRawResponse(self)
41
+
42
+ @cached_property
43
+ def with_streaming_response(self) -> QuestionsResourceWithStreamingResponse:
44
+ """
45
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
46
+
47
+ For more information, see https://www.github.com/scaleapi/sgp-python-beta#with_streaming_response
48
+ """
49
+ return QuestionsResourceWithStreamingResponse(self)
50
+
51
+ def create(
52
+ self,
53
+ *,
54
+ prompt: str,
55
+ title: str,
56
+ type: Literal["categorical", "free_text", "rating", "number"],
57
+ choices: Iterable[question_create_params.Choice] | NotGiven = NOT_GIVEN,
58
+ conditions: Iterable[Dict[str, object]] | NotGiven = NOT_GIVEN,
59
+ dropdown: bool | NotGiven = NOT_GIVEN,
60
+ multi: bool | NotGiven = NOT_GIVEN,
61
+ number_options: question_create_params.NumberOptions | NotGiven = NOT_GIVEN,
62
+ rating_options: question_create_params.RatingOptions | NotGiven = NOT_GIVEN,
63
+ required: bool | NotGiven = NOT_GIVEN,
64
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
65
+ # The extra values given here take precedence over values defined on the client or passed to this method.
66
+ extra_headers: Headers | None = None,
67
+ extra_query: Query | None = None,
68
+ extra_body: Body | None = None,
69
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
70
+ ) -> Question:
71
+ """
72
+ Create Question
73
+
74
+ Args:
75
+ extra_headers: Send extra headers
76
+
77
+ extra_query: Add additional query parameters to the request
78
+
79
+ extra_body: Add additional JSON properties to the request
80
+
81
+ timeout: Override the client-level default timeout for this request, in seconds
82
+ """
83
+ return self._post(
84
+ "/v5/questions",
85
+ body=maybe_transform(
86
+ {
87
+ "prompt": prompt,
88
+ "title": title,
89
+ "type": type,
90
+ "choices": choices,
91
+ "conditions": conditions,
92
+ "dropdown": dropdown,
93
+ "multi": multi,
94
+ "number_options": number_options,
95
+ "rating_options": rating_options,
96
+ "required": required,
97
+ },
98
+ question_create_params.QuestionCreateParams,
99
+ ),
100
+ options=make_request_options(
101
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
102
+ ),
103
+ cast_to=Question,
104
+ )
105
+
106
+ def retrieve(
107
+ self,
108
+ question_id: str,
109
+ *,
110
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
111
+ # The extra values given here take precedence over values defined on the client or passed to this method.
112
+ extra_headers: Headers | None = None,
113
+ extra_query: Query | None = None,
114
+ extra_body: Body | None = None,
115
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
116
+ ) -> Question:
117
+ """
118
+ Get Question
119
+
120
+ Args:
121
+ extra_headers: Send extra headers
122
+
123
+ extra_query: Add additional query parameters to the request
124
+
125
+ extra_body: Add additional JSON properties to the request
126
+
127
+ timeout: Override the client-level default timeout for this request, in seconds
128
+ """
129
+ if not question_id:
130
+ raise ValueError(f"Expected a non-empty value for `question_id` but received {question_id!r}")
131
+ return self._get(
132
+ f"/v5/questions/{question_id}",
133
+ options=make_request_options(
134
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
135
+ ),
136
+ cast_to=Question,
137
+ )
138
+
139
+ def list(
140
+ self,
141
+ *,
142
+ ending_before: Optional[str] | NotGiven = NOT_GIVEN,
143
+ limit: int | NotGiven = NOT_GIVEN,
144
+ starting_after: Optional[str] | NotGiven = NOT_GIVEN,
145
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
146
+ # The extra values given here take precedence over values defined on the client or passed to this method.
147
+ extra_headers: Headers | None = None,
148
+ extra_query: Query | None = None,
149
+ extra_body: Body | None = None,
150
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
151
+ ) -> SyncCursorPage[Question]:
152
+ """
153
+ List Questions
154
+
155
+ Args:
156
+ extra_headers: Send extra headers
157
+
158
+ extra_query: Add additional query parameters to the request
159
+
160
+ extra_body: Add additional JSON properties to the request
161
+
162
+ timeout: Override the client-level default timeout for this request, in seconds
163
+ """
164
+ return self._get_api_list(
165
+ "/v5/questions",
166
+ page=SyncCursorPage[Question],
167
+ options=make_request_options(
168
+ extra_headers=extra_headers,
169
+ extra_query=extra_query,
170
+ extra_body=extra_body,
171
+ timeout=timeout,
172
+ query=maybe_transform(
173
+ {
174
+ "ending_before": ending_before,
175
+ "limit": limit,
176
+ "starting_after": starting_after,
177
+ },
178
+ question_list_params.QuestionListParams,
179
+ ),
180
+ ),
181
+ model=Question,
182
+ )
183
+
184
+
185
+ class AsyncQuestionsResource(AsyncAPIResource):
186
+ @cached_property
187
+ def with_raw_response(self) -> AsyncQuestionsResourceWithRawResponse:
188
+ """
189
+ This property can be used as a prefix for any HTTP method call to return
190
+ the raw response object instead of the parsed content.
191
+
192
+ For more information, see https://www.github.com/scaleapi/sgp-python-beta#accessing-raw-response-data-eg-headers
193
+ """
194
+ return AsyncQuestionsResourceWithRawResponse(self)
195
+
196
+ @cached_property
197
+ def with_streaming_response(self) -> AsyncQuestionsResourceWithStreamingResponse:
198
+ """
199
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
200
+
201
+ For more information, see https://www.github.com/scaleapi/sgp-python-beta#with_streaming_response
202
+ """
203
+ return AsyncQuestionsResourceWithStreamingResponse(self)
204
+
205
+ async def create(
206
+ self,
207
+ *,
208
+ prompt: str,
209
+ title: str,
210
+ type: Literal["categorical", "free_text", "rating", "number"],
211
+ choices: Iterable[question_create_params.Choice] | NotGiven = NOT_GIVEN,
212
+ conditions: Iterable[Dict[str, object]] | NotGiven = NOT_GIVEN,
213
+ dropdown: bool | NotGiven = NOT_GIVEN,
214
+ multi: bool | NotGiven = NOT_GIVEN,
215
+ number_options: question_create_params.NumberOptions | NotGiven = NOT_GIVEN,
216
+ rating_options: question_create_params.RatingOptions | NotGiven = NOT_GIVEN,
217
+ required: bool | NotGiven = NOT_GIVEN,
218
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
219
+ # The extra values given here take precedence over values defined on the client or passed to this method.
220
+ extra_headers: Headers | None = None,
221
+ extra_query: Query | None = None,
222
+ extra_body: Body | None = None,
223
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
224
+ ) -> Question:
225
+ """
226
+ Create Question
227
+
228
+ Args:
229
+ extra_headers: Send extra headers
230
+
231
+ extra_query: Add additional query parameters to the request
232
+
233
+ extra_body: Add additional JSON properties to the request
234
+
235
+ timeout: Override the client-level default timeout for this request, in seconds
236
+ """
237
+ return await self._post(
238
+ "/v5/questions",
239
+ body=await async_maybe_transform(
240
+ {
241
+ "prompt": prompt,
242
+ "title": title,
243
+ "type": type,
244
+ "choices": choices,
245
+ "conditions": conditions,
246
+ "dropdown": dropdown,
247
+ "multi": multi,
248
+ "number_options": number_options,
249
+ "rating_options": rating_options,
250
+ "required": required,
251
+ },
252
+ question_create_params.QuestionCreateParams,
253
+ ),
254
+ options=make_request_options(
255
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
256
+ ),
257
+ cast_to=Question,
258
+ )
259
+
260
+ async def retrieve(
261
+ self,
262
+ question_id: str,
263
+ *,
264
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
265
+ # The extra values given here take precedence over values defined on the client or passed to this method.
266
+ extra_headers: Headers | None = None,
267
+ extra_query: Query | None = None,
268
+ extra_body: Body | None = None,
269
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
270
+ ) -> Question:
271
+ """
272
+ Get Question
273
+
274
+ Args:
275
+ extra_headers: Send extra headers
276
+
277
+ extra_query: Add additional query parameters to the request
278
+
279
+ extra_body: Add additional JSON properties to the request
280
+
281
+ timeout: Override the client-level default timeout for this request, in seconds
282
+ """
283
+ if not question_id:
284
+ raise ValueError(f"Expected a non-empty value for `question_id` but received {question_id!r}")
285
+ return await self._get(
286
+ f"/v5/questions/{question_id}",
287
+ options=make_request_options(
288
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
289
+ ),
290
+ cast_to=Question,
291
+ )
292
+
293
+ def list(
294
+ self,
295
+ *,
296
+ ending_before: Optional[str] | NotGiven = NOT_GIVEN,
297
+ limit: int | NotGiven = NOT_GIVEN,
298
+ starting_after: Optional[str] | NotGiven = NOT_GIVEN,
299
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
300
+ # The extra values given here take precedence over values defined on the client or passed to this method.
301
+ extra_headers: Headers | None = None,
302
+ extra_query: Query | None = None,
303
+ extra_body: Body | None = None,
304
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
305
+ ) -> AsyncPaginator[Question, AsyncCursorPage[Question]]:
306
+ """
307
+ List Questions
308
+
309
+ Args:
310
+ extra_headers: Send extra headers
311
+
312
+ extra_query: Add additional query parameters to the request
313
+
314
+ extra_body: Add additional JSON properties to the request
315
+
316
+ timeout: Override the client-level default timeout for this request, in seconds
317
+ """
318
+ return self._get_api_list(
319
+ "/v5/questions",
320
+ page=AsyncCursorPage[Question],
321
+ options=make_request_options(
322
+ extra_headers=extra_headers,
323
+ extra_query=extra_query,
324
+ extra_body=extra_body,
325
+ timeout=timeout,
326
+ query=maybe_transform(
327
+ {
328
+ "ending_before": ending_before,
329
+ "limit": limit,
330
+ "starting_after": starting_after,
331
+ },
332
+ question_list_params.QuestionListParams,
333
+ ),
334
+ ),
335
+ model=Question,
336
+ )
337
+
338
+
339
+ class QuestionsResourceWithRawResponse:
340
+ def __init__(self, questions: QuestionsResource) -> None:
341
+ self._questions = questions
342
+
343
+ self.create = to_raw_response_wrapper(
344
+ questions.create,
345
+ )
346
+ self.retrieve = to_raw_response_wrapper(
347
+ questions.retrieve,
348
+ )
349
+ self.list = to_raw_response_wrapper(
350
+ questions.list,
351
+ )
352
+
353
+
354
+ class AsyncQuestionsResourceWithRawResponse:
355
+ def __init__(self, questions: AsyncQuestionsResource) -> None:
356
+ self._questions = questions
357
+
358
+ self.create = async_to_raw_response_wrapper(
359
+ questions.create,
360
+ )
361
+ self.retrieve = async_to_raw_response_wrapper(
362
+ questions.retrieve,
363
+ )
364
+ self.list = async_to_raw_response_wrapper(
365
+ questions.list,
366
+ )
367
+
368
+
369
+ class QuestionsResourceWithStreamingResponse:
370
+ def __init__(self, questions: QuestionsResource) -> None:
371
+ self._questions = questions
372
+
373
+ self.create = to_streamed_response_wrapper(
374
+ questions.create,
375
+ )
376
+ self.retrieve = to_streamed_response_wrapper(
377
+ questions.retrieve,
378
+ )
379
+ self.list = to_streamed_response_wrapper(
380
+ questions.list,
381
+ )
382
+
383
+
384
+ class AsyncQuestionsResourceWithStreamingResponse:
385
+ def __init__(self, questions: AsyncQuestionsResource) -> None:
386
+ self._questions = questions
387
+
388
+ self.create = async_to_streamed_response_wrapper(
389
+ questions.create,
390
+ )
391
+ self.retrieve = async_to_streamed_response_wrapper(
392
+ questions.retrieve,
393
+ )
394
+ self.list = async_to_streamed_response_wrapper(
395
+ questions.list,
396
+ )
@@ -0,0 +1,33 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from .file import File as File
6
+ from .question import Question as Question
7
+ from .file_list import FileList as FileList
8
+ from .completion import Completion as Completion
9
+ from .question_set import QuestionSet as QuestionSet
10
+ from .question_list import QuestionList as QuestionList
11
+ from .inference_model import InferenceModel as InferenceModel
12
+ from .file_list_params import FileListParams as FileListParams
13
+ from .model_list_params import ModelListParams as ModelListParams
14
+ from .question_set_list import QuestionSetList as QuestionSetList
15
+ from .file_create_params import FileCreateParams as FileCreateParams
16
+ from .file_update_params import FileUpdateParams as FileUpdateParams
17
+ from .inference_response import InferenceResponse as InferenceResponse
18
+ from .model_create_params import ModelCreateParams as ModelCreateParams
19
+ from .model_update_params import ModelUpdateParams as ModelUpdateParams
20
+ from .file_delete_response import FileDeleteResponse as FileDeleteResponse
21
+ from .inference_model_list import InferenceModelList as InferenceModelList
22
+ from .question_list_params import QuestionListParams as QuestionListParams
23
+ from .model_delete_response import ModelDeleteResponse as ModelDeleteResponse
24
+ from .question_create_params import QuestionCreateParams as QuestionCreateParams
25
+ from .inference_create_params import InferenceCreateParams as InferenceCreateParams
26
+ from .completion_create_params import CompletionCreateParams as CompletionCreateParams
27
+ from .inference_response_chunk import InferenceResponseChunk as InferenceResponseChunk
28
+ from .question_set_list_params import QuestionSetListParams as QuestionSetListParams
29
+ from .inference_create_response import InferenceCreateResponse as InferenceCreateResponse
30
+ from .question_set_create_params import QuestionSetCreateParams as QuestionSetCreateParams
31
+ from .question_set_update_params import QuestionSetUpdateParams as QuestionSetUpdateParams
32
+ from .question_set_delete_response import QuestionSetDeleteResponse as QuestionSetDeleteResponse
33
+ from .question_set_retrieve_params import QuestionSetRetrieveParams as QuestionSetRetrieveParams
@@ -0,0 +1,8 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from .chat_completion import ChatCompletion as ChatCompletion
6
+ from .chat_completion_chunk import ChatCompletionChunk as ChatCompletionChunk
7
+ from .completion_create_params import CompletionCreateParams as CompletionCreateParams
8
+ from .completion_create_response import CompletionCreateResponse as CompletionCreateResponse
@@ -0,0 +1,257 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import builtins
4
+ from typing import TYPE_CHECKING, List, Optional
5
+ from typing_extensions import Literal
6
+
7
+ from ..._models import BaseModel
8
+
9
+ __all__ = [
10
+ "ChatCompletion",
11
+ "Choice",
12
+ "ChoiceMessage",
13
+ "ChoiceMessageAudio",
14
+ "ChoiceMessageFunctionCall",
15
+ "ChoiceMessageToolCall",
16
+ "ChoiceMessageToolCallFunction",
17
+ "ChoiceLogprobs",
18
+ "ChoiceLogprobsContent",
19
+ "ChoiceLogprobsContentTopLogprob",
20
+ "ChoiceLogprobsRefusal",
21
+ "ChoiceLogprobsRefusalTopLogprob",
22
+ "Usage",
23
+ "UsageCompletionTokensDetails",
24
+ "UsagePromptTokensDetails",
25
+ ]
26
+
27
+
28
+ class ChoiceMessageAudio(BaseModel):
29
+ id: str
30
+
31
+ data: str
32
+
33
+ expires_at: int
34
+
35
+ transcript: str
36
+
37
+ if TYPE_CHECKING:
38
+ # Stub to indicate that arbitrary properties are accepted.
39
+ # To access properties that are not valid identifiers you can use `getattr`, e.g.
40
+ # `getattr(obj, '$type')`
41
+ def __getattr__(self, attr: str) -> object: ...
42
+
43
+
44
+ class ChoiceMessageFunctionCall(BaseModel):
45
+ arguments: str
46
+
47
+ name: str
48
+
49
+ if TYPE_CHECKING:
50
+ # Stub to indicate that arbitrary properties are accepted.
51
+ # To access properties that are not valid identifiers you can use `getattr`, e.g.
52
+ # `getattr(obj, '$type')`
53
+ def __getattr__(self, attr: str) -> object: ...
54
+
55
+
56
+ class ChoiceMessageToolCallFunction(BaseModel):
57
+ arguments: str
58
+
59
+ name: str
60
+
61
+ if TYPE_CHECKING:
62
+ # Stub to indicate that arbitrary properties are accepted.
63
+ # To access properties that are not valid identifiers you can use `getattr`, e.g.
64
+ # `getattr(obj, '$type')`
65
+ def __getattr__(self, attr: str) -> object: ...
66
+
67
+
68
+ class ChoiceMessageToolCall(BaseModel):
69
+ id: str
70
+
71
+ function: ChoiceMessageToolCallFunction
72
+
73
+ type: Literal["function"]
74
+
75
+ if TYPE_CHECKING:
76
+ # Stub to indicate that arbitrary properties are accepted.
77
+ # To access properties that are not valid identifiers you can use `getattr`, e.g.
78
+ # `getattr(obj, '$type')`
79
+ def __getattr__(self, attr: str) -> object: ...
80
+
81
+
82
+ class ChoiceMessage(BaseModel):
83
+ role: Literal["assistant"]
84
+
85
+ audio: Optional[ChoiceMessageAudio] = None
86
+
87
+ content: Optional[str] = None
88
+
89
+ function_call: Optional[ChoiceMessageFunctionCall] = None
90
+
91
+ refusal: Optional[str] = None
92
+
93
+ tool_calls: Optional[List[ChoiceMessageToolCall]] = None
94
+
95
+ if TYPE_CHECKING:
96
+ # Stub to indicate that arbitrary properties are accepted.
97
+ # To access properties that are not valid identifiers you can use `getattr`, e.g.
98
+ # `getattr(obj, '$type')`
99
+ def __getattr__(self, attr: str) -> object: ...
100
+
101
+
102
+ class ChoiceLogprobsContentTopLogprob(BaseModel):
103
+ token: str
104
+
105
+ logprob: float
106
+
107
+ bytes: Optional[List[int]] = None
108
+
109
+ if TYPE_CHECKING:
110
+ # Stub to indicate that arbitrary properties are accepted.
111
+ # To access properties that are not valid identifiers you can use `getattr`, e.g.
112
+ # `getattr(obj, '$type')`
113
+ def __getattr__(self, attr: str) -> object: ...
114
+
115
+
116
+ class ChoiceLogprobsContent(BaseModel):
117
+ token: str
118
+
119
+ logprob: float
120
+
121
+ top_logprobs: List[ChoiceLogprobsContentTopLogprob]
122
+
123
+ bytes: Optional[List[int]] = None
124
+
125
+ if TYPE_CHECKING:
126
+ # Stub to indicate that arbitrary properties are accepted.
127
+ # To access properties that are not valid identifiers you can use `getattr`, e.g.
128
+ # `getattr(obj, '$type')`
129
+ def __getattr__(self, attr: str) -> object: ...
130
+
131
+
132
+ class ChoiceLogprobsRefusalTopLogprob(BaseModel):
133
+ token: str
134
+
135
+ logprob: float
136
+
137
+ bytes: Optional[List[int]] = None
138
+
139
+ if TYPE_CHECKING:
140
+ # Stub to indicate that arbitrary properties are accepted.
141
+ # To access properties that are not valid identifiers you can use `getattr`, e.g.
142
+ # `getattr(obj, '$type')`
143
+ def __getattr__(self, attr: str) -> object: ...
144
+
145
+
146
+ class ChoiceLogprobsRefusal(BaseModel):
147
+ token: str
148
+
149
+ logprob: float
150
+
151
+ top_logprobs: List[ChoiceLogprobsRefusalTopLogprob]
152
+
153
+ bytes: Optional[List[int]] = None
154
+
155
+ if TYPE_CHECKING:
156
+ # Stub to indicate that arbitrary properties are accepted.
157
+ # To access properties that are not valid identifiers you can use `getattr`, e.g.
158
+ # `getattr(obj, '$type')`
159
+ def __getattr__(self, attr: str) -> object: ...
160
+
161
+
162
+ class ChoiceLogprobs(BaseModel):
163
+ content: Optional[List[ChoiceLogprobsContent]] = None
164
+
165
+ refusal: Optional[List[ChoiceLogprobsRefusal]] = None
166
+
167
+ if TYPE_CHECKING:
168
+ # Stub to indicate that arbitrary properties are accepted.
169
+ # To access properties that are not valid identifiers you can use `getattr`, e.g.
170
+ # `getattr(obj, '$type')`
171
+ def __getattr__(self, attr: str) -> object: ...
172
+
173
+
174
+ class Choice(BaseModel):
175
+ finish_reason: Literal["stop", "length", "tool_calls", "content_filter", "function_call"]
176
+
177
+ index: int
178
+
179
+ message: ChoiceMessage
180
+
181
+ logprobs: Optional[ChoiceLogprobs] = None
182
+
183
+ if TYPE_CHECKING:
184
+ # Stub to indicate that arbitrary properties are accepted.
185
+ # To access properties that are not valid identifiers you can use `getattr`, e.g.
186
+ # `getattr(obj, '$type')`
187
+ def __getattr__(self, attr: str) -> object: ...
188
+
189
+
190
+ class UsageCompletionTokensDetails(BaseModel):
191
+ accepted_prediction_tokens: Optional[int] = None
192
+
193
+ audio_tokens: Optional[int] = None
194
+
195
+ reasoning_tokens: Optional[int] = None
196
+
197
+ rejected_prediction_tokens: Optional[int] = None
198
+
199
+ if TYPE_CHECKING:
200
+ # Stub to indicate that arbitrary properties are accepted.
201
+ # To access properties that are not valid identifiers you can use `getattr`, e.g.
202
+ # `getattr(obj, '$type')`
203
+ def __getattr__(self, attr: str) -> object: ...
204
+
205
+
206
+ class UsagePromptTokensDetails(BaseModel):
207
+ audio_tokens: Optional[int] = None
208
+
209
+ cached_tokens: Optional[int] = None
210
+
211
+ if TYPE_CHECKING:
212
+ # Stub to indicate that arbitrary properties are accepted.
213
+ # To access properties that are not valid identifiers you can use `getattr`, e.g.
214
+ # `getattr(obj, '$type')`
215
+ def __getattr__(self, attr: str) -> object: ...
216
+
217
+
218
+ class Usage(BaseModel):
219
+ completion_tokens: int
220
+
221
+ prompt_tokens: int
222
+
223
+ total_tokens: int
224
+
225
+ completion_tokens_details: Optional[UsageCompletionTokensDetails] = None
226
+
227
+ prompt_tokens_details: Optional[UsagePromptTokensDetails] = None
228
+
229
+ if TYPE_CHECKING:
230
+ # Stub to indicate that arbitrary properties are accepted.
231
+ # To access properties that are not valid identifiers you can use `getattr`, e.g.
232
+ # `getattr(obj, '$type')`
233
+ def __getattr__(self, attr: str) -> object: ...
234
+
235
+
236
+ class ChatCompletion(BaseModel):
237
+ id: str
238
+
239
+ choices: List[Choice]
240
+
241
+ created: int
242
+
243
+ model: str
244
+
245
+ object: Optional[Literal["chat.completion"]] = None
246
+
247
+ service_tier: Optional[Literal["scale", "default"]] = None
248
+
249
+ system_fingerprint: Optional[str] = None
250
+
251
+ usage: Optional[Usage] = None
252
+
253
+ if TYPE_CHECKING:
254
+ # Stub to indicate that arbitrary properties are accepted.
255
+ # To access properties that are not valid identifiers you can use `getattr`, e.g.
256
+ # `getattr(obj, '$type')`
257
+ def __getattr__(self, attr: str) -> builtins.object: ...