2
2
3
3
from __future__ import annotations
4
4
5
+ from typing import Optional
6
+
5
7
import httpx
6
8
7
9
from .data import (
20
22
RowsResourceWithStreamingResponse ,
21
23
AsyncRowsResourceWithStreamingResponse ,
22
24
)
25
+ from ...types import inference_pipeline_update_params
23
26
from ..._types import NOT_GIVEN , Body , Query , Headers , NoneType , NotGiven
27
+ from ..._utils import (
28
+ maybe_transform ,
29
+ async_maybe_transform ,
30
+ )
24
31
from ..._compat import cached_property
25
32
from ..._resource import SyncAPIResource , AsyncAPIResource
26
33
from ..._response import (
38
45
AsyncTestResultsResourceWithStreamingResponse ,
39
46
)
40
47
from ..._base_client import make_request_options
48
+ from ...types .inference_pipeline_update_response import InferencePipelineUpdateResponse
41
49
from ...types .inference_pipeline_retrieve_response import InferencePipelineRetrieveResponse
42
50
43
51
__all__ = ["InferencePipelinesResource" , "AsyncInferencePipelinesResource" ]
@@ -99,6 +107,59 @@ def retrieve(
99
107
cast_to = InferencePipelineRetrieveResponse ,
100
108
)
101
109
110
+ def update (
111
+ self ,
112
+ inference_pipeline_id : str ,
113
+ * ,
114
+ description : Optional [str ] | NotGiven = NOT_GIVEN ,
115
+ name : str | NotGiven = NOT_GIVEN ,
116
+ reference_dataset_uri : Optional [str ] | NotGiven = NOT_GIVEN ,
117
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
118
+ # The extra values given here take precedence over values defined on the client or passed to this method.
119
+ extra_headers : Headers | None = None ,
120
+ extra_query : Query | None = None ,
121
+ extra_body : Body | None = None ,
122
+ timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
123
+ ) -> InferencePipelineUpdateResponse :
124
+ """
125
+ Update inference pipeline.
126
+
127
+ Args:
128
+ description: The inference pipeline description.
129
+
130
+ name: The inference pipeline name.
131
+
132
+ reference_dataset_uri: The storage uri of your reference dataset. We recommend using the Python SDK or
133
+ the UI to handle your reference dataset updates.
134
+
135
+ extra_headers: Send extra headers
136
+
137
+ extra_query: Add additional query parameters to the request
138
+
139
+ extra_body: Add additional JSON properties to the request
140
+
141
+ timeout: Override the client-level default timeout for this request, in seconds
142
+ """
143
+ if not inference_pipeline_id :
144
+ raise ValueError (
145
+ f"Expected a non-empty value for `inference_pipeline_id` but received { inference_pipeline_id !r} "
146
+ )
147
+ return self ._put (
148
+ f"/inference-pipelines/{ inference_pipeline_id } " ,
149
+ body = maybe_transform (
150
+ {
151
+ "description" : description ,
152
+ "name" : name ,
153
+ "reference_dataset_uri" : reference_dataset_uri ,
154
+ },
155
+ inference_pipeline_update_params .InferencePipelineUpdateParams ,
156
+ ),
157
+ options = make_request_options (
158
+ extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
159
+ ),
160
+ cast_to = InferencePipelineUpdateResponse ,
161
+ )
162
+
102
163
def delete (
103
164
self ,
104
165
inference_pipeline_id : str ,
@@ -192,6 +253,59 @@ async def retrieve(
192
253
cast_to = InferencePipelineRetrieveResponse ,
193
254
)
194
255
256
+ async def update (
257
+ self ,
258
+ inference_pipeline_id : str ,
259
+ * ,
260
+ description : Optional [str ] | NotGiven = NOT_GIVEN ,
261
+ name : str | NotGiven = NOT_GIVEN ,
262
+ reference_dataset_uri : Optional [str ] | NotGiven = NOT_GIVEN ,
263
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
264
+ # The extra values given here take precedence over values defined on the client or passed to this method.
265
+ extra_headers : Headers | None = None ,
266
+ extra_query : Query | None = None ,
267
+ extra_body : Body | None = None ,
268
+ timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
269
+ ) -> InferencePipelineUpdateResponse :
270
+ """
271
+ Update inference pipeline.
272
+
273
+ Args:
274
+ description: The inference pipeline description.
275
+
276
+ name: The inference pipeline name.
277
+
278
+ reference_dataset_uri: The storage uri of your reference dataset. We recommend using the Python SDK or
279
+ the UI to handle your reference dataset updates.
280
+
281
+ extra_headers: Send extra headers
282
+
283
+ extra_query: Add additional query parameters to the request
284
+
285
+ extra_body: Add additional JSON properties to the request
286
+
287
+ timeout: Override the client-level default timeout for this request, in seconds
288
+ """
289
+ if not inference_pipeline_id :
290
+ raise ValueError (
291
+ f"Expected a non-empty value for `inference_pipeline_id` but received { inference_pipeline_id !r} "
292
+ )
293
+ return await self ._put (
294
+ f"/inference-pipelines/{ inference_pipeline_id } " ,
295
+ body = await async_maybe_transform (
296
+ {
297
+ "description" : description ,
298
+ "name" : name ,
299
+ "reference_dataset_uri" : reference_dataset_uri ,
300
+ },
301
+ inference_pipeline_update_params .InferencePipelineUpdateParams ,
302
+ ),
303
+ options = make_request_options (
304
+ extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
305
+ ),
306
+ cast_to = InferencePipelineUpdateResponse ,
307
+ )
308
+
195
309
async def delete (
196
310
self ,
197
311
inference_pipeline_id : str ,
@@ -236,6 +350,9 @@ def __init__(self, inference_pipelines: InferencePipelinesResource) -> None:
236
350
self .retrieve = to_raw_response_wrapper (
237
351
inference_pipelines .retrieve ,
238
352
)
353
+ self .update = to_raw_response_wrapper (
354
+ inference_pipelines .update ,
355
+ )
239
356
self .delete = to_raw_response_wrapper (
240
357
inference_pipelines .delete ,
241
358
)
@@ -260,6 +377,9 @@ def __init__(self, inference_pipelines: AsyncInferencePipelinesResource) -> None
260
377
self .retrieve = async_to_raw_response_wrapper (
261
378
inference_pipelines .retrieve ,
262
379
)
380
+ self .update = async_to_raw_response_wrapper (
381
+ inference_pipelines .update ,
382
+ )
263
383
self .delete = async_to_raw_response_wrapper (
264
384
inference_pipelines .delete ,
265
385
)
@@ -284,6 +404,9 @@ def __init__(self, inference_pipelines: InferencePipelinesResource) -> None:
284
404
self .retrieve = to_streamed_response_wrapper (
285
405
inference_pipelines .retrieve ,
286
406
)
407
+ self .update = to_streamed_response_wrapper (
408
+ inference_pipelines .update ,
409
+ )
287
410
self .delete = to_streamed_response_wrapper (
288
411
inference_pipelines .delete ,
289
412
)
@@ -308,6 +431,9 @@ def __init__(self, inference_pipelines: AsyncInferencePipelinesResource) -> None
308
431
self .retrieve = async_to_streamed_response_wrapper (
309
432
inference_pipelines .retrieve ,
310
433
)
434
+ self .update = async_to_streamed_response_wrapper (
435
+ inference_pipelines .update ,
436
+ )
311
437
self .delete = async_to_streamed_response_wrapper (
312
438
inference_pipelines .delete ,
313
439
)
0 commit comments