scope-client 1.4.912__py3-none-any.whl → 1.4.913__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 (28) hide show
  1. scope_client/api_bindings/__init__.py +19 -0
  2. scope_client/api_bindings/api/__init__.py +1 -0
  3. scope_client/api_bindings/api/tasks_v1_api.py +1757 -0
  4. scope_client/api_bindings/models/__init__.py +18 -0
  5. scope_client/api_bindings/models/config.py +185 -0
  6. scope_client/api_bindings/models/config1.py +185 -0
  7. scope_client/api_bindings/models/example_config.py +89 -0
  8. scope_client/api_bindings/models/examples_config.py +102 -0
  9. scope_client/api_bindings/models/keywords_config.py +87 -0
  10. scope_client/api_bindings/models/metrics_query_result.py +2 -2
  11. scope_client/api_bindings/models/new_rule_request.py +104 -0
  12. scope_client/api_bindings/models/patch_task_request.py +101 -0
  13. scope_client/api_bindings/models/permission_name.py +6 -0
  14. scope_client/api_bindings/models/pii_config.py +106 -0
  15. scope_client/api_bindings/models/post_task_request.py +105 -0
  16. scope_client/api_bindings/models/put_task_state_cache_request.py +91 -0
  17. scope_client/api_bindings/models/regex_config.py +87 -0
  18. scope_client/api_bindings/models/rule_response.py +121 -0
  19. scope_client/api_bindings/models/rule_scope.py +37 -0
  20. scope_client/api_bindings/models/rule_type.py +44 -0
  21. scope_client/api_bindings/models/task_mutation_response.py +87 -0
  22. scope_client/api_bindings/models/task_read_response.py +106 -0
  23. scope_client/api_bindings/models/task_response.py +103 -0
  24. scope_client/api_bindings/models/toxicity_config.py +100 -0
  25. {scope_client-1.4.912.dist-info → scope_client-1.4.913.dist-info}/METADATA +1 -1
  26. {scope_client-1.4.912.dist-info → scope_client-1.4.913.dist-info}/RECORD +28 -9
  27. {scope_client-1.4.912.dist-info → scope_client-1.4.913.dist-info}/WHEEL +0 -0
  28. {scope_client-1.4.912.dist-info → scope_client-1.4.913.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,1757 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Arthur Scope
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: 0.1.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+ import warnings
15
+ from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
16
+ from typing import Any, Dict, List, Optional, Tuple, Union
17
+ from typing_extensions import Annotated
18
+
19
+ from pydantic import StrictStr
20
+ from scope_client.api_bindings.models.patch_task_request import PatchTaskRequest
21
+ from scope_client.api_bindings.models.post_task_request import PostTaskRequest
22
+ from scope_client.api_bindings.models.put_task_state_cache_request import PutTaskStateCacheRequest
23
+ from scope_client.api_bindings.models.task_mutation_response import TaskMutationResponse
24
+ from scope_client.api_bindings.models.task_read_response import TaskReadResponse
25
+
26
+ from scope_client.api_bindings.api_client import ApiClient, RequestSerialized
27
+ from scope_client.api_bindings.api_response import ApiResponse
28
+ from scope_client.api_bindings.rest import RESTResponseType
29
+
30
+
31
+ class TasksV1Api:
32
+ """NOTE: This class is auto generated by OpenAPI Generator
33
+ Ref: https://openapi-generator.tech
34
+
35
+ Do not edit the class manually.
36
+ """
37
+
38
+ def __init__(self, api_client=None) -> None:
39
+ if api_client is None:
40
+ api_client = ApiClient.get_default()
41
+ self.api_client = api_client
42
+
43
+
44
+ @validate_call
45
+ def delete_task(
46
+ self,
47
+ model_id: StrictStr,
48
+ _request_timeout: Union[
49
+ None,
50
+ Annotated[StrictFloat, Field(gt=0)],
51
+ Tuple[
52
+ Annotated[StrictFloat, Field(gt=0)],
53
+ Annotated[StrictFloat, Field(gt=0)]
54
+ ]
55
+ ] = None,
56
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
57
+ _content_type: Optional[StrictStr] = None,
58
+ _headers: Optional[Dict[StrictStr, Any]] = None,
59
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
60
+ ) -> TaskMutationResponse:
61
+ """Delete A Task
62
+
63
+ Submits a job to delete the task and the corresponding platform model, and returns the job ID. Requires model_task_delete permission.
64
+
65
+ :param model_id: (required)
66
+ :type model_id: str
67
+ :param _request_timeout: timeout setting for this request. If one
68
+ number provided, it will be total request
69
+ timeout. It can also be a pair (tuple) of
70
+ (connection, read) timeouts.
71
+ :type _request_timeout: int, tuple(int, int), optional
72
+ :param _request_auth: set to override the auth_settings for an a single
73
+ request; this effectively ignores the
74
+ authentication in the spec for a single request.
75
+ :type _request_auth: dict, optional
76
+ :param _content_type: force content-type for the request.
77
+ :type _content_type: str, Optional
78
+ :param _headers: set to override the headers for a single
79
+ request; this effectively ignores the headers
80
+ in the spec for a single request.
81
+ :type _headers: dict, optional
82
+ :param _host_index: set to override the host_index for a single
83
+ request; this effectively ignores the host_index
84
+ in the spec for a single request.
85
+ :type _host_index: int, optional
86
+ :return: Returns the result object.
87
+ """ # noqa: E501
88
+
89
+ _param = self._delete_task_serialize(
90
+ model_id=model_id,
91
+ _request_auth=_request_auth,
92
+ _content_type=_content_type,
93
+ _headers=_headers,
94
+ _host_index=_host_index
95
+ )
96
+
97
+ _response_types_map: Dict[str, Optional[str]] = {
98
+ '200': "TaskMutationResponse",
99
+ '500': "InternalServerError",
100
+ '404': "NotFoundError",
101
+ '422': "HTTPValidationError",
102
+ }
103
+ response_data = self.api_client.call_api(
104
+ *_param,
105
+ _request_timeout=_request_timeout
106
+ )
107
+ response_data.read()
108
+ return self.api_client.response_deserialize(
109
+ response_data=response_data,
110
+ response_types_map=_response_types_map,
111
+ ).data
112
+
113
+
114
+ @validate_call
115
+ def delete_task_with_http_info(
116
+ self,
117
+ model_id: StrictStr,
118
+ _request_timeout: Union[
119
+ None,
120
+ Annotated[StrictFloat, Field(gt=0)],
121
+ Tuple[
122
+ Annotated[StrictFloat, Field(gt=0)],
123
+ Annotated[StrictFloat, Field(gt=0)]
124
+ ]
125
+ ] = None,
126
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
127
+ _content_type: Optional[StrictStr] = None,
128
+ _headers: Optional[Dict[StrictStr, Any]] = None,
129
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
130
+ ) -> ApiResponse[TaskMutationResponse]:
131
+ """Delete A Task
132
+
133
+ Submits a job to delete the task and the corresponding platform model, and returns the job ID. Requires model_task_delete permission.
134
+
135
+ :param model_id: (required)
136
+ :type model_id: str
137
+ :param _request_timeout: timeout setting for this request. If one
138
+ number provided, it will be total request
139
+ timeout. It can also be a pair (tuple) of
140
+ (connection, read) timeouts.
141
+ :type _request_timeout: int, tuple(int, int), optional
142
+ :param _request_auth: set to override the auth_settings for an a single
143
+ request; this effectively ignores the
144
+ authentication in the spec for a single request.
145
+ :type _request_auth: dict, optional
146
+ :param _content_type: force content-type for the request.
147
+ :type _content_type: str, Optional
148
+ :param _headers: set to override the headers for a single
149
+ request; this effectively ignores the headers
150
+ in the spec for a single request.
151
+ :type _headers: dict, optional
152
+ :param _host_index: set to override the host_index for a single
153
+ request; this effectively ignores the host_index
154
+ in the spec for a single request.
155
+ :type _host_index: int, optional
156
+ :return: Returns the result object.
157
+ """ # noqa: E501
158
+
159
+ _param = self._delete_task_serialize(
160
+ model_id=model_id,
161
+ _request_auth=_request_auth,
162
+ _content_type=_content_type,
163
+ _headers=_headers,
164
+ _host_index=_host_index
165
+ )
166
+
167
+ _response_types_map: Dict[str, Optional[str]] = {
168
+ '200': "TaskMutationResponse",
169
+ '500': "InternalServerError",
170
+ '404': "NotFoundError",
171
+ '422': "HTTPValidationError",
172
+ }
173
+ response_data = self.api_client.call_api(
174
+ *_param,
175
+ _request_timeout=_request_timeout
176
+ )
177
+ response_data.read()
178
+ return self.api_client.response_deserialize(
179
+ response_data=response_data,
180
+ response_types_map=_response_types_map,
181
+ )
182
+
183
+
184
+ @validate_call
185
+ def delete_task_without_preload_content(
186
+ self,
187
+ model_id: StrictStr,
188
+ _request_timeout: Union[
189
+ None,
190
+ Annotated[StrictFloat, Field(gt=0)],
191
+ Tuple[
192
+ Annotated[StrictFloat, Field(gt=0)],
193
+ Annotated[StrictFloat, Field(gt=0)]
194
+ ]
195
+ ] = None,
196
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
197
+ _content_type: Optional[StrictStr] = None,
198
+ _headers: Optional[Dict[StrictStr, Any]] = None,
199
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
200
+ ) -> RESTResponseType:
201
+ """Delete A Task
202
+
203
+ Submits a job to delete the task and the corresponding platform model, and returns the job ID. Requires model_task_delete permission.
204
+
205
+ :param model_id: (required)
206
+ :type model_id: str
207
+ :param _request_timeout: timeout setting for this request. If one
208
+ number provided, it will be total request
209
+ timeout. It can also be a pair (tuple) of
210
+ (connection, read) timeouts.
211
+ :type _request_timeout: int, tuple(int, int), optional
212
+ :param _request_auth: set to override the auth_settings for an a single
213
+ request; this effectively ignores the
214
+ authentication in the spec for a single request.
215
+ :type _request_auth: dict, optional
216
+ :param _content_type: force content-type for the request.
217
+ :type _content_type: str, Optional
218
+ :param _headers: set to override the headers for a single
219
+ request; this effectively ignores the headers
220
+ in the spec for a single request.
221
+ :type _headers: dict, optional
222
+ :param _host_index: set to override the host_index for a single
223
+ request; this effectively ignores the host_index
224
+ in the spec for a single request.
225
+ :type _host_index: int, optional
226
+ :return: Returns the result object.
227
+ """ # noqa: E501
228
+
229
+ _param = self._delete_task_serialize(
230
+ model_id=model_id,
231
+ _request_auth=_request_auth,
232
+ _content_type=_content_type,
233
+ _headers=_headers,
234
+ _host_index=_host_index
235
+ )
236
+
237
+ _response_types_map: Dict[str, Optional[str]] = {
238
+ '200': "TaskMutationResponse",
239
+ '500': "InternalServerError",
240
+ '404': "NotFoundError",
241
+ '422': "HTTPValidationError",
242
+ }
243
+ response_data = self.api_client.call_api(
244
+ *_param,
245
+ _request_timeout=_request_timeout
246
+ )
247
+ return response_data.response
248
+
249
+
250
+ def _delete_task_serialize(
251
+ self,
252
+ model_id,
253
+ _request_auth,
254
+ _content_type,
255
+ _headers,
256
+ _host_index,
257
+ ) -> RequestSerialized:
258
+
259
+ _host = None
260
+
261
+ _collection_formats: Dict[str, str] = {
262
+ }
263
+
264
+ _path_params: Dict[str, str] = {}
265
+ _query_params: List[Tuple[str, str]] = []
266
+ _header_params: Dict[str, Optional[str]] = _headers or {}
267
+ _form_params: List[Tuple[str, str]] = []
268
+ _files: Dict[
269
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
270
+ ] = {}
271
+ _body_params: Optional[bytes] = None
272
+
273
+ # process the path parameters
274
+ if model_id is not None:
275
+ _path_params['model_id'] = model_id
276
+ # process the query parameters
277
+ # process the header parameters
278
+ # process the form parameters
279
+ # process the body parameter
280
+
281
+
282
+ # set the HTTP header `Accept`
283
+ if 'Accept' not in _header_params:
284
+ _header_params['Accept'] = self.api_client.select_header_accept(
285
+ [
286
+ 'application/json'
287
+ ]
288
+ )
289
+
290
+
291
+ # authentication setting
292
+ _auth_settings: List[str] = [
293
+ 'OAuth2AuthorizationCode'
294
+ ]
295
+
296
+ return self.api_client.param_serialize(
297
+ method='DELETE',
298
+ resource_path='/api/v1/models/{model_id}/task',
299
+ path_params=_path_params,
300
+ query_params=_query_params,
301
+ header_params=_header_params,
302
+ body=_body_params,
303
+ post_params=_form_params,
304
+ files=_files,
305
+ auth_settings=_auth_settings,
306
+ collection_formats=_collection_formats,
307
+ _host=_host,
308
+ _request_auth=_request_auth
309
+ )
310
+
311
+
312
+
313
+
314
+ @validate_call
315
+ def get_task_state_cache(
316
+ self,
317
+ model_id: StrictStr,
318
+ _request_timeout: Union[
319
+ None,
320
+ Annotated[StrictFloat, Field(gt=0)],
321
+ Tuple[
322
+ Annotated[StrictFloat, Field(gt=0)],
323
+ Annotated[StrictFloat, Field(gt=0)]
324
+ ]
325
+ ] = None,
326
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
327
+ _content_type: Optional[StrictStr] = None,
328
+ _headers: Optional[Dict[StrictStr, Any]] = None,
329
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
330
+ ) -> TaskReadResponse:
331
+ """Get Cached Task State
332
+
333
+ Retrieve the task state cached in the control plane. Requires model_task_read permission.
334
+
335
+ :param model_id: (required)
336
+ :type model_id: str
337
+ :param _request_timeout: timeout setting for this request. If one
338
+ number provided, it will be total request
339
+ timeout. It can also be a pair (tuple) of
340
+ (connection, read) timeouts.
341
+ :type _request_timeout: int, tuple(int, int), optional
342
+ :param _request_auth: set to override the auth_settings for an a single
343
+ request; this effectively ignores the
344
+ authentication in the spec for a single request.
345
+ :type _request_auth: dict, optional
346
+ :param _content_type: force content-type for the request.
347
+ :type _content_type: str, Optional
348
+ :param _headers: set to override the headers for a single
349
+ request; this effectively ignores the headers
350
+ in the spec for a single request.
351
+ :type _headers: dict, optional
352
+ :param _host_index: set to override the host_index for a single
353
+ request; this effectively ignores the host_index
354
+ in the spec for a single request.
355
+ :type _host_index: int, optional
356
+ :return: Returns the result object.
357
+ """ # noqa: E501
358
+
359
+ _param = self._get_task_state_cache_serialize(
360
+ model_id=model_id,
361
+ _request_auth=_request_auth,
362
+ _content_type=_content_type,
363
+ _headers=_headers,
364
+ _host_index=_host_index
365
+ )
366
+
367
+ _response_types_map: Dict[str, Optional[str]] = {
368
+ '200': "TaskReadResponse",
369
+ '500': "InternalServerError",
370
+ '404': "NotFoundError",
371
+ '422': "HTTPValidationError",
372
+ }
373
+ response_data = self.api_client.call_api(
374
+ *_param,
375
+ _request_timeout=_request_timeout
376
+ )
377
+ response_data.read()
378
+ return self.api_client.response_deserialize(
379
+ response_data=response_data,
380
+ response_types_map=_response_types_map,
381
+ ).data
382
+
383
+
384
+ @validate_call
385
+ def get_task_state_cache_with_http_info(
386
+ self,
387
+ model_id: StrictStr,
388
+ _request_timeout: Union[
389
+ None,
390
+ Annotated[StrictFloat, Field(gt=0)],
391
+ Tuple[
392
+ Annotated[StrictFloat, Field(gt=0)],
393
+ Annotated[StrictFloat, Field(gt=0)]
394
+ ]
395
+ ] = None,
396
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
397
+ _content_type: Optional[StrictStr] = None,
398
+ _headers: Optional[Dict[StrictStr, Any]] = None,
399
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
400
+ ) -> ApiResponse[TaskReadResponse]:
401
+ """Get Cached Task State
402
+
403
+ Retrieve the task state cached in the control plane. Requires model_task_read permission.
404
+
405
+ :param model_id: (required)
406
+ :type model_id: str
407
+ :param _request_timeout: timeout setting for this request. If one
408
+ number provided, it will be total request
409
+ timeout. It can also be a pair (tuple) of
410
+ (connection, read) timeouts.
411
+ :type _request_timeout: int, tuple(int, int), optional
412
+ :param _request_auth: set to override the auth_settings for an a single
413
+ request; this effectively ignores the
414
+ authentication in the spec for a single request.
415
+ :type _request_auth: dict, optional
416
+ :param _content_type: force content-type for the request.
417
+ :type _content_type: str, Optional
418
+ :param _headers: set to override the headers for a single
419
+ request; this effectively ignores the headers
420
+ in the spec for a single request.
421
+ :type _headers: dict, optional
422
+ :param _host_index: set to override the host_index for a single
423
+ request; this effectively ignores the host_index
424
+ in the spec for a single request.
425
+ :type _host_index: int, optional
426
+ :return: Returns the result object.
427
+ """ # noqa: E501
428
+
429
+ _param = self._get_task_state_cache_serialize(
430
+ model_id=model_id,
431
+ _request_auth=_request_auth,
432
+ _content_type=_content_type,
433
+ _headers=_headers,
434
+ _host_index=_host_index
435
+ )
436
+
437
+ _response_types_map: Dict[str, Optional[str]] = {
438
+ '200': "TaskReadResponse",
439
+ '500': "InternalServerError",
440
+ '404': "NotFoundError",
441
+ '422': "HTTPValidationError",
442
+ }
443
+ response_data = self.api_client.call_api(
444
+ *_param,
445
+ _request_timeout=_request_timeout
446
+ )
447
+ response_data.read()
448
+ return self.api_client.response_deserialize(
449
+ response_data=response_data,
450
+ response_types_map=_response_types_map,
451
+ )
452
+
453
+
454
+ @validate_call
455
+ def get_task_state_cache_without_preload_content(
456
+ self,
457
+ model_id: StrictStr,
458
+ _request_timeout: Union[
459
+ None,
460
+ Annotated[StrictFloat, Field(gt=0)],
461
+ Tuple[
462
+ Annotated[StrictFloat, Field(gt=0)],
463
+ Annotated[StrictFloat, Field(gt=0)]
464
+ ]
465
+ ] = None,
466
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
467
+ _content_type: Optional[StrictStr] = None,
468
+ _headers: Optional[Dict[StrictStr, Any]] = None,
469
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
470
+ ) -> RESTResponseType:
471
+ """Get Cached Task State
472
+
473
+ Retrieve the task state cached in the control plane. Requires model_task_read permission.
474
+
475
+ :param model_id: (required)
476
+ :type model_id: str
477
+ :param _request_timeout: timeout setting for this request. If one
478
+ number provided, it will be total request
479
+ timeout. It can also be a pair (tuple) of
480
+ (connection, read) timeouts.
481
+ :type _request_timeout: int, tuple(int, int), optional
482
+ :param _request_auth: set to override the auth_settings for an a single
483
+ request; this effectively ignores the
484
+ authentication in the spec for a single request.
485
+ :type _request_auth: dict, optional
486
+ :param _content_type: force content-type for the request.
487
+ :type _content_type: str, Optional
488
+ :param _headers: set to override the headers for a single
489
+ request; this effectively ignores the headers
490
+ in the spec for a single request.
491
+ :type _headers: dict, optional
492
+ :param _host_index: set to override the host_index for a single
493
+ request; this effectively ignores the host_index
494
+ in the spec for a single request.
495
+ :type _host_index: int, optional
496
+ :return: Returns the result object.
497
+ """ # noqa: E501
498
+
499
+ _param = self._get_task_state_cache_serialize(
500
+ model_id=model_id,
501
+ _request_auth=_request_auth,
502
+ _content_type=_content_type,
503
+ _headers=_headers,
504
+ _host_index=_host_index
505
+ )
506
+
507
+ _response_types_map: Dict[str, Optional[str]] = {
508
+ '200': "TaskReadResponse",
509
+ '500': "InternalServerError",
510
+ '404': "NotFoundError",
511
+ '422': "HTTPValidationError",
512
+ }
513
+ response_data = self.api_client.call_api(
514
+ *_param,
515
+ _request_timeout=_request_timeout
516
+ )
517
+ return response_data.response
518
+
519
+
520
+ def _get_task_state_cache_serialize(
521
+ self,
522
+ model_id,
523
+ _request_auth,
524
+ _content_type,
525
+ _headers,
526
+ _host_index,
527
+ ) -> RequestSerialized:
528
+
529
+ _host = None
530
+
531
+ _collection_formats: Dict[str, str] = {
532
+ }
533
+
534
+ _path_params: Dict[str, str] = {}
535
+ _query_params: List[Tuple[str, str]] = []
536
+ _header_params: Dict[str, Optional[str]] = _headers or {}
537
+ _form_params: List[Tuple[str, str]] = []
538
+ _files: Dict[
539
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
540
+ ] = {}
541
+ _body_params: Optional[bytes] = None
542
+
543
+ # process the path parameters
544
+ if model_id is not None:
545
+ _path_params['model_id'] = model_id
546
+ # process the query parameters
547
+ # process the header parameters
548
+ # process the form parameters
549
+ # process the body parameter
550
+
551
+
552
+ # set the HTTP header `Accept`
553
+ if 'Accept' not in _header_params:
554
+ _header_params['Accept'] = self.api_client.select_header_accept(
555
+ [
556
+ 'application/json'
557
+ ]
558
+ )
559
+
560
+
561
+ # authentication setting
562
+ _auth_settings: List[str] = [
563
+ 'OAuth2AuthorizationCode'
564
+ ]
565
+
566
+ return self.api_client.param_serialize(
567
+ method='GET',
568
+ resource_path='/api/v1/models/{model_id}/task',
569
+ path_params=_path_params,
570
+ query_params=_query_params,
571
+ header_params=_header_params,
572
+ body=_body_params,
573
+ post_params=_form_params,
574
+ files=_files,
575
+ auth_settings=_auth_settings,
576
+ collection_formats=_collection_formats,
577
+ _host=_host,
578
+ _request_auth=_request_auth
579
+ )
580
+
581
+
582
+
583
+
584
+ @validate_call
585
+ def patch_task(
586
+ self,
587
+ model_id: StrictStr,
588
+ patch_task_request: PatchTaskRequest,
589
+ _request_timeout: Union[
590
+ None,
591
+ Annotated[StrictFloat, Field(gt=0)],
592
+ Tuple[
593
+ Annotated[StrictFloat, Field(gt=0)],
594
+ Annotated[StrictFloat, Field(gt=0)]
595
+ ]
596
+ ] = None,
597
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
598
+ _content_type: Optional[StrictStr] = None,
599
+ _headers: Optional[Dict[StrictStr, Any]] = None,
600
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
601
+ ) -> TaskMutationResponse:
602
+ """Update A Task
603
+
604
+ Submits a job to update the task definition for this model and returns the job ID. When the job finishes, it will upload the latest copy of the task state. Requires model_task_update permission.
605
+
606
+ :param model_id: (required)
607
+ :type model_id: str
608
+ :param patch_task_request: (required)
609
+ :type patch_task_request: PatchTaskRequest
610
+ :param _request_timeout: timeout setting for this request. If one
611
+ number provided, it will be total request
612
+ timeout. It can also be a pair (tuple) of
613
+ (connection, read) timeouts.
614
+ :type _request_timeout: int, tuple(int, int), optional
615
+ :param _request_auth: set to override the auth_settings for an a single
616
+ request; this effectively ignores the
617
+ authentication in the spec for a single request.
618
+ :type _request_auth: dict, optional
619
+ :param _content_type: force content-type for the request.
620
+ :type _content_type: str, Optional
621
+ :param _headers: set to override the headers for a single
622
+ request; this effectively ignores the headers
623
+ in the spec for a single request.
624
+ :type _headers: dict, optional
625
+ :param _host_index: set to override the host_index for a single
626
+ request; this effectively ignores the host_index
627
+ in the spec for a single request.
628
+ :type _host_index: int, optional
629
+ :return: Returns the result object.
630
+ """ # noqa: E501
631
+
632
+ _param = self._patch_task_serialize(
633
+ model_id=model_id,
634
+ patch_task_request=patch_task_request,
635
+ _request_auth=_request_auth,
636
+ _content_type=_content_type,
637
+ _headers=_headers,
638
+ _host_index=_host_index
639
+ )
640
+
641
+ _response_types_map: Dict[str, Optional[str]] = {
642
+ '200': "TaskMutationResponse",
643
+ '500': "InternalServerError",
644
+ '400': "BadRequestError",
645
+ '404': "NotFoundError",
646
+ '422': "HTTPValidationError",
647
+ }
648
+ response_data = self.api_client.call_api(
649
+ *_param,
650
+ _request_timeout=_request_timeout
651
+ )
652
+ response_data.read()
653
+ return self.api_client.response_deserialize(
654
+ response_data=response_data,
655
+ response_types_map=_response_types_map,
656
+ ).data
657
+
658
+
659
+ @validate_call
660
+ def patch_task_with_http_info(
661
+ self,
662
+ model_id: StrictStr,
663
+ patch_task_request: PatchTaskRequest,
664
+ _request_timeout: Union[
665
+ None,
666
+ Annotated[StrictFloat, Field(gt=0)],
667
+ Tuple[
668
+ Annotated[StrictFloat, Field(gt=0)],
669
+ Annotated[StrictFloat, Field(gt=0)]
670
+ ]
671
+ ] = None,
672
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
673
+ _content_type: Optional[StrictStr] = None,
674
+ _headers: Optional[Dict[StrictStr, Any]] = None,
675
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
676
+ ) -> ApiResponse[TaskMutationResponse]:
677
+ """Update A Task
678
+
679
+ Submits a job to update the task definition for this model and returns the job ID. When the job finishes, it will upload the latest copy of the task state. Requires model_task_update permission.
680
+
681
+ :param model_id: (required)
682
+ :type model_id: str
683
+ :param patch_task_request: (required)
684
+ :type patch_task_request: PatchTaskRequest
685
+ :param _request_timeout: timeout setting for this request. If one
686
+ number provided, it will be total request
687
+ timeout. It can also be a pair (tuple) of
688
+ (connection, read) timeouts.
689
+ :type _request_timeout: int, tuple(int, int), optional
690
+ :param _request_auth: set to override the auth_settings for an a single
691
+ request; this effectively ignores the
692
+ authentication in the spec for a single request.
693
+ :type _request_auth: dict, optional
694
+ :param _content_type: force content-type for the request.
695
+ :type _content_type: str, Optional
696
+ :param _headers: set to override the headers for a single
697
+ request; this effectively ignores the headers
698
+ in the spec for a single request.
699
+ :type _headers: dict, optional
700
+ :param _host_index: set to override the host_index for a single
701
+ request; this effectively ignores the host_index
702
+ in the spec for a single request.
703
+ :type _host_index: int, optional
704
+ :return: Returns the result object.
705
+ """ # noqa: E501
706
+
707
+ _param = self._patch_task_serialize(
708
+ model_id=model_id,
709
+ patch_task_request=patch_task_request,
710
+ _request_auth=_request_auth,
711
+ _content_type=_content_type,
712
+ _headers=_headers,
713
+ _host_index=_host_index
714
+ )
715
+
716
+ _response_types_map: Dict[str, Optional[str]] = {
717
+ '200': "TaskMutationResponse",
718
+ '500': "InternalServerError",
719
+ '400': "BadRequestError",
720
+ '404': "NotFoundError",
721
+ '422': "HTTPValidationError",
722
+ }
723
+ response_data = self.api_client.call_api(
724
+ *_param,
725
+ _request_timeout=_request_timeout
726
+ )
727
+ response_data.read()
728
+ return self.api_client.response_deserialize(
729
+ response_data=response_data,
730
+ response_types_map=_response_types_map,
731
+ )
732
+
733
+
734
+ @validate_call
735
+ def patch_task_without_preload_content(
736
+ self,
737
+ model_id: StrictStr,
738
+ patch_task_request: PatchTaskRequest,
739
+ _request_timeout: Union[
740
+ None,
741
+ Annotated[StrictFloat, Field(gt=0)],
742
+ Tuple[
743
+ Annotated[StrictFloat, Field(gt=0)],
744
+ Annotated[StrictFloat, Field(gt=0)]
745
+ ]
746
+ ] = None,
747
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
748
+ _content_type: Optional[StrictStr] = None,
749
+ _headers: Optional[Dict[StrictStr, Any]] = None,
750
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
751
+ ) -> RESTResponseType:
752
+ """Update A Task
753
+
754
+ Submits a job to update the task definition for this model and returns the job ID. When the job finishes, it will upload the latest copy of the task state. Requires model_task_update permission.
755
+
756
+ :param model_id: (required)
757
+ :type model_id: str
758
+ :param patch_task_request: (required)
759
+ :type patch_task_request: PatchTaskRequest
760
+ :param _request_timeout: timeout setting for this request. If one
761
+ number provided, it will be total request
762
+ timeout. It can also be a pair (tuple) of
763
+ (connection, read) timeouts.
764
+ :type _request_timeout: int, tuple(int, int), optional
765
+ :param _request_auth: set to override the auth_settings for an a single
766
+ request; this effectively ignores the
767
+ authentication in the spec for a single request.
768
+ :type _request_auth: dict, optional
769
+ :param _content_type: force content-type for the request.
770
+ :type _content_type: str, Optional
771
+ :param _headers: set to override the headers for a single
772
+ request; this effectively ignores the headers
773
+ in the spec for a single request.
774
+ :type _headers: dict, optional
775
+ :param _host_index: set to override the host_index for a single
776
+ request; this effectively ignores the host_index
777
+ in the spec for a single request.
778
+ :type _host_index: int, optional
779
+ :return: Returns the result object.
780
+ """ # noqa: E501
781
+
782
+ _param = self._patch_task_serialize(
783
+ model_id=model_id,
784
+ patch_task_request=patch_task_request,
785
+ _request_auth=_request_auth,
786
+ _content_type=_content_type,
787
+ _headers=_headers,
788
+ _host_index=_host_index
789
+ )
790
+
791
+ _response_types_map: Dict[str, Optional[str]] = {
792
+ '200': "TaskMutationResponse",
793
+ '500': "InternalServerError",
794
+ '400': "BadRequestError",
795
+ '404': "NotFoundError",
796
+ '422': "HTTPValidationError",
797
+ }
798
+ response_data = self.api_client.call_api(
799
+ *_param,
800
+ _request_timeout=_request_timeout
801
+ )
802
+ return response_data.response
803
+
804
+
805
+ def _patch_task_serialize(
806
+ self,
807
+ model_id,
808
+ patch_task_request,
809
+ _request_auth,
810
+ _content_type,
811
+ _headers,
812
+ _host_index,
813
+ ) -> RequestSerialized:
814
+
815
+ _host = None
816
+
817
+ _collection_formats: Dict[str, str] = {
818
+ }
819
+
820
+ _path_params: Dict[str, str] = {}
821
+ _query_params: List[Tuple[str, str]] = []
822
+ _header_params: Dict[str, Optional[str]] = _headers or {}
823
+ _form_params: List[Tuple[str, str]] = []
824
+ _files: Dict[
825
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
826
+ ] = {}
827
+ _body_params: Optional[bytes] = None
828
+
829
+ # process the path parameters
830
+ if model_id is not None:
831
+ _path_params['model_id'] = model_id
832
+ # process the query parameters
833
+ # process the header parameters
834
+ # process the form parameters
835
+ # process the body parameter
836
+ if patch_task_request is not None:
837
+ _body_params = patch_task_request
838
+
839
+
840
+ # set the HTTP header `Accept`
841
+ if 'Accept' not in _header_params:
842
+ _header_params['Accept'] = self.api_client.select_header_accept(
843
+ [
844
+ 'application/json'
845
+ ]
846
+ )
847
+
848
+ # set the HTTP header `Content-Type`
849
+ if _content_type:
850
+ _header_params['Content-Type'] = _content_type
851
+ else:
852
+ _default_content_type = (
853
+ self.api_client.select_header_content_type(
854
+ [
855
+ 'application/json'
856
+ ]
857
+ )
858
+ )
859
+ if _default_content_type is not None:
860
+ _header_params['Content-Type'] = _default_content_type
861
+
862
+ # authentication setting
863
+ _auth_settings: List[str] = [
864
+ 'OAuth2AuthorizationCode'
865
+ ]
866
+
867
+ return self.api_client.param_serialize(
868
+ method='PATCH',
869
+ resource_path='/api/v1/models/{model_id}/task',
870
+ path_params=_path_params,
871
+ query_params=_query_params,
872
+ header_params=_header_params,
873
+ body=_body_params,
874
+ post_params=_form_params,
875
+ files=_files,
876
+ auth_settings=_auth_settings,
877
+ collection_formats=_collection_formats,
878
+ _host=_host,
879
+ _request_auth=_request_auth
880
+ )
881
+
882
+
883
+
884
+
885
+ @validate_call
886
+ def project_create_model_task(
887
+ self,
888
+ project_id: StrictStr,
889
+ post_task_request: PostTaskRequest,
890
+ _request_timeout: Union[
891
+ None,
892
+ Annotated[StrictFloat, Field(gt=0)],
893
+ Tuple[
894
+ Annotated[StrictFloat, Field(gt=0)],
895
+ Annotated[StrictFloat, Field(gt=0)]
896
+ ]
897
+ ] = None,
898
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
899
+ _content_type: Optional[StrictStr] = None,
900
+ _headers: Optional[Dict[StrictStr, Any]] = None,
901
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
902
+ ) -> TaskMutationResponse:
903
+ """Create A Task.
904
+
905
+ Submits a job to create a task in the project and returns a job ID. When the job finishes, it will upload a copy of the task state. Requires the project_create_model_task permission.
906
+
907
+ :param project_id: (required)
908
+ :type project_id: str
909
+ :param post_task_request: (required)
910
+ :type post_task_request: PostTaskRequest
911
+ :param _request_timeout: timeout setting for this request. If one
912
+ number provided, it will be total request
913
+ timeout. It can also be a pair (tuple) of
914
+ (connection, read) timeouts.
915
+ :type _request_timeout: int, tuple(int, int), optional
916
+ :param _request_auth: set to override the auth_settings for an a single
917
+ request; this effectively ignores the
918
+ authentication in the spec for a single request.
919
+ :type _request_auth: dict, optional
920
+ :param _content_type: force content-type for the request.
921
+ :type _content_type: str, Optional
922
+ :param _headers: set to override the headers for a single
923
+ request; this effectively ignores the headers
924
+ in the spec for a single request.
925
+ :type _headers: dict, optional
926
+ :param _host_index: set to override the host_index for a single
927
+ request; this effectively ignores the host_index
928
+ in the spec for a single request.
929
+ :type _host_index: int, optional
930
+ :return: Returns the result object.
931
+ """ # noqa: E501
932
+
933
+ _param = self._project_create_model_task_serialize(
934
+ project_id=project_id,
935
+ post_task_request=post_task_request,
936
+ _request_auth=_request_auth,
937
+ _content_type=_content_type,
938
+ _headers=_headers,
939
+ _host_index=_host_index
940
+ )
941
+
942
+ _response_types_map: Dict[str, Optional[str]] = {
943
+ '200': "TaskMutationResponse",
944
+ '500': "InternalServerError",
945
+ '400': "BadRequestError",
946
+ '404': "NotFoundError",
947
+ '422': "HTTPValidationError",
948
+ }
949
+ response_data = self.api_client.call_api(
950
+ *_param,
951
+ _request_timeout=_request_timeout
952
+ )
953
+ response_data.read()
954
+ return self.api_client.response_deserialize(
955
+ response_data=response_data,
956
+ response_types_map=_response_types_map,
957
+ ).data
958
+
959
+
960
+ @validate_call
961
+ def project_create_model_task_with_http_info(
962
+ self,
963
+ project_id: StrictStr,
964
+ post_task_request: PostTaskRequest,
965
+ _request_timeout: Union[
966
+ None,
967
+ Annotated[StrictFloat, Field(gt=0)],
968
+ Tuple[
969
+ Annotated[StrictFloat, Field(gt=0)],
970
+ Annotated[StrictFloat, Field(gt=0)]
971
+ ]
972
+ ] = None,
973
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
974
+ _content_type: Optional[StrictStr] = None,
975
+ _headers: Optional[Dict[StrictStr, Any]] = None,
976
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
977
+ ) -> ApiResponse[TaskMutationResponse]:
978
+ """Create A Task.
979
+
980
+ Submits a job to create a task in the project and returns a job ID. When the job finishes, it will upload a copy of the task state. Requires the project_create_model_task permission.
981
+
982
+ :param project_id: (required)
983
+ :type project_id: str
984
+ :param post_task_request: (required)
985
+ :type post_task_request: PostTaskRequest
986
+ :param _request_timeout: timeout setting for this request. If one
987
+ number provided, it will be total request
988
+ timeout. It can also be a pair (tuple) of
989
+ (connection, read) timeouts.
990
+ :type _request_timeout: int, tuple(int, int), optional
991
+ :param _request_auth: set to override the auth_settings for an a single
992
+ request; this effectively ignores the
993
+ authentication in the spec for a single request.
994
+ :type _request_auth: dict, optional
995
+ :param _content_type: force content-type for the request.
996
+ :type _content_type: str, Optional
997
+ :param _headers: set to override the headers for a single
998
+ request; this effectively ignores the headers
999
+ in the spec for a single request.
1000
+ :type _headers: dict, optional
1001
+ :param _host_index: set to override the host_index for a single
1002
+ request; this effectively ignores the host_index
1003
+ in the spec for a single request.
1004
+ :type _host_index: int, optional
1005
+ :return: Returns the result object.
1006
+ """ # noqa: E501
1007
+
1008
+ _param = self._project_create_model_task_serialize(
1009
+ project_id=project_id,
1010
+ post_task_request=post_task_request,
1011
+ _request_auth=_request_auth,
1012
+ _content_type=_content_type,
1013
+ _headers=_headers,
1014
+ _host_index=_host_index
1015
+ )
1016
+
1017
+ _response_types_map: Dict[str, Optional[str]] = {
1018
+ '200': "TaskMutationResponse",
1019
+ '500': "InternalServerError",
1020
+ '400': "BadRequestError",
1021
+ '404': "NotFoundError",
1022
+ '422': "HTTPValidationError",
1023
+ }
1024
+ response_data = self.api_client.call_api(
1025
+ *_param,
1026
+ _request_timeout=_request_timeout
1027
+ )
1028
+ response_data.read()
1029
+ return self.api_client.response_deserialize(
1030
+ response_data=response_data,
1031
+ response_types_map=_response_types_map,
1032
+ )
1033
+
1034
+
1035
+ @validate_call
1036
+ def project_create_model_task_without_preload_content(
1037
+ self,
1038
+ project_id: StrictStr,
1039
+ post_task_request: PostTaskRequest,
1040
+ _request_timeout: Union[
1041
+ None,
1042
+ Annotated[StrictFloat, Field(gt=0)],
1043
+ Tuple[
1044
+ Annotated[StrictFloat, Field(gt=0)],
1045
+ Annotated[StrictFloat, Field(gt=0)]
1046
+ ]
1047
+ ] = None,
1048
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1049
+ _content_type: Optional[StrictStr] = None,
1050
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1051
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1052
+ ) -> RESTResponseType:
1053
+ """Create A Task.
1054
+
1055
+ Submits a job to create a task in the project and returns a job ID. When the job finishes, it will upload a copy of the task state. Requires the project_create_model_task permission.
1056
+
1057
+ :param project_id: (required)
1058
+ :type project_id: str
1059
+ :param post_task_request: (required)
1060
+ :type post_task_request: PostTaskRequest
1061
+ :param _request_timeout: timeout setting for this request. If one
1062
+ number provided, it will be total request
1063
+ timeout. It can also be a pair (tuple) of
1064
+ (connection, read) timeouts.
1065
+ :type _request_timeout: int, tuple(int, int), optional
1066
+ :param _request_auth: set to override the auth_settings for an a single
1067
+ request; this effectively ignores the
1068
+ authentication in the spec for a single request.
1069
+ :type _request_auth: dict, optional
1070
+ :param _content_type: force content-type for the request.
1071
+ :type _content_type: str, Optional
1072
+ :param _headers: set to override the headers for a single
1073
+ request; this effectively ignores the headers
1074
+ in the spec for a single request.
1075
+ :type _headers: dict, optional
1076
+ :param _host_index: set to override the host_index for a single
1077
+ request; this effectively ignores the host_index
1078
+ in the spec for a single request.
1079
+ :type _host_index: int, optional
1080
+ :return: Returns the result object.
1081
+ """ # noqa: E501
1082
+
1083
+ _param = self._project_create_model_task_serialize(
1084
+ project_id=project_id,
1085
+ post_task_request=post_task_request,
1086
+ _request_auth=_request_auth,
1087
+ _content_type=_content_type,
1088
+ _headers=_headers,
1089
+ _host_index=_host_index
1090
+ )
1091
+
1092
+ _response_types_map: Dict[str, Optional[str]] = {
1093
+ '200': "TaskMutationResponse",
1094
+ '500': "InternalServerError",
1095
+ '400': "BadRequestError",
1096
+ '404': "NotFoundError",
1097
+ '422': "HTTPValidationError",
1098
+ }
1099
+ response_data = self.api_client.call_api(
1100
+ *_param,
1101
+ _request_timeout=_request_timeout
1102
+ )
1103
+ return response_data.response
1104
+
1105
+
1106
+ def _project_create_model_task_serialize(
1107
+ self,
1108
+ project_id,
1109
+ post_task_request,
1110
+ _request_auth,
1111
+ _content_type,
1112
+ _headers,
1113
+ _host_index,
1114
+ ) -> RequestSerialized:
1115
+
1116
+ _host = None
1117
+
1118
+ _collection_formats: Dict[str, str] = {
1119
+ }
1120
+
1121
+ _path_params: Dict[str, str] = {}
1122
+ _query_params: List[Tuple[str, str]] = []
1123
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1124
+ _form_params: List[Tuple[str, str]] = []
1125
+ _files: Dict[
1126
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1127
+ ] = {}
1128
+ _body_params: Optional[bytes] = None
1129
+
1130
+ # process the path parameters
1131
+ if project_id is not None:
1132
+ _path_params['project_id'] = project_id
1133
+ # process the query parameters
1134
+ # process the header parameters
1135
+ # process the form parameters
1136
+ # process the body parameter
1137
+ if post_task_request is not None:
1138
+ _body_params = post_task_request
1139
+
1140
+
1141
+ # set the HTTP header `Accept`
1142
+ if 'Accept' not in _header_params:
1143
+ _header_params['Accept'] = self.api_client.select_header_accept(
1144
+ [
1145
+ 'application/json'
1146
+ ]
1147
+ )
1148
+
1149
+ # set the HTTP header `Content-Type`
1150
+ if _content_type:
1151
+ _header_params['Content-Type'] = _content_type
1152
+ else:
1153
+ _default_content_type = (
1154
+ self.api_client.select_header_content_type(
1155
+ [
1156
+ 'application/json'
1157
+ ]
1158
+ )
1159
+ )
1160
+ if _default_content_type is not None:
1161
+ _header_params['Content-Type'] = _default_content_type
1162
+
1163
+ # authentication setting
1164
+ _auth_settings: List[str] = [
1165
+ 'OAuth2AuthorizationCode'
1166
+ ]
1167
+
1168
+ return self.api_client.param_serialize(
1169
+ method='POST',
1170
+ resource_path='/api/v1/projects/{project_id}/tasks',
1171
+ path_params=_path_params,
1172
+ query_params=_query_params,
1173
+ header_params=_header_params,
1174
+ body=_body_params,
1175
+ post_params=_form_params,
1176
+ files=_files,
1177
+ auth_settings=_auth_settings,
1178
+ collection_formats=_collection_formats,
1179
+ _host=_host,
1180
+ _request_auth=_request_auth
1181
+ )
1182
+
1183
+
1184
+
1185
+
1186
+ @validate_call
1187
+ def put_task_state_cache(
1188
+ self,
1189
+ model_id: StrictStr,
1190
+ put_task_state_cache_request: PutTaskStateCacheRequest,
1191
+ _request_timeout: Union[
1192
+ None,
1193
+ Annotated[StrictFloat, Field(gt=0)],
1194
+ Tuple[
1195
+ Annotated[StrictFloat, Field(gt=0)],
1196
+ Annotated[StrictFloat, Field(gt=0)]
1197
+ ]
1198
+ ] = None,
1199
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1200
+ _content_type: Optional[StrictStr] = None,
1201
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1202
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1203
+ ) -> None:
1204
+ """Upload Task State
1205
+
1206
+ Upload a copy of the task state to cache in the control plane. Requires model_task_put_state_cache permission.
1207
+
1208
+ :param model_id: (required)
1209
+ :type model_id: str
1210
+ :param put_task_state_cache_request: (required)
1211
+ :type put_task_state_cache_request: PutTaskStateCacheRequest
1212
+ :param _request_timeout: timeout setting for this request. If one
1213
+ number provided, it will be total request
1214
+ timeout. It can also be a pair (tuple) of
1215
+ (connection, read) timeouts.
1216
+ :type _request_timeout: int, tuple(int, int), optional
1217
+ :param _request_auth: set to override the auth_settings for an a single
1218
+ request; this effectively ignores the
1219
+ authentication in the spec for a single request.
1220
+ :type _request_auth: dict, optional
1221
+ :param _content_type: force content-type for the request.
1222
+ :type _content_type: str, Optional
1223
+ :param _headers: set to override the headers for a single
1224
+ request; this effectively ignores the headers
1225
+ in the spec for a single request.
1226
+ :type _headers: dict, optional
1227
+ :param _host_index: set to override the host_index for a single
1228
+ request; this effectively ignores the host_index
1229
+ in the spec for a single request.
1230
+ :type _host_index: int, optional
1231
+ :return: Returns the result object.
1232
+ """ # noqa: E501
1233
+
1234
+ _param = self._put_task_state_cache_serialize(
1235
+ model_id=model_id,
1236
+ put_task_state_cache_request=put_task_state_cache_request,
1237
+ _request_auth=_request_auth,
1238
+ _content_type=_content_type,
1239
+ _headers=_headers,
1240
+ _host_index=_host_index
1241
+ )
1242
+
1243
+ _response_types_map: Dict[str, Optional[str]] = {
1244
+ '204': None,
1245
+ '500': "InternalServerError",
1246
+ '404': "NotFoundError",
1247
+ '400': "BadRequestError",
1248
+ '422': "HTTPValidationError",
1249
+ }
1250
+ response_data = self.api_client.call_api(
1251
+ *_param,
1252
+ _request_timeout=_request_timeout
1253
+ )
1254
+ response_data.read()
1255
+ return self.api_client.response_deserialize(
1256
+ response_data=response_data,
1257
+ response_types_map=_response_types_map,
1258
+ ).data
1259
+
1260
+
1261
+ @validate_call
1262
+ def put_task_state_cache_with_http_info(
1263
+ self,
1264
+ model_id: StrictStr,
1265
+ put_task_state_cache_request: PutTaskStateCacheRequest,
1266
+ _request_timeout: Union[
1267
+ None,
1268
+ Annotated[StrictFloat, Field(gt=0)],
1269
+ Tuple[
1270
+ Annotated[StrictFloat, Field(gt=0)],
1271
+ Annotated[StrictFloat, Field(gt=0)]
1272
+ ]
1273
+ ] = None,
1274
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1275
+ _content_type: Optional[StrictStr] = None,
1276
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1277
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1278
+ ) -> ApiResponse[None]:
1279
+ """Upload Task State
1280
+
1281
+ Upload a copy of the task state to cache in the control plane. Requires model_task_put_state_cache permission.
1282
+
1283
+ :param model_id: (required)
1284
+ :type model_id: str
1285
+ :param put_task_state_cache_request: (required)
1286
+ :type put_task_state_cache_request: PutTaskStateCacheRequest
1287
+ :param _request_timeout: timeout setting for this request. If one
1288
+ number provided, it will be total request
1289
+ timeout. It can also be a pair (tuple) of
1290
+ (connection, read) timeouts.
1291
+ :type _request_timeout: int, tuple(int, int), optional
1292
+ :param _request_auth: set to override the auth_settings for an a single
1293
+ request; this effectively ignores the
1294
+ authentication in the spec for a single request.
1295
+ :type _request_auth: dict, optional
1296
+ :param _content_type: force content-type for the request.
1297
+ :type _content_type: str, Optional
1298
+ :param _headers: set to override the headers for a single
1299
+ request; this effectively ignores the headers
1300
+ in the spec for a single request.
1301
+ :type _headers: dict, optional
1302
+ :param _host_index: set to override the host_index for a single
1303
+ request; this effectively ignores the host_index
1304
+ in the spec for a single request.
1305
+ :type _host_index: int, optional
1306
+ :return: Returns the result object.
1307
+ """ # noqa: E501
1308
+
1309
+ _param = self._put_task_state_cache_serialize(
1310
+ model_id=model_id,
1311
+ put_task_state_cache_request=put_task_state_cache_request,
1312
+ _request_auth=_request_auth,
1313
+ _content_type=_content_type,
1314
+ _headers=_headers,
1315
+ _host_index=_host_index
1316
+ )
1317
+
1318
+ _response_types_map: Dict[str, Optional[str]] = {
1319
+ '204': None,
1320
+ '500': "InternalServerError",
1321
+ '404': "NotFoundError",
1322
+ '400': "BadRequestError",
1323
+ '422': "HTTPValidationError",
1324
+ }
1325
+ response_data = self.api_client.call_api(
1326
+ *_param,
1327
+ _request_timeout=_request_timeout
1328
+ )
1329
+ response_data.read()
1330
+ return self.api_client.response_deserialize(
1331
+ response_data=response_data,
1332
+ response_types_map=_response_types_map,
1333
+ )
1334
+
1335
+
1336
+ @validate_call
1337
+ def put_task_state_cache_without_preload_content(
1338
+ self,
1339
+ model_id: StrictStr,
1340
+ put_task_state_cache_request: PutTaskStateCacheRequest,
1341
+ _request_timeout: Union[
1342
+ None,
1343
+ Annotated[StrictFloat, Field(gt=0)],
1344
+ Tuple[
1345
+ Annotated[StrictFloat, Field(gt=0)],
1346
+ Annotated[StrictFloat, Field(gt=0)]
1347
+ ]
1348
+ ] = None,
1349
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1350
+ _content_type: Optional[StrictStr] = None,
1351
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1352
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1353
+ ) -> RESTResponseType:
1354
+ """Upload Task State
1355
+
1356
+ Upload a copy of the task state to cache in the control plane. Requires model_task_put_state_cache permission.
1357
+
1358
+ :param model_id: (required)
1359
+ :type model_id: str
1360
+ :param put_task_state_cache_request: (required)
1361
+ :type put_task_state_cache_request: PutTaskStateCacheRequest
1362
+ :param _request_timeout: timeout setting for this request. If one
1363
+ number provided, it will be total request
1364
+ timeout. It can also be a pair (tuple) of
1365
+ (connection, read) timeouts.
1366
+ :type _request_timeout: int, tuple(int, int), optional
1367
+ :param _request_auth: set to override the auth_settings for an a single
1368
+ request; this effectively ignores the
1369
+ authentication in the spec for a single request.
1370
+ :type _request_auth: dict, optional
1371
+ :param _content_type: force content-type for the request.
1372
+ :type _content_type: str, Optional
1373
+ :param _headers: set to override the headers for a single
1374
+ request; this effectively ignores the headers
1375
+ in the spec for a single request.
1376
+ :type _headers: dict, optional
1377
+ :param _host_index: set to override the host_index for a single
1378
+ request; this effectively ignores the host_index
1379
+ in the spec for a single request.
1380
+ :type _host_index: int, optional
1381
+ :return: Returns the result object.
1382
+ """ # noqa: E501
1383
+
1384
+ _param = self._put_task_state_cache_serialize(
1385
+ model_id=model_id,
1386
+ put_task_state_cache_request=put_task_state_cache_request,
1387
+ _request_auth=_request_auth,
1388
+ _content_type=_content_type,
1389
+ _headers=_headers,
1390
+ _host_index=_host_index
1391
+ )
1392
+
1393
+ _response_types_map: Dict[str, Optional[str]] = {
1394
+ '204': None,
1395
+ '500': "InternalServerError",
1396
+ '404': "NotFoundError",
1397
+ '400': "BadRequestError",
1398
+ '422': "HTTPValidationError",
1399
+ }
1400
+ response_data = self.api_client.call_api(
1401
+ *_param,
1402
+ _request_timeout=_request_timeout
1403
+ )
1404
+ return response_data.response
1405
+
1406
+
1407
+ def _put_task_state_cache_serialize(
1408
+ self,
1409
+ model_id,
1410
+ put_task_state_cache_request,
1411
+ _request_auth,
1412
+ _content_type,
1413
+ _headers,
1414
+ _host_index,
1415
+ ) -> RequestSerialized:
1416
+
1417
+ _host = None
1418
+
1419
+ _collection_formats: Dict[str, str] = {
1420
+ }
1421
+
1422
+ _path_params: Dict[str, str] = {}
1423
+ _query_params: List[Tuple[str, str]] = []
1424
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1425
+ _form_params: List[Tuple[str, str]] = []
1426
+ _files: Dict[
1427
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1428
+ ] = {}
1429
+ _body_params: Optional[bytes] = None
1430
+
1431
+ # process the path parameters
1432
+ if model_id is not None:
1433
+ _path_params['model_id'] = model_id
1434
+ # process the query parameters
1435
+ # process the header parameters
1436
+ # process the form parameters
1437
+ # process the body parameter
1438
+ if put_task_state_cache_request is not None:
1439
+ _body_params = put_task_state_cache_request
1440
+
1441
+
1442
+ # set the HTTP header `Accept`
1443
+ if 'Accept' not in _header_params:
1444
+ _header_params['Accept'] = self.api_client.select_header_accept(
1445
+ [
1446
+ 'application/json'
1447
+ ]
1448
+ )
1449
+
1450
+ # set the HTTP header `Content-Type`
1451
+ if _content_type:
1452
+ _header_params['Content-Type'] = _content_type
1453
+ else:
1454
+ _default_content_type = (
1455
+ self.api_client.select_header_content_type(
1456
+ [
1457
+ 'application/json'
1458
+ ]
1459
+ )
1460
+ )
1461
+ if _default_content_type is not None:
1462
+ _header_params['Content-Type'] = _default_content_type
1463
+
1464
+ # authentication setting
1465
+ _auth_settings: List[str] = [
1466
+ 'OAuth2AuthorizationCode'
1467
+ ]
1468
+
1469
+ return self.api_client.param_serialize(
1470
+ method='PUT',
1471
+ resource_path='/api/v1/models/{model_id}/task/cache',
1472
+ path_params=_path_params,
1473
+ query_params=_query_params,
1474
+ header_params=_header_params,
1475
+ body=_body_params,
1476
+ post_params=_form_params,
1477
+ files=_files,
1478
+ auth_settings=_auth_settings,
1479
+ collection_formats=_collection_formats,
1480
+ _host=_host,
1481
+ _request_auth=_request_auth
1482
+ )
1483
+
1484
+
1485
+
1486
+
1487
+ @validate_call
1488
+ def sync_task(
1489
+ self,
1490
+ model_id: StrictStr,
1491
+ _request_timeout: Union[
1492
+ None,
1493
+ Annotated[StrictFloat, Field(gt=0)],
1494
+ Tuple[
1495
+ Annotated[StrictFloat, Field(gt=0)],
1496
+ Annotated[StrictFloat, Field(gt=0)]
1497
+ ]
1498
+ ] = None,
1499
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1500
+ _content_type: Optional[StrictStr] = None,
1501
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1502
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1503
+ ) -> TaskMutationResponse:
1504
+ """Sync A Task
1505
+
1506
+ Submits a job to fetch the latest task state and returns the job ID. When the job finishes, it will upload the latest copy of the task state. Requires model_task_sync permission.
1507
+
1508
+ :param model_id: (required)
1509
+ :type model_id: str
1510
+ :param _request_timeout: timeout setting for this request. If one
1511
+ number provided, it will be total request
1512
+ timeout. It can also be a pair (tuple) of
1513
+ (connection, read) timeouts.
1514
+ :type _request_timeout: int, tuple(int, int), optional
1515
+ :param _request_auth: set to override the auth_settings for an a single
1516
+ request; this effectively ignores the
1517
+ authentication in the spec for a single request.
1518
+ :type _request_auth: dict, optional
1519
+ :param _content_type: force content-type for the request.
1520
+ :type _content_type: str, Optional
1521
+ :param _headers: set to override the headers for a single
1522
+ request; this effectively ignores the headers
1523
+ in the spec for a single request.
1524
+ :type _headers: dict, optional
1525
+ :param _host_index: set to override the host_index for a single
1526
+ request; this effectively ignores the host_index
1527
+ in the spec for a single request.
1528
+ :type _host_index: int, optional
1529
+ :return: Returns the result object.
1530
+ """ # noqa: E501
1531
+
1532
+ _param = self._sync_task_serialize(
1533
+ model_id=model_id,
1534
+ _request_auth=_request_auth,
1535
+ _content_type=_content_type,
1536
+ _headers=_headers,
1537
+ _host_index=_host_index
1538
+ )
1539
+
1540
+ _response_types_map: Dict[str, Optional[str]] = {
1541
+ '200': "TaskMutationResponse",
1542
+ '500': "InternalServerError",
1543
+ '400': "BadRequestError",
1544
+ '404': "NotFoundError",
1545
+ '422': "HTTPValidationError",
1546
+ }
1547
+ response_data = self.api_client.call_api(
1548
+ *_param,
1549
+ _request_timeout=_request_timeout
1550
+ )
1551
+ response_data.read()
1552
+ return self.api_client.response_deserialize(
1553
+ response_data=response_data,
1554
+ response_types_map=_response_types_map,
1555
+ ).data
1556
+
1557
+
1558
+ @validate_call
1559
+ def sync_task_with_http_info(
1560
+ self,
1561
+ model_id: StrictStr,
1562
+ _request_timeout: Union[
1563
+ None,
1564
+ Annotated[StrictFloat, Field(gt=0)],
1565
+ Tuple[
1566
+ Annotated[StrictFloat, Field(gt=0)],
1567
+ Annotated[StrictFloat, Field(gt=0)]
1568
+ ]
1569
+ ] = None,
1570
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1571
+ _content_type: Optional[StrictStr] = None,
1572
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1573
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1574
+ ) -> ApiResponse[TaskMutationResponse]:
1575
+ """Sync A Task
1576
+
1577
+ Submits a job to fetch the latest task state and returns the job ID. When the job finishes, it will upload the latest copy of the task state. Requires model_task_sync permission.
1578
+
1579
+ :param model_id: (required)
1580
+ :type model_id: str
1581
+ :param _request_timeout: timeout setting for this request. If one
1582
+ number provided, it will be total request
1583
+ timeout. It can also be a pair (tuple) of
1584
+ (connection, read) timeouts.
1585
+ :type _request_timeout: int, tuple(int, int), optional
1586
+ :param _request_auth: set to override the auth_settings for an a single
1587
+ request; this effectively ignores the
1588
+ authentication in the spec for a single request.
1589
+ :type _request_auth: dict, optional
1590
+ :param _content_type: force content-type for the request.
1591
+ :type _content_type: str, Optional
1592
+ :param _headers: set to override the headers for a single
1593
+ request; this effectively ignores the headers
1594
+ in the spec for a single request.
1595
+ :type _headers: dict, optional
1596
+ :param _host_index: set to override the host_index for a single
1597
+ request; this effectively ignores the host_index
1598
+ in the spec for a single request.
1599
+ :type _host_index: int, optional
1600
+ :return: Returns the result object.
1601
+ """ # noqa: E501
1602
+
1603
+ _param = self._sync_task_serialize(
1604
+ model_id=model_id,
1605
+ _request_auth=_request_auth,
1606
+ _content_type=_content_type,
1607
+ _headers=_headers,
1608
+ _host_index=_host_index
1609
+ )
1610
+
1611
+ _response_types_map: Dict[str, Optional[str]] = {
1612
+ '200': "TaskMutationResponse",
1613
+ '500': "InternalServerError",
1614
+ '400': "BadRequestError",
1615
+ '404': "NotFoundError",
1616
+ '422': "HTTPValidationError",
1617
+ }
1618
+ response_data = self.api_client.call_api(
1619
+ *_param,
1620
+ _request_timeout=_request_timeout
1621
+ )
1622
+ response_data.read()
1623
+ return self.api_client.response_deserialize(
1624
+ response_data=response_data,
1625
+ response_types_map=_response_types_map,
1626
+ )
1627
+
1628
+
1629
+ @validate_call
1630
+ def sync_task_without_preload_content(
1631
+ self,
1632
+ model_id: StrictStr,
1633
+ _request_timeout: Union[
1634
+ None,
1635
+ Annotated[StrictFloat, Field(gt=0)],
1636
+ Tuple[
1637
+ Annotated[StrictFloat, Field(gt=0)],
1638
+ Annotated[StrictFloat, Field(gt=0)]
1639
+ ]
1640
+ ] = None,
1641
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1642
+ _content_type: Optional[StrictStr] = None,
1643
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1644
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1645
+ ) -> RESTResponseType:
1646
+ """Sync A Task
1647
+
1648
+ Submits a job to fetch the latest task state and returns the job ID. When the job finishes, it will upload the latest copy of the task state. Requires model_task_sync permission.
1649
+
1650
+ :param model_id: (required)
1651
+ :type model_id: str
1652
+ :param _request_timeout: timeout setting for this request. If one
1653
+ number provided, it will be total request
1654
+ timeout. It can also be a pair (tuple) of
1655
+ (connection, read) timeouts.
1656
+ :type _request_timeout: int, tuple(int, int), optional
1657
+ :param _request_auth: set to override the auth_settings for an a single
1658
+ request; this effectively ignores the
1659
+ authentication in the spec for a single request.
1660
+ :type _request_auth: dict, optional
1661
+ :param _content_type: force content-type for the request.
1662
+ :type _content_type: str, Optional
1663
+ :param _headers: set to override the headers for a single
1664
+ request; this effectively ignores the headers
1665
+ in the spec for a single request.
1666
+ :type _headers: dict, optional
1667
+ :param _host_index: set to override the host_index for a single
1668
+ request; this effectively ignores the host_index
1669
+ in the spec for a single request.
1670
+ :type _host_index: int, optional
1671
+ :return: Returns the result object.
1672
+ """ # noqa: E501
1673
+
1674
+ _param = self._sync_task_serialize(
1675
+ model_id=model_id,
1676
+ _request_auth=_request_auth,
1677
+ _content_type=_content_type,
1678
+ _headers=_headers,
1679
+ _host_index=_host_index
1680
+ )
1681
+
1682
+ _response_types_map: Dict[str, Optional[str]] = {
1683
+ '200': "TaskMutationResponse",
1684
+ '500': "InternalServerError",
1685
+ '400': "BadRequestError",
1686
+ '404': "NotFoundError",
1687
+ '422': "HTTPValidationError",
1688
+ }
1689
+ response_data = self.api_client.call_api(
1690
+ *_param,
1691
+ _request_timeout=_request_timeout
1692
+ )
1693
+ return response_data.response
1694
+
1695
+
1696
+ def _sync_task_serialize(
1697
+ self,
1698
+ model_id,
1699
+ _request_auth,
1700
+ _content_type,
1701
+ _headers,
1702
+ _host_index,
1703
+ ) -> RequestSerialized:
1704
+
1705
+ _host = None
1706
+
1707
+ _collection_formats: Dict[str, str] = {
1708
+ }
1709
+
1710
+ _path_params: Dict[str, str] = {}
1711
+ _query_params: List[Tuple[str, str]] = []
1712
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1713
+ _form_params: List[Tuple[str, str]] = []
1714
+ _files: Dict[
1715
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1716
+ ] = {}
1717
+ _body_params: Optional[bytes] = None
1718
+
1719
+ # process the path parameters
1720
+ if model_id is not None:
1721
+ _path_params['model_id'] = model_id
1722
+ # process the query parameters
1723
+ # process the header parameters
1724
+ # process the form parameters
1725
+ # process the body parameter
1726
+
1727
+
1728
+ # set the HTTP header `Accept`
1729
+ if 'Accept' not in _header_params:
1730
+ _header_params['Accept'] = self.api_client.select_header_accept(
1731
+ [
1732
+ 'application/json'
1733
+ ]
1734
+ )
1735
+
1736
+
1737
+ # authentication setting
1738
+ _auth_settings: List[str] = [
1739
+ 'OAuth2AuthorizationCode'
1740
+ ]
1741
+
1742
+ return self.api_client.param_serialize(
1743
+ method='POST',
1744
+ resource_path='/api/v1/models/{model_id}/task/sync',
1745
+ path_params=_path_params,
1746
+ query_params=_query_params,
1747
+ header_params=_header_params,
1748
+ body=_body_params,
1749
+ post_params=_form_params,
1750
+ files=_files,
1751
+ auth_settings=_auth_settings,
1752
+ collection_formats=_collection_formats,
1753
+ _host=_host,
1754
+ _request_auth=_request_auth
1755
+ )
1756
+
1757
+