together 2.0.0a17__py3-none-any.whl → 2.0.0a19__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 (67) hide show
  1. together/_base_client.py +5 -2
  2. together/_client.py +1 -77
  3. together/_compat.py +3 -3
  4. together/_utils/_json.py +35 -0
  5. together/_version.py +1 -1
  6. together/lib/cli/api/beta/__init__.py +2 -0
  7. together/lib/cli/api/beta/jig/__init__.py +52 -0
  8. together/lib/cli/api/beta/jig/_config.py +170 -0
  9. together/lib/cli/api/beta/jig/jig.py +664 -0
  10. together/lib/cli/api/beta/jig/secrets.py +138 -0
  11. together/lib/cli/api/beta/jig/volumes.py +509 -0
  12. together/lib/cli/api/endpoints/create.py +7 -3
  13. together/lib/cli/api/endpoints/hardware.py +38 -7
  14. together/lib/cli/api/models/upload.py +5 -1
  15. together/resources/__init__.py +0 -28
  16. together/resources/beta/__init__.py +14 -0
  17. together/resources/beta/beta.py +32 -0
  18. together/resources/beta/clusters/clusters.py +12 -12
  19. together/resources/beta/clusters/storage.py +10 -10
  20. together/resources/beta/jig/__init__.py +61 -0
  21. together/resources/beta/jig/jig.py +1004 -0
  22. together/resources/beta/jig/queue.py +482 -0
  23. together/resources/beta/jig/secrets.py +548 -0
  24. together/resources/beta/jig/volumes.py +514 -0
  25. together/resources/chat/completions.py +10 -0
  26. together/resources/endpoints.py +103 -1
  27. together/resources/models/__init__.py +33 -0
  28. together/resources/{models.py → models/models.py} +41 -9
  29. together/resources/models/uploads.py +163 -0
  30. together/types/__init__.py +2 -4
  31. together/types/beta/__init__.py +6 -0
  32. together/types/beta/deployment.py +261 -0
  33. together/types/beta/deployment_logs.py +11 -0
  34. together/types/beta/jig/__init__.py +20 -0
  35. together/types/beta/jig/queue_cancel_params.py +13 -0
  36. together/types/beta/jig/queue_cancel_response.py +11 -0
  37. together/types/beta/jig/queue_metrics_params.py +12 -0
  38. together/types/beta/jig/queue_metrics_response.py +8 -0
  39. together/types/beta/jig/queue_retrieve_params.py +15 -0
  40. together/types/beta/jig/queue_retrieve_response.py +35 -0
  41. together/types/beta/jig/queue_submit_params.py +19 -0
  42. together/types/beta/jig/queue_submit_response.py +25 -0
  43. together/types/beta/jig/secret.py +33 -0
  44. together/types/beta/jig/secret_create_params.py +34 -0
  45. together/types/beta/jig/secret_list_response.py +16 -0
  46. together/types/beta/jig/secret_update_params.py +34 -0
  47. together/types/beta/jig/volume.py +47 -0
  48. together/types/beta/jig/volume_create_params.py +34 -0
  49. together/types/beta/jig/volume_list_response.py +16 -0
  50. together/types/beta/jig/volume_update_params.py +34 -0
  51. together/types/beta/jig_deploy_params.py +150 -0
  52. together/types/beta/jig_list_response.py +16 -0
  53. together/types/beta/jig_retrieve_logs_params.py +12 -0
  54. together/types/beta/jig_update_params.py +141 -0
  55. together/types/chat/completion_create_params.py +11 -0
  56. together/types/{hardware_list_params.py → endpoint_list_hardware_params.py} +2 -2
  57. together/types/{hardware_list_response.py → endpoint_list_hardware_response.py} +2 -2
  58. together/types/models/__init__.py +5 -0
  59. together/types/{job_retrieve_response.py → models/upload_status_response.py} +3 -3
  60. {together-2.0.0a17.dist-info → together-2.0.0a19.dist-info}/METADATA +15 -14
  61. {together-2.0.0a17.dist-info → together-2.0.0a19.dist-info}/RECORD +64 -30
  62. together/resources/hardware.py +0 -181
  63. together/resources/jobs.py +0 -214
  64. together/types/job_list_response.py +0 -47
  65. {together-2.0.0a17.dist-info → together-2.0.0a19.dist-info}/WHEEL +0 -0
  66. {together-2.0.0a17.dist-info → together-2.0.0a19.dist-info}/entry_points.txt +0 -0
  67. {together-2.0.0a17.dist-info → together-2.0.0a19.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,482 @@
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
6
+
7
+ import httpx
8
+
9
+ from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
10
+ from ...._utils import maybe_transform, async_maybe_transform
11
+ from ...._compat import cached_property
12
+ from ...._resource import SyncAPIResource, AsyncAPIResource
13
+ from ...._response import (
14
+ to_raw_response_wrapper,
15
+ to_streamed_response_wrapper,
16
+ async_to_raw_response_wrapper,
17
+ async_to_streamed_response_wrapper,
18
+ )
19
+ from ...._base_client import make_request_options
20
+ from ....types.beta.jig import queue_cancel_params, queue_submit_params, queue_metrics_params, queue_retrieve_params
21
+ from ....types.beta.jig.queue_cancel_response import QueueCancelResponse
22
+ from ....types.beta.jig.queue_submit_response import QueueSubmitResponse
23
+ from ....types.beta.jig.queue_metrics_response import QueueMetricsResponse
24
+ from ....types.beta.jig.queue_retrieve_response import QueueRetrieveResponse
25
+
26
+ __all__ = ["QueueResource", "AsyncQueueResource"]
27
+
28
+
29
+ class QueueResource(SyncAPIResource):
30
+ @cached_property
31
+ def with_raw_response(self) -> QueueResourceWithRawResponse:
32
+ """
33
+ This property can be used as a prefix for any HTTP method call to return
34
+ the raw response object instead of the parsed content.
35
+
36
+ For more information, see https://www.github.com/togethercomputer/together-py#accessing-raw-response-data-eg-headers
37
+ """
38
+ return QueueResourceWithRawResponse(self)
39
+
40
+ @cached_property
41
+ def with_streaming_response(self) -> QueueResourceWithStreamingResponse:
42
+ """
43
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
44
+
45
+ For more information, see https://www.github.com/togethercomputer/together-py#with_streaming_response
46
+ """
47
+ return QueueResourceWithStreamingResponse(self)
48
+
49
+ def retrieve(
50
+ self,
51
+ *,
52
+ model: str,
53
+ request_id: str,
54
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
55
+ # The extra values given here take precedence over values defined on the client or passed to this method.
56
+ extra_headers: Headers | None = None,
57
+ extra_query: Query | None = None,
58
+ extra_body: Body | None = None,
59
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
60
+ ) -> QueueRetrieveResponse:
61
+ """
62
+ Check the status of a job using request_id and model query parameters.
63
+
64
+ Args:
65
+ model: Model name
66
+
67
+ request_id: Request ID
68
+
69
+ extra_headers: Send extra headers
70
+
71
+ extra_query: Add additional query parameters to the request
72
+
73
+ extra_body: Add additional JSON properties to the request
74
+
75
+ timeout: Override the client-level default timeout for this request, in seconds
76
+ """
77
+ return self._get(
78
+ "/queue/status",
79
+ options=make_request_options(
80
+ extra_headers=extra_headers,
81
+ extra_query=extra_query,
82
+ extra_body=extra_body,
83
+ timeout=timeout,
84
+ query=maybe_transform(
85
+ {
86
+ "model": model,
87
+ "request_id": request_id,
88
+ },
89
+ queue_retrieve_params.QueueRetrieveParams,
90
+ ),
91
+ ),
92
+ cast_to=QueueRetrieveResponse,
93
+ )
94
+
95
+ def cancel(
96
+ self,
97
+ *,
98
+ model: str,
99
+ request_id: str,
100
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
101
+ # The extra values given here take precedence over values defined on the client or passed to this method.
102
+ extra_headers: Headers | None = None,
103
+ extra_query: Query | None = None,
104
+ extra_body: Body | None = None,
105
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
106
+ ) -> QueueCancelResponse:
107
+ """Cancel a pending or running job.
108
+
109
+ Returns the job status after the cancellation
110
+ attempt.
111
+
112
+ Args:
113
+ extra_headers: Send extra headers
114
+
115
+ extra_query: Add additional query parameters to the request
116
+
117
+ extra_body: Add additional JSON properties to the request
118
+
119
+ timeout: Override the client-level default timeout for this request, in seconds
120
+ """
121
+ return self._post(
122
+ "/queue/cancel",
123
+ body=maybe_transform(
124
+ {
125
+ "model": model,
126
+ "request_id": request_id,
127
+ },
128
+ queue_cancel_params.QueueCancelParams,
129
+ ),
130
+ options=make_request_options(
131
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
132
+ ),
133
+ cast_to=QueueCancelResponse,
134
+ )
135
+
136
+ def metrics(
137
+ self,
138
+ *,
139
+ model: str,
140
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
141
+ # The extra values given here take precedence over values defined on the client or passed to this method.
142
+ extra_headers: Headers | None = None,
143
+ extra_query: Query | None = None,
144
+ extra_body: Body | None = None,
145
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
146
+ ) -> QueueMetricsResponse:
147
+ """
148
+ Get the current queue statistics including pending and running job counts.
149
+
150
+ Args:
151
+ model: Model name to get metrics for
152
+
153
+ extra_headers: Send extra headers
154
+
155
+ extra_query: Add additional query parameters to the request
156
+
157
+ extra_body: Add additional JSON properties to the request
158
+
159
+ timeout: Override the client-level default timeout for this request, in seconds
160
+ """
161
+ return self._get(
162
+ "/queue/metrics",
163
+ options=make_request_options(
164
+ extra_headers=extra_headers,
165
+ extra_query=extra_query,
166
+ extra_body=extra_body,
167
+ timeout=timeout,
168
+ query=maybe_transform({"model": model}, queue_metrics_params.QueueMetricsParams),
169
+ ),
170
+ cast_to=QueueMetricsResponse,
171
+ )
172
+
173
+ def submit(
174
+ self,
175
+ *,
176
+ model: str,
177
+ payload: Dict[str, object],
178
+ info: Dict[str, object] | Omit = omit,
179
+ priority: int | Omit = omit,
180
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
181
+ # The extra values given here take precedence over values defined on the client or passed to this method.
182
+ extra_headers: Headers | None = None,
183
+ extra_query: Query | None = None,
184
+ extra_body: Body | None = None,
185
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
186
+ ) -> QueueSubmitResponse:
187
+ """Submit a new job to the queue.
188
+
189
+ Returns a request ID that can be used to check
190
+ status.
191
+
192
+ Args:
193
+ model: Required model identifier
194
+
195
+ extra_headers: Send extra headers
196
+
197
+ extra_query: Add additional query parameters to the request
198
+
199
+ extra_body: Add additional JSON properties to the request
200
+
201
+ timeout: Override the client-level default timeout for this request, in seconds
202
+ """
203
+ return self._post(
204
+ "/queue/submit",
205
+ body=maybe_transform(
206
+ {
207
+ "model": model,
208
+ "payload": payload,
209
+ "info": info,
210
+ "priority": priority,
211
+ },
212
+ queue_submit_params.QueueSubmitParams,
213
+ ),
214
+ options=make_request_options(
215
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
216
+ ),
217
+ cast_to=QueueSubmitResponse,
218
+ )
219
+
220
+
221
+ class AsyncQueueResource(AsyncAPIResource):
222
+ @cached_property
223
+ def with_raw_response(self) -> AsyncQueueResourceWithRawResponse:
224
+ """
225
+ This property can be used as a prefix for any HTTP method call to return
226
+ the raw response object instead of the parsed content.
227
+
228
+ For more information, see https://www.github.com/togethercomputer/together-py#accessing-raw-response-data-eg-headers
229
+ """
230
+ return AsyncQueueResourceWithRawResponse(self)
231
+
232
+ @cached_property
233
+ def with_streaming_response(self) -> AsyncQueueResourceWithStreamingResponse:
234
+ """
235
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
236
+
237
+ For more information, see https://www.github.com/togethercomputer/together-py#with_streaming_response
238
+ """
239
+ return AsyncQueueResourceWithStreamingResponse(self)
240
+
241
+ async def retrieve(
242
+ self,
243
+ *,
244
+ model: str,
245
+ request_id: str,
246
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
247
+ # The extra values given here take precedence over values defined on the client or passed to this method.
248
+ extra_headers: Headers | None = None,
249
+ extra_query: Query | None = None,
250
+ extra_body: Body | None = None,
251
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
252
+ ) -> QueueRetrieveResponse:
253
+ """
254
+ Check the status of a job using request_id and model query parameters.
255
+
256
+ Args:
257
+ model: Model name
258
+
259
+ request_id: Request ID
260
+
261
+ extra_headers: Send extra headers
262
+
263
+ extra_query: Add additional query parameters to the request
264
+
265
+ extra_body: Add additional JSON properties to the request
266
+
267
+ timeout: Override the client-level default timeout for this request, in seconds
268
+ """
269
+ return await self._get(
270
+ "/queue/status",
271
+ options=make_request_options(
272
+ extra_headers=extra_headers,
273
+ extra_query=extra_query,
274
+ extra_body=extra_body,
275
+ timeout=timeout,
276
+ query=await async_maybe_transform(
277
+ {
278
+ "model": model,
279
+ "request_id": request_id,
280
+ },
281
+ queue_retrieve_params.QueueRetrieveParams,
282
+ ),
283
+ ),
284
+ cast_to=QueueRetrieveResponse,
285
+ )
286
+
287
+ async def cancel(
288
+ self,
289
+ *,
290
+ model: str,
291
+ request_id: str,
292
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
293
+ # The extra values given here take precedence over values defined on the client or passed to this method.
294
+ extra_headers: Headers | None = None,
295
+ extra_query: Query | None = None,
296
+ extra_body: Body | None = None,
297
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
298
+ ) -> QueueCancelResponse:
299
+ """Cancel a pending or running job.
300
+
301
+ Returns the job status after the cancellation
302
+ attempt.
303
+
304
+ Args:
305
+ extra_headers: Send extra headers
306
+
307
+ extra_query: Add additional query parameters to the request
308
+
309
+ extra_body: Add additional JSON properties to the request
310
+
311
+ timeout: Override the client-level default timeout for this request, in seconds
312
+ """
313
+ return await self._post(
314
+ "/queue/cancel",
315
+ body=await async_maybe_transform(
316
+ {
317
+ "model": model,
318
+ "request_id": request_id,
319
+ },
320
+ queue_cancel_params.QueueCancelParams,
321
+ ),
322
+ options=make_request_options(
323
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
324
+ ),
325
+ cast_to=QueueCancelResponse,
326
+ )
327
+
328
+ async def metrics(
329
+ self,
330
+ *,
331
+ model: str,
332
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
333
+ # The extra values given here take precedence over values defined on the client or passed to this method.
334
+ extra_headers: Headers | None = None,
335
+ extra_query: Query | None = None,
336
+ extra_body: Body | None = None,
337
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
338
+ ) -> QueueMetricsResponse:
339
+ """
340
+ Get the current queue statistics including pending and running job counts.
341
+
342
+ Args:
343
+ model: Model name to get metrics for
344
+
345
+ extra_headers: Send extra headers
346
+
347
+ extra_query: Add additional query parameters to the request
348
+
349
+ extra_body: Add additional JSON properties to the request
350
+
351
+ timeout: Override the client-level default timeout for this request, in seconds
352
+ """
353
+ return await self._get(
354
+ "/queue/metrics",
355
+ options=make_request_options(
356
+ extra_headers=extra_headers,
357
+ extra_query=extra_query,
358
+ extra_body=extra_body,
359
+ timeout=timeout,
360
+ query=await async_maybe_transform({"model": model}, queue_metrics_params.QueueMetricsParams),
361
+ ),
362
+ cast_to=QueueMetricsResponse,
363
+ )
364
+
365
+ async def submit(
366
+ self,
367
+ *,
368
+ model: str,
369
+ payload: Dict[str, object],
370
+ info: Dict[str, object] | Omit = omit,
371
+ priority: int | Omit = omit,
372
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
373
+ # The extra values given here take precedence over values defined on the client or passed to this method.
374
+ extra_headers: Headers | None = None,
375
+ extra_query: Query | None = None,
376
+ extra_body: Body | None = None,
377
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
378
+ ) -> QueueSubmitResponse:
379
+ """Submit a new job to the queue.
380
+
381
+ Returns a request ID that can be used to check
382
+ status.
383
+
384
+ Args:
385
+ model: Required model identifier
386
+
387
+ extra_headers: Send extra headers
388
+
389
+ extra_query: Add additional query parameters to the request
390
+
391
+ extra_body: Add additional JSON properties to the request
392
+
393
+ timeout: Override the client-level default timeout for this request, in seconds
394
+ """
395
+ return await self._post(
396
+ "/queue/submit",
397
+ body=await async_maybe_transform(
398
+ {
399
+ "model": model,
400
+ "payload": payload,
401
+ "info": info,
402
+ "priority": priority,
403
+ },
404
+ queue_submit_params.QueueSubmitParams,
405
+ ),
406
+ options=make_request_options(
407
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
408
+ ),
409
+ cast_to=QueueSubmitResponse,
410
+ )
411
+
412
+
413
+ class QueueResourceWithRawResponse:
414
+ def __init__(self, queue: QueueResource) -> None:
415
+ self._queue = queue
416
+
417
+ self.retrieve = to_raw_response_wrapper(
418
+ queue.retrieve,
419
+ )
420
+ self.cancel = to_raw_response_wrapper(
421
+ queue.cancel,
422
+ )
423
+ self.metrics = to_raw_response_wrapper(
424
+ queue.metrics,
425
+ )
426
+ self.submit = to_raw_response_wrapper(
427
+ queue.submit,
428
+ )
429
+
430
+
431
+ class AsyncQueueResourceWithRawResponse:
432
+ def __init__(self, queue: AsyncQueueResource) -> None:
433
+ self._queue = queue
434
+
435
+ self.retrieve = async_to_raw_response_wrapper(
436
+ queue.retrieve,
437
+ )
438
+ self.cancel = async_to_raw_response_wrapper(
439
+ queue.cancel,
440
+ )
441
+ self.metrics = async_to_raw_response_wrapper(
442
+ queue.metrics,
443
+ )
444
+ self.submit = async_to_raw_response_wrapper(
445
+ queue.submit,
446
+ )
447
+
448
+
449
+ class QueueResourceWithStreamingResponse:
450
+ def __init__(self, queue: QueueResource) -> None:
451
+ self._queue = queue
452
+
453
+ self.retrieve = to_streamed_response_wrapper(
454
+ queue.retrieve,
455
+ )
456
+ self.cancel = to_streamed_response_wrapper(
457
+ queue.cancel,
458
+ )
459
+ self.metrics = to_streamed_response_wrapper(
460
+ queue.metrics,
461
+ )
462
+ self.submit = to_streamed_response_wrapper(
463
+ queue.submit,
464
+ )
465
+
466
+
467
+ class AsyncQueueResourceWithStreamingResponse:
468
+ def __init__(self, queue: AsyncQueueResource) -> None:
469
+ self._queue = queue
470
+
471
+ self.retrieve = async_to_streamed_response_wrapper(
472
+ queue.retrieve,
473
+ )
474
+ self.cancel = async_to_streamed_response_wrapper(
475
+ queue.cancel,
476
+ )
477
+ self.metrics = async_to_streamed_response_wrapper(
478
+ queue.metrics,
479
+ )
480
+ self.submit = async_to_streamed_response_wrapper(
481
+ queue.submit,
482
+ )