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.
- scale_gp/__init__.py +96 -0
- scale_gp/_base_client.py +2058 -0
- scale_gp/_client.py +544 -0
- scale_gp/_compat.py +219 -0
- scale_gp/_constants.py +14 -0
- scale_gp/_exceptions.py +108 -0
- scale_gp/_files.py +123 -0
- scale_gp/_models.py +801 -0
- scale_gp/_qs.py +150 -0
- scale_gp/_resource.py +43 -0
- scale_gp/_response.py +830 -0
- scale_gp/_streaming.py +333 -0
- scale_gp/_types.py +217 -0
- scale_gp/_utils/__init__.py +57 -0
- scale_gp/_utils/_logs.py +25 -0
- scale_gp/_utils/_proxy.py +62 -0
- scale_gp/_utils/_reflection.py +42 -0
- scale_gp/_utils/_streams.py +12 -0
- scale_gp/_utils/_sync.py +86 -0
- scale_gp/_utils/_transform.py +402 -0
- scale_gp/_utils/_typing.py +149 -0
- scale_gp/_utils/_utils.py +414 -0
- scale_gp/_version.py +4 -0
- scale_gp/lib/.keep +4 -0
- scale_gp/pagination.py +83 -0
- scale_gp/py.typed +0 -0
- scale_gp/resources/__init__.py +103 -0
- scale_gp/resources/chat/__init__.py +33 -0
- scale_gp/resources/chat/chat.py +102 -0
- scale_gp/resources/chat/completions.py +1054 -0
- scale_gp/resources/completions.py +765 -0
- scale_gp/resources/files/__init__.py +33 -0
- scale_gp/resources/files/content.py +162 -0
- scale_gp/resources/files/files.py +558 -0
- scale_gp/resources/inference.py +210 -0
- scale_gp/resources/models.py +834 -0
- scale_gp/resources/question_sets.py +680 -0
- scale_gp/resources/questions.py +396 -0
- scale_gp/types/__init__.py +33 -0
- scale_gp/types/chat/__init__.py +8 -0
- scale_gp/types/chat/chat_completion.py +257 -0
- scale_gp/types/chat/chat_completion_chunk.py +240 -0
- scale_gp/types/chat/completion_create_params.py +156 -0
- scale_gp/types/chat/completion_create_response.py +11 -0
- scale_gp/types/completion.py +116 -0
- scale_gp/types/completion_create_params.py +108 -0
- scale_gp/types/file.py +30 -0
- scale_gp/types/file_create_params.py +13 -0
- scale_gp/types/file_delete_response.py +16 -0
- scale_gp/types/file_list.py +27 -0
- scale_gp/types/file_list_params.py +16 -0
- scale_gp/types/file_update_params.py +12 -0
- scale_gp/types/files/__init__.py +3 -0
- scale_gp/types/inference_create_params.py +25 -0
- scale_gp/types/inference_create_response.py +11 -0
- scale_gp/types/inference_model.py +167 -0
- scale_gp/types/inference_model_list.py +27 -0
- scale_gp/types/inference_response.py +14 -0
- scale_gp/types/inference_response_chunk.py +14 -0
- scale_gp/types/model_create_params.py +165 -0
- scale_gp/types/model_delete_response.py +16 -0
- scale_gp/types/model_list_params.py +20 -0
- scale_gp/types/model_update_params.py +161 -0
- scale_gp/types/question.py +68 -0
- scale_gp/types/question_create_params.py +59 -0
- scale_gp/types/question_list.py +27 -0
- scale_gp/types/question_list_params.py +16 -0
- scale_gp/types/question_set.py +106 -0
- scale_gp/types/question_set_create_params.py +115 -0
- scale_gp/types/question_set_delete_response.py +16 -0
- scale_gp/types/question_set_list.py +27 -0
- scale_gp/types/question_set_list_params.py +20 -0
- scale_gp/types/question_set_retrieve_params.py +12 -0
- scale_gp/types/question_set_update_params.py +23 -0
- scale_gp_beta-0.1.0a2.dist-info/METADATA +440 -0
- scale_gp_beta-0.1.0a2.dist-info/RECORD +78 -0
- scale_gp_beta-0.1.0a2.dist-info/WHEEL +4 -0
- scale_gp_beta-0.1.0a2.dist-info/licenses/LICENSE +201 -0
|
@@ -0,0 +1,834 @@
|
|
|
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, Optional
|
|
6
|
+
from typing_extensions import Literal, overload
|
|
7
|
+
|
|
8
|
+
import httpx
|
|
9
|
+
|
|
10
|
+
from ..types import model_list_params, model_create_params, model_update_params
|
|
11
|
+
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
|
12
|
+
from .._utils import (
|
|
13
|
+
required_args,
|
|
14
|
+
maybe_transform,
|
|
15
|
+
async_maybe_transform,
|
|
16
|
+
)
|
|
17
|
+
from .._compat import cached_property
|
|
18
|
+
from .._resource import SyncAPIResource, AsyncAPIResource
|
|
19
|
+
from .._response import (
|
|
20
|
+
to_raw_response_wrapper,
|
|
21
|
+
to_streamed_response_wrapper,
|
|
22
|
+
async_to_raw_response_wrapper,
|
|
23
|
+
async_to_streamed_response_wrapper,
|
|
24
|
+
)
|
|
25
|
+
from ..pagination import SyncCursorPage, AsyncCursorPage
|
|
26
|
+
from .._base_client import AsyncPaginator, make_request_options
|
|
27
|
+
from ..types.inference_model import InferenceModel
|
|
28
|
+
from ..types.model_delete_response import ModelDeleteResponse
|
|
29
|
+
|
|
30
|
+
__all__ = ["ModelsResource", "AsyncModelsResource"]
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class ModelsResource(SyncAPIResource):
|
|
34
|
+
@cached_property
|
|
35
|
+
def with_raw_response(self) -> ModelsResourceWithRawResponse:
|
|
36
|
+
"""
|
|
37
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
38
|
+
the raw response object instead of the parsed content.
|
|
39
|
+
|
|
40
|
+
For more information, see https://www.github.com/scaleapi/sgp-python-beta#accessing-raw-response-data-eg-headers
|
|
41
|
+
"""
|
|
42
|
+
return ModelsResourceWithRawResponse(self)
|
|
43
|
+
|
|
44
|
+
@cached_property
|
|
45
|
+
def with_streaming_response(self) -> ModelsResourceWithStreamingResponse:
|
|
46
|
+
"""
|
|
47
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
48
|
+
|
|
49
|
+
For more information, see https://www.github.com/scaleapi/sgp-python-beta#with_streaming_response
|
|
50
|
+
"""
|
|
51
|
+
return ModelsResourceWithStreamingResponse(self)
|
|
52
|
+
|
|
53
|
+
@overload
|
|
54
|
+
def create(
|
|
55
|
+
self,
|
|
56
|
+
*,
|
|
57
|
+
name: str,
|
|
58
|
+
vendor_configuration: model_create_params.LaunchModelCreateRequestVendorConfiguration,
|
|
59
|
+
model_metadata: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
60
|
+
model_type: Literal["generic"] | NotGiven = NOT_GIVEN,
|
|
61
|
+
model_vendor: Literal["launch"] | NotGiven = NOT_GIVEN,
|
|
62
|
+
on_conflict: Literal["error", "update"] | NotGiven = NOT_GIVEN,
|
|
63
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
64
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
65
|
+
extra_headers: Headers | None = None,
|
|
66
|
+
extra_query: Query | None = None,
|
|
67
|
+
extra_body: Body | None = None,
|
|
68
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
69
|
+
) -> InferenceModel:
|
|
70
|
+
"""
|
|
71
|
+
Create Model
|
|
72
|
+
|
|
73
|
+
Args:
|
|
74
|
+
name: Unique name to reference your model
|
|
75
|
+
|
|
76
|
+
extra_headers: Send extra headers
|
|
77
|
+
|
|
78
|
+
extra_query: Add additional query parameters to the request
|
|
79
|
+
|
|
80
|
+
extra_body: Add additional JSON properties to the request
|
|
81
|
+
|
|
82
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
83
|
+
"""
|
|
84
|
+
...
|
|
85
|
+
|
|
86
|
+
@overload
|
|
87
|
+
def create(
|
|
88
|
+
self,
|
|
89
|
+
*,
|
|
90
|
+
name: str,
|
|
91
|
+
vendor_configuration: model_create_params.LlmEngineModelCreateRequestVendorConfiguration,
|
|
92
|
+
model_metadata: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
93
|
+
model_type: Literal["chat_completion"] | NotGiven = NOT_GIVEN,
|
|
94
|
+
model_vendor: Literal["llmengine"] | NotGiven = NOT_GIVEN,
|
|
95
|
+
on_conflict: Literal["error", "update"] | NotGiven = NOT_GIVEN,
|
|
96
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
97
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
98
|
+
extra_headers: Headers | None = None,
|
|
99
|
+
extra_query: Query | None = None,
|
|
100
|
+
extra_body: Body | None = None,
|
|
101
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
102
|
+
) -> InferenceModel:
|
|
103
|
+
"""
|
|
104
|
+
Create Model
|
|
105
|
+
|
|
106
|
+
Args:
|
|
107
|
+
name: Unique name to reference your model
|
|
108
|
+
|
|
109
|
+
extra_headers: Send extra headers
|
|
110
|
+
|
|
111
|
+
extra_query: Add additional query parameters to the request
|
|
112
|
+
|
|
113
|
+
extra_body: Add additional JSON properties to the request
|
|
114
|
+
|
|
115
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
116
|
+
"""
|
|
117
|
+
...
|
|
118
|
+
|
|
119
|
+
@required_args(["name", "vendor_configuration"])
|
|
120
|
+
def create(
|
|
121
|
+
self,
|
|
122
|
+
*,
|
|
123
|
+
name: str,
|
|
124
|
+
vendor_configuration: model_create_params.LaunchModelCreateRequestVendorConfiguration
|
|
125
|
+
| model_create_params.LlmEngineModelCreateRequestVendorConfiguration,
|
|
126
|
+
model_metadata: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
127
|
+
model_type: Literal["generic"] | Literal["chat_completion"] | NotGiven = NOT_GIVEN,
|
|
128
|
+
model_vendor: Literal["launch"] | Literal["llmengine"] | NotGiven = NOT_GIVEN,
|
|
129
|
+
on_conflict: Literal["error", "update"] | NotGiven = NOT_GIVEN,
|
|
130
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
131
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
132
|
+
extra_headers: Headers | None = None,
|
|
133
|
+
extra_query: Query | None = None,
|
|
134
|
+
extra_body: Body | None = None,
|
|
135
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
136
|
+
) -> InferenceModel:
|
|
137
|
+
return self._post(
|
|
138
|
+
"/v5/models",
|
|
139
|
+
body=maybe_transform(
|
|
140
|
+
{
|
|
141
|
+
"name": name,
|
|
142
|
+
"vendor_configuration": vendor_configuration,
|
|
143
|
+
"model_metadata": model_metadata,
|
|
144
|
+
"model_type": model_type,
|
|
145
|
+
"model_vendor": model_vendor,
|
|
146
|
+
"on_conflict": on_conflict,
|
|
147
|
+
},
|
|
148
|
+
model_create_params.ModelCreateParams,
|
|
149
|
+
),
|
|
150
|
+
options=make_request_options(
|
|
151
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
152
|
+
),
|
|
153
|
+
cast_to=InferenceModel,
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
def retrieve(
|
|
157
|
+
self,
|
|
158
|
+
model_id: str,
|
|
159
|
+
*,
|
|
160
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
161
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
162
|
+
extra_headers: Headers | None = None,
|
|
163
|
+
extra_query: Query | None = None,
|
|
164
|
+
extra_body: Body | None = None,
|
|
165
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
166
|
+
) -> InferenceModel:
|
|
167
|
+
"""
|
|
168
|
+
Get Model
|
|
169
|
+
|
|
170
|
+
Args:
|
|
171
|
+
extra_headers: Send extra headers
|
|
172
|
+
|
|
173
|
+
extra_query: Add additional query parameters to the request
|
|
174
|
+
|
|
175
|
+
extra_body: Add additional JSON properties to the request
|
|
176
|
+
|
|
177
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
178
|
+
"""
|
|
179
|
+
if not model_id:
|
|
180
|
+
raise ValueError(f"Expected a non-empty value for `model_id` but received {model_id!r}")
|
|
181
|
+
return self._get(
|
|
182
|
+
f"/v5/models/{model_id}",
|
|
183
|
+
options=make_request_options(
|
|
184
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
185
|
+
),
|
|
186
|
+
cast_to=InferenceModel,
|
|
187
|
+
)
|
|
188
|
+
|
|
189
|
+
@overload
|
|
190
|
+
def update(
|
|
191
|
+
self,
|
|
192
|
+
model_id: str,
|
|
193
|
+
*,
|
|
194
|
+
model_metadata: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
195
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
196
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
197
|
+
extra_headers: Headers | None = None,
|
|
198
|
+
extra_query: Query | None = None,
|
|
199
|
+
extra_body: Body | None = None,
|
|
200
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
201
|
+
) -> InferenceModel:
|
|
202
|
+
"""
|
|
203
|
+
Update Model
|
|
204
|
+
|
|
205
|
+
Args:
|
|
206
|
+
extra_headers: Send extra headers
|
|
207
|
+
|
|
208
|
+
extra_query: Add additional query parameters to the request
|
|
209
|
+
|
|
210
|
+
extra_body: Add additional JSON properties to the request
|
|
211
|
+
|
|
212
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
213
|
+
"""
|
|
214
|
+
...
|
|
215
|
+
|
|
216
|
+
@overload
|
|
217
|
+
def update(
|
|
218
|
+
self,
|
|
219
|
+
model_id: str,
|
|
220
|
+
*,
|
|
221
|
+
vendor_configuration: model_update_params.ModelConfigurationPatchRequestVendorConfiguration,
|
|
222
|
+
model_metadata: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
223
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
224
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
225
|
+
extra_headers: Headers | None = None,
|
|
226
|
+
extra_query: Query | None = None,
|
|
227
|
+
extra_body: Body | None = None,
|
|
228
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
229
|
+
) -> InferenceModel:
|
|
230
|
+
"""
|
|
231
|
+
Update Model
|
|
232
|
+
|
|
233
|
+
Args:
|
|
234
|
+
extra_headers: Send extra headers
|
|
235
|
+
|
|
236
|
+
extra_query: Add additional query parameters to the request
|
|
237
|
+
|
|
238
|
+
extra_body: Add additional JSON properties to the request
|
|
239
|
+
|
|
240
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
241
|
+
"""
|
|
242
|
+
...
|
|
243
|
+
|
|
244
|
+
@overload
|
|
245
|
+
def update(
|
|
246
|
+
self,
|
|
247
|
+
model_id: str,
|
|
248
|
+
*,
|
|
249
|
+
name: str,
|
|
250
|
+
on_conflict: Literal["error", "swap"] | NotGiven = NOT_GIVEN,
|
|
251
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
252
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
253
|
+
extra_headers: Headers | None = None,
|
|
254
|
+
extra_query: Query | None = None,
|
|
255
|
+
extra_body: Body | None = None,
|
|
256
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
257
|
+
) -> InferenceModel:
|
|
258
|
+
"""
|
|
259
|
+
Update Model
|
|
260
|
+
|
|
261
|
+
Args:
|
|
262
|
+
extra_headers: Send extra headers
|
|
263
|
+
|
|
264
|
+
extra_query: Add additional query parameters to the request
|
|
265
|
+
|
|
266
|
+
extra_body: Add additional JSON properties to the request
|
|
267
|
+
|
|
268
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
269
|
+
"""
|
|
270
|
+
...
|
|
271
|
+
|
|
272
|
+
def update(
|
|
273
|
+
self,
|
|
274
|
+
model_id: str,
|
|
275
|
+
*,
|
|
276
|
+
model_metadata: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
277
|
+
vendor_configuration: model_update_params.ModelConfigurationPatchRequestVendorConfiguration
|
|
278
|
+
| NotGiven = NOT_GIVEN,
|
|
279
|
+
name: str | NotGiven = NOT_GIVEN,
|
|
280
|
+
on_conflict: Literal["error", "swap"] | NotGiven = NOT_GIVEN,
|
|
281
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
282
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
283
|
+
extra_headers: Headers | None = None,
|
|
284
|
+
extra_query: Query | None = None,
|
|
285
|
+
extra_body: Body | None = None,
|
|
286
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
287
|
+
) -> InferenceModel:
|
|
288
|
+
if not model_id:
|
|
289
|
+
raise ValueError(f"Expected a non-empty value for `model_id` but received {model_id!r}")
|
|
290
|
+
return self._patch(
|
|
291
|
+
f"/v5/models/{model_id}",
|
|
292
|
+
body=maybe_transform(
|
|
293
|
+
{
|
|
294
|
+
"model_metadata": model_metadata,
|
|
295
|
+
"vendor_configuration": vendor_configuration,
|
|
296
|
+
"name": name,
|
|
297
|
+
"on_conflict": on_conflict,
|
|
298
|
+
},
|
|
299
|
+
model_update_params.ModelUpdateParams,
|
|
300
|
+
),
|
|
301
|
+
options=make_request_options(
|
|
302
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
303
|
+
),
|
|
304
|
+
cast_to=InferenceModel,
|
|
305
|
+
)
|
|
306
|
+
|
|
307
|
+
def list(
|
|
308
|
+
self,
|
|
309
|
+
*,
|
|
310
|
+
ending_before: Optional[str] | NotGiven = NOT_GIVEN,
|
|
311
|
+
limit: int | NotGiven = NOT_GIVEN,
|
|
312
|
+
model_vendor: Optional[
|
|
313
|
+
Literal["openai", "cohere", "vertex_ai", "anthropic", "launch", "llmengine", "model_zoo"]
|
|
314
|
+
]
|
|
315
|
+
| NotGiven = NOT_GIVEN,
|
|
316
|
+
name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
317
|
+
starting_after: Optional[str] | NotGiven = NOT_GIVEN,
|
|
318
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
319
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
320
|
+
extra_headers: Headers | None = None,
|
|
321
|
+
extra_query: Query | None = None,
|
|
322
|
+
extra_body: Body | None = None,
|
|
323
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
324
|
+
) -> SyncCursorPage[InferenceModel]:
|
|
325
|
+
"""
|
|
326
|
+
List Models
|
|
327
|
+
|
|
328
|
+
Args:
|
|
329
|
+
extra_headers: Send extra headers
|
|
330
|
+
|
|
331
|
+
extra_query: Add additional query parameters to the request
|
|
332
|
+
|
|
333
|
+
extra_body: Add additional JSON properties to the request
|
|
334
|
+
|
|
335
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
336
|
+
"""
|
|
337
|
+
return self._get_api_list(
|
|
338
|
+
"/v5/models",
|
|
339
|
+
page=SyncCursorPage[InferenceModel],
|
|
340
|
+
options=make_request_options(
|
|
341
|
+
extra_headers=extra_headers,
|
|
342
|
+
extra_query=extra_query,
|
|
343
|
+
extra_body=extra_body,
|
|
344
|
+
timeout=timeout,
|
|
345
|
+
query=maybe_transform(
|
|
346
|
+
{
|
|
347
|
+
"ending_before": ending_before,
|
|
348
|
+
"limit": limit,
|
|
349
|
+
"model_vendor": model_vendor,
|
|
350
|
+
"name": name,
|
|
351
|
+
"starting_after": starting_after,
|
|
352
|
+
},
|
|
353
|
+
model_list_params.ModelListParams,
|
|
354
|
+
),
|
|
355
|
+
),
|
|
356
|
+
model=InferenceModel,
|
|
357
|
+
)
|
|
358
|
+
|
|
359
|
+
def delete(
|
|
360
|
+
self,
|
|
361
|
+
model_id: str,
|
|
362
|
+
*,
|
|
363
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
364
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
365
|
+
extra_headers: Headers | None = None,
|
|
366
|
+
extra_query: Query | None = None,
|
|
367
|
+
extra_body: Body | None = None,
|
|
368
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
369
|
+
) -> ModelDeleteResponse:
|
|
370
|
+
"""
|
|
371
|
+
Delete Model
|
|
372
|
+
|
|
373
|
+
Args:
|
|
374
|
+
extra_headers: Send extra headers
|
|
375
|
+
|
|
376
|
+
extra_query: Add additional query parameters to the request
|
|
377
|
+
|
|
378
|
+
extra_body: Add additional JSON properties to the request
|
|
379
|
+
|
|
380
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
381
|
+
"""
|
|
382
|
+
if not model_id:
|
|
383
|
+
raise ValueError(f"Expected a non-empty value for `model_id` but received {model_id!r}")
|
|
384
|
+
return self._delete(
|
|
385
|
+
f"/v5/models/{model_id}",
|
|
386
|
+
options=make_request_options(
|
|
387
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
388
|
+
),
|
|
389
|
+
cast_to=ModelDeleteResponse,
|
|
390
|
+
)
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
class AsyncModelsResource(AsyncAPIResource):
|
|
394
|
+
@cached_property
|
|
395
|
+
def with_raw_response(self) -> AsyncModelsResourceWithRawResponse:
|
|
396
|
+
"""
|
|
397
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
398
|
+
the raw response object instead of the parsed content.
|
|
399
|
+
|
|
400
|
+
For more information, see https://www.github.com/scaleapi/sgp-python-beta#accessing-raw-response-data-eg-headers
|
|
401
|
+
"""
|
|
402
|
+
return AsyncModelsResourceWithRawResponse(self)
|
|
403
|
+
|
|
404
|
+
@cached_property
|
|
405
|
+
def with_streaming_response(self) -> AsyncModelsResourceWithStreamingResponse:
|
|
406
|
+
"""
|
|
407
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
408
|
+
|
|
409
|
+
For more information, see https://www.github.com/scaleapi/sgp-python-beta#with_streaming_response
|
|
410
|
+
"""
|
|
411
|
+
return AsyncModelsResourceWithStreamingResponse(self)
|
|
412
|
+
|
|
413
|
+
@overload
|
|
414
|
+
async def create(
|
|
415
|
+
self,
|
|
416
|
+
*,
|
|
417
|
+
name: str,
|
|
418
|
+
vendor_configuration: model_create_params.LaunchModelCreateRequestVendorConfiguration,
|
|
419
|
+
model_metadata: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
420
|
+
model_type: Literal["generic"] | NotGiven = NOT_GIVEN,
|
|
421
|
+
model_vendor: Literal["launch"] | NotGiven = NOT_GIVEN,
|
|
422
|
+
on_conflict: Literal["error", "update"] | NotGiven = NOT_GIVEN,
|
|
423
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
424
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
425
|
+
extra_headers: Headers | None = None,
|
|
426
|
+
extra_query: Query | None = None,
|
|
427
|
+
extra_body: Body | None = None,
|
|
428
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
429
|
+
) -> InferenceModel:
|
|
430
|
+
"""
|
|
431
|
+
Create Model
|
|
432
|
+
|
|
433
|
+
Args:
|
|
434
|
+
name: Unique name to reference your model
|
|
435
|
+
|
|
436
|
+
extra_headers: Send extra headers
|
|
437
|
+
|
|
438
|
+
extra_query: Add additional query parameters to the request
|
|
439
|
+
|
|
440
|
+
extra_body: Add additional JSON properties to the request
|
|
441
|
+
|
|
442
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
443
|
+
"""
|
|
444
|
+
...
|
|
445
|
+
|
|
446
|
+
@overload
|
|
447
|
+
async def create(
|
|
448
|
+
self,
|
|
449
|
+
*,
|
|
450
|
+
name: str,
|
|
451
|
+
vendor_configuration: model_create_params.LlmEngineModelCreateRequestVendorConfiguration,
|
|
452
|
+
model_metadata: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
453
|
+
model_type: Literal["chat_completion"] | NotGiven = NOT_GIVEN,
|
|
454
|
+
model_vendor: Literal["llmengine"] | NotGiven = NOT_GIVEN,
|
|
455
|
+
on_conflict: Literal["error", "update"] | NotGiven = NOT_GIVEN,
|
|
456
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
457
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
458
|
+
extra_headers: Headers | None = None,
|
|
459
|
+
extra_query: Query | None = None,
|
|
460
|
+
extra_body: Body | None = None,
|
|
461
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
462
|
+
) -> InferenceModel:
|
|
463
|
+
"""
|
|
464
|
+
Create Model
|
|
465
|
+
|
|
466
|
+
Args:
|
|
467
|
+
name: Unique name to reference your model
|
|
468
|
+
|
|
469
|
+
extra_headers: Send extra headers
|
|
470
|
+
|
|
471
|
+
extra_query: Add additional query parameters to the request
|
|
472
|
+
|
|
473
|
+
extra_body: Add additional JSON properties to the request
|
|
474
|
+
|
|
475
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
476
|
+
"""
|
|
477
|
+
...
|
|
478
|
+
|
|
479
|
+
@required_args(["name", "vendor_configuration"])
|
|
480
|
+
async def create(
|
|
481
|
+
self,
|
|
482
|
+
*,
|
|
483
|
+
name: str,
|
|
484
|
+
vendor_configuration: model_create_params.LaunchModelCreateRequestVendorConfiguration
|
|
485
|
+
| model_create_params.LlmEngineModelCreateRequestVendorConfiguration,
|
|
486
|
+
model_metadata: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
487
|
+
model_type: Literal["generic"] | Literal["chat_completion"] | NotGiven = NOT_GIVEN,
|
|
488
|
+
model_vendor: Literal["launch"] | Literal["llmengine"] | NotGiven = NOT_GIVEN,
|
|
489
|
+
on_conflict: Literal["error", "update"] | NotGiven = NOT_GIVEN,
|
|
490
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
491
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
492
|
+
extra_headers: Headers | None = None,
|
|
493
|
+
extra_query: Query | None = None,
|
|
494
|
+
extra_body: Body | None = None,
|
|
495
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
496
|
+
) -> InferenceModel:
|
|
497
|
+
return await self._post(
|
|
498
|
+
"/v5/models",
|
|
499
|
+
body=await async_maybe_transform(
|
|
500
|
+
{
|
|
501
|
+
"name": name,
|
|
502
|
+
"vendor_configuration": vendor_configuration,
|
|
503
|
+
"model_metadata": model_metadata,
|
|
504
|
+
"model_type": model_type,
|
|
505
|
+
"model_vendor": model_vendor,
|
|
506
|
+
"on_conflict": on_conflict,
|
|
507
|
+
},
|
|
508
|
+
model_create_params.ModelCreateParams,
|
|
509
|
+
),
|
|
510
|
+
options=make_request_options(
|
|
511
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
512
|
+
),
|
|
513
|
+
cast_to=InferenceModel,
|
|
514
|
+
)
|
|
515
|
+
|
|
516
|
+
async def retrieve(
|
|
517
|
+
self,
|
|
518
|
+
model_id: str,
|
|
519
|
+
*,
|
|
520
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
521
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
522
|
+
extra_headers: Headers | None = None,
|
|
523
|
+
extra_query: Query | None = None,
|
|
524
|
+
extra_body: Body | None = None,
|
|
525
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
526
|
+
) -> InferenceModel:
|
|
527
|
+
"""
|
|
528
|
+
Get Model
|
|
529
|
+
|
|
530
|
+
Args:
|
|
531
|
+
extra_headers: Send extra headers
|
|
532
|
+
|
|
533
|
+
extra_query: Add additional query parameters to the request
|
|
534
|
+
|
|
535
|
+
extra_body: Add additional JSON properties to the request
|
|
536
|
+
|
|
537
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
538
|
+
"""
|
|
539
|
+
if not model_id:
|
|
540
|
+
raise ValueError(f"Expected a non-empty value for `model_id` but received {model_id!r}")
|
|
541
|
+
return await self._get(
|
|
542
|
+
f"/v5/models/{model_id}",
|
|
543
|
+
options=make_request_options(
|
|
544
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
545
|
+
),
|
|
546
|
+
cast_to=InferenceModel,
|
|
547
|
+
)
|
|
548
|
+
|
|
549
|
+
@overload
|
|
550
|
+
async def update(
|
|
551
|
+
self,
|
|
552
|
+
model_id: str,
|
|
553
|
+
*,
|
|
554
|
+
model_metadata: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
555
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
556
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
557
|
+
extra_headers: Headers | None = None,
|
|
558
|
+
extra_query: Query | None = None,
|
|
559
|
+
extra_body: Body | None = None,
|
|
560
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
561
|
+
) -> InferenceModel:
|
|
562
|
+
"""
|
|
563
|
+
Update Model
|
|
564
|
+
|
|
565
|
+
Args:
|
|
566
|
+
extra_headers: Send extra headers
|
|
567
|
+
|
|
568
|
+
extra_query: Add additional query parameters to the request
|
|
569
|
+
|
|
570
|
+
extra_body: Add additional JSON properties to the request
|
|
571
|
+
|
|
572
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
573
|
+
"""
|
|
574
|
+
...
|
|
575
|
+
|
|
576
|
+
@overload
|
|
577
|
+
async def update(
|
|
578
|
+
self,
|
|
579
|
+
model_id: str,
|
|
580
|
+
*,
|
|
581
|
+
vendor_configuration: model_update_params.ModelConfigurationPatchRequestVendorConfiguration,
|
|
582
|
+
model_metadata: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
583
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
584
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
585
|
+
extra_headers: Headers | None = None,
|
|
586
|
+
extra_query: Query | None = None,
|
|
587
|
+
extra_body: Body | None = None,
|
|
588
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
589
|
+
) -> InferenceModel:
|
|
590
|
+
"""
|
|
591
|
+
Update Model
|
|
592
|
+
|
|
593
|
+
Args:
|
|
594
|
+
extra_headers: Send extra headers
|
|
595
|
+
|
|
596
|
+
extra_query: Add additional query parameters to the request
|
|
597
|
+
|
|
598
|
+
extra_body: Add additional JSON properties to the request
|
|
599
|
+
|
|
600
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
601
|
+
"""
|
|
602
|
+
...
|
|
603
|
+
|
|
604
|
+
@overload
|
|
605
|
+
async def update(
|
|
606
|
+
self,
|
|
607
|
+
model_id: str,
|
|
608
|
+
*,
|
|
609
|
+
name: str,
|
|
610
|
+
on_conflict: Literal["error", "swap"] | NotGiven = NOT_GIVEN,
|
|
611
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
612
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
613
|
+
extra_headers: Headers | None = None,
|
|
614
|
+
extra_query: Query | None = None,
|
|
615
|
+
extra_body: Body | None = None,
|
|
616
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
617
|
+
) -> InferenceModel:
|
|
618
|
+
"""
|
|
619
|
+
Update Model
|
|
620
|
+
|
|
621
|
+
Args:
|
|
622
|
+
extra_headers: Send extra headers
|
|
623
|
+
|
|
624
|
+
extra_query: Add additional query parameters to the request
|
|
625
|
+
|
|
626
|
+
extra_body: Add additional JSON properties to the request
|
|
627
|
+
|
|
628
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
629
|
+
"""
|
|
630
|
+
...
|
|
631
|
+
|
|
632
|
+
async def update(
|
|
633
|
+
self,
|
|
634
|
+
model_id: str,
|
|
635
|
+
*,
|
|
636
|
+
model_metadata: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
637
|
+
vendor_configuration: model_update_params.ModelConfigurationPatchRequestVendorConfiguration
|
|
638
|
+
| NotGiven = NOT_GIVEN,
|
|
639
|
+
name: str | NotGiven = NOT_GIVEN,
|
|
640
|
+
on_conflict: Literal["error", "swap"] | NotGiven = NOT_GIVEN,
|
|
641
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
642
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
643
|
+
extra_headers: Headers | None = None,
|
|
644
|
+
extra_query: Query | None = None,
|
|
645
|
+
extra_body: Body | None = None,
|
|
646
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
647
|
+
) -> InferenceModel:
|
|
648
|
+
if not model_id:
|
|
649
|
+
raise ValueError(f"Expected a non-empty value for `model_id` but received {model_id!r}")
|
|
650
|
+
return await self._patch(
|
|
651
|
+
f"/v5/models/{model_id}",
|
|
652
|
+
body=await async_maybe_transform(
|
|
653
|
+
{
|
|
654
|
+
"model_metadata": model_metadata,
|
|
655
|
+
"vendor_configuration": vendor_configuration,
|
|
656
|
+
"name": name,
|
|
657
|
+
"on_conflict": on_conflict,
|
|
658
|
+
},
|
|
659
|
+
model_update_params.ModelUpdateParams,
|
|
660
|
+
),
|
|
661
|
+
options=make_request_options(
|
|
662
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
663
|
+
),
|
|
664
|
+
cast_to=InferenceModel,
|
|
665
|
+
)
|
|
666
|
+
|
|
667
|
+
def list(
|
|
668
|
+
self,
|
|
669
|
+
*,
|
|
670
|
+
ending_before: Optional[str] | NotGiven = NOT_GIVEN,
|
|
671
|
+
limit: int | NotGiven = NOT_GIVEN,
|
|
672
|
+
model_vendor: Optional[
|
|
673
|
+
Literal["openai", "cohere", "vertex_ai", "anthropic", "launch", "llmengine", "model_zoo"]
|
|
674
|
+
]
|
|
675
|
+
| NotGiven = NOT_GIVEN,
|
|
676
|
+
name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
677
|
+
starting_after: Optional[str] | NotGiven = NOT_GIVEN,
|
|
678
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
679
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
680
|
+
extra_headers: Headers | None = None,
|
|
681
|
+
extra_query: Query | None = None,
|
|
682
|
+
extra_body: Body | None = None,
|
|
683
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
684
|
+
) -> AsyncPaginator[InferenceModel, AsyncCursorPage[InferenceModel]]:
|
|
685
|
+
"""
|
|
686
|
+
List Models
|
|
687
|
+
|
|
688
|
+
Args:
|
|
689
|
+
extra_headers: Send extra headers
|
|
690
|
+
|
|
691
|
+
extra_query: Add additional query parameters to the request
|
|
692
|
+
|
|
693
|
+
extra_body: Add additional JSON properties to the request
|
|
694
|
+
|
|
695
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
696
|
+
"""
|
|
697
|
+
return self._get_api_list(
|
|
698
|
+
"/v5/models",
|
|
699
|
+
page=AsyncCursorPage[InferenceModel],
|
|
700
|
+
options=make_request_options(
|
|
701
|
+
extra_headers=extra_headers,
|
|
702
|
+
extra_query=extra_query,
|
|
703
|
+
extra_body=extra_body,
|
|
704
|
+
timeout=timeout,
|
|
705
|
+
query=maybe_transform(
|
|
706
|
+
{
|
|
707
|
+
"ending_before": ending_before,
|
|
708
|
+
"limit": limit,
|
|
709
|
+
"model_vendor": model_vendor,
|
|
710
|
+
"name": name,
|
|
711
|
+
"starting_after": starting_after,
|
|
712
|
+
},
|
|
713
|
+
model_list_params.ModelListParams,
|
|
714
|
+
),
|
|
715
|
+
),
|
|
716
|
+
model=InferenceModel,
|
|
717
|
+
)
|
|
718
|
+
|
|
719
|
+
async def delete(
|
|
720
|
+
self,
|
|
721
|
+
model_id: str,
|
|
722
|
+
*,
|
|
723
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
724
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
725
|
+
extra_headers: Headers | None = None,
|
|
726
|
+
extra_query: Query | None = None,
|
|
727
|
+
extra_body: Body | None = None,
|
|
728
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
729
|
+
) -> ModelDeleteResponse:
|
|
730
|
+
"""
|
|
731
|
+
Delete Model
|
|
732
|
+
|
|
733
|
+
Args:
|
|
734
|
+
extra_headers: Send extra headers
|
|
735
|
+
|
|
736
|
+
extra_query: Add additional query parameters to the request
|
|
737
|
+
|
|
738
|
+
extra_body: Add additional JSON properties to the request
|
|
739
|
+
|
|
740
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
741
|
+
"""
|
|
742
|
+
if not model_id:
|
|
743
|
+
raise ValueError(f"Expected a non-empty value for `model_id` but received {model_id!r}")
|
|
744
|
+
return await self._delete(
|
|
745
|
+
f"/v5/models/{model_id}",
|
|
746
|
+
options=make_request_options(
|
|
747
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
748
|
+
),
|
|
749
|
+
cast_to=ModelDeleteResponse,
|
|
750
|
+
)
|
|
751
|
+
|
|
752
|
+
|
|
753
|
+
class ModelsResourceWithRawResponse:
|
|
754
|
+
def __init__(self, models: ModelsResource) -> None:
|
|
755
|
+
self._models = models
|
|
756
|
+
|
|
757
|
+
self.create = to_raw_response_wrapper(
|
|
758
|
+
models.create,
|
|
759
|
+
)
|
|
760
|
+
self.retrieve = to_raw_response_wrapper(
|
|
761
|
+
models.retrieve,
|
|
762
|
+
)
|
|
763
|
+
self.update = to_raw_response_wrapper(
|
|
764
|
+
models.update,
|
|
765
|
+
)
|
|
766
|
+
self.list = to_raw_response_wrapper(
|
|
767
|
+
models.list,
|
|
768
|
+
)
|
|
769
|
+
self.delete = to_raw_response_wrapper(
|
|
770
|
+
models.delete,
|
|
771
|
+
)
|
|
772
|
+
|
|
773
|
+
|
|
774
|
+
class AsyncModelsResourceWithRawResponse:
|
|
775
|
+
def __init__(self, models: AsyncModelsResource) -> None:
|
|
776
|
+
self._models = models
|
|
777
|
+
|
|
778
|
+
self.create = async_to_raw_response_wrapper(
|
|
779
|
+
models.create,
|
|
780
|
+
)
|
|
781
|
+
self.retrieve = async_to_raw_response_wrapper(
|
|
782
|
+
models.retrieve,
|
|
783
|
+
)
|
|
784
|
+
self.update = async_to_raw_response_wrapper(
|
|
785
|
+
models.update,
|
|
786
|
+
)
|
|
787
|
+
self.list = async_to_raw_response_wrapper(
|
|
788
|
+
models.list,
|
|
789
|
+
)
|
|
790
|
+
self.delete = async_to_raw_response_wrapper(
|
|
791
|
+
models.delete,
|
|
792
|
+
)
|
|
793
|
+
|
|
794
|
+
|
|
795
|
+
class ModelsResourceWithStreamingResponse:
|
|
796
|
+
def __init__(self, models: ModelsResource) -> None:
|
|
797
|
+
self._models = models
|
|
798
|
+
|
|
799
|
+
self.create = to_streamed_response_wrapper(
|
|
800
|
+
models.create,
|
|
801
|
+
)
|
|
802
|
+
self.retrieve = to_streamed_response_wrapper(
|
|
803
|
+
models.retrieve,
|
|
804
|
+
)
|
|
805
|
+
self.update = to_streamed_response_wrapper(
|
|
806
|
+
models.update,
|
|
807
|
+
)
|
|
808
|
+
self.list = to_streamed_response_wrapper(
|
|
809
|
+
models.list,
|
|
810
|
+
)
|
|
811
|
+
self.delete = to_streamed_response_wrapper(
|
|
812
|
+
models.delete,
|
|
813
|
+
)
|
|
814
|
+
|
|
815
|
+
|
|
816
|
+
class AsyncModelsResourceWithStreamingResponse:
|
|
817
|
+
def __init__(self, models: AsyncModelsResource) -> None:
|
|
818
|
+
self._models = models
|
|
819
|
+
|
|
820
|
+
self.create = async_to_streamed_response_wrapper(
|
|
821
|
+
models.create,
|
|
822
|
+
)
|
|
823
|
+
self.retrieve = async_to_streamed_response_wrapper(
|
|
824
|
+
models.retrieve,
|
|
825
|
+
)
|
|
826
|
+
self.update = async_to_streamed_response_wrapper(
|
|
827
|
+
models.update,
|
|
828
|
+
)
|
|
829
|
+
self.list = async_to_streamed_response_wrapper(
|
|
830
|
+
models.list,
|
|
831
|
+
)
|
|
832
|
+
self.delete = async_to_streamed_response_wrapper(
|
|
833
|
+
models.delete,
|
|
834
|
+
)
|