22
33from __future__ import annotations
44
5+ from typing import Optional
6+
57import httpx
68
79from .data import (
2022 RowsResourceWithStreamingResponse ,
2123 AsyncRowsResourceWithStreamingResponse ,
2224)
25+ from ...types import inference_pipeline_update_params
2326from ..._types import NOT_GIVEN , Body , Query , Headers , NoneType , NotGiven
27+ from ..._utils import (
28+ maybe_transform ,
29+ async_maybe_transform ,
30+ )
2431from ..._compat import cached_property
2532from ..._resource import SyncAPIResource , AsyncAPIResource
2633from ..._response import (
3845 AsyncTestResultsResourceWithStreamingResponse ,
3946)
4047from ..._base_client import make_request_options
48+ from ...types .inference_pipeline_update_response import InferencePipelineUpdateResponse
4149from ...types .inference_pipeline_retrieve_response import InferencePipelineRetrieveResponse
4250
4351__all__ = ["InferencePipelinesResource" , "AsyncInferencePipelinesResource" ]
@@ -99,6 +107,59 @@ def retrieve(
99107 cast_to = InferencePipelineRetrieveResponse ,
100108 )
101109
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+
102163 def delete (
103164 self ,
104165 inference_pipeline_id : str ,
@@ -192,6 +253,59 @@ async def retrieve(
192253 cast_to = InferencePipelineRetrieveResponse ,
193254 )
194255
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+
195309 async def delete (
196310 self ,
197311 inference_pipeline_id : str ,
@@ -236,6 +350,9 @@ def __init__(self, inference_pipelines: InferencePipelinesResource) -> None:
236350 self .retrieve = to_raw_response_wrapper (
237351 inference_pipelines .retrieve ,
238352 )
353+ self .update = to_raw_response_wrapper (
354+ inference_pipelines .update ,
355+ )
239356 self .delete = to_raw_response_wrapper (
240357 inference_pipelines .delete ,
241358 )
@@ -260,6 +377,9 @@ def __init__(self, inference_pipelines: AsyncInferencePipelinesResource) -> None
260377 self .retrieve = async_to_raw_response_wrapper (
261378 inference_pipelines .retrieve ,
262379 )
380+ self .update = async_to_raw_response_wrapper (
381+ inference_pipelines .update ,
382+ )
263383 self .delete = async_to_raw_response_wrapper (
264384 inference_pipelines .delete ,
265385 )
@@ -284,6 +404,9 @@ def __init__(self, inference_pipelines: InferencePipelinesResource) -> None:
284404 self .retrieve = to_streamed_response_wrapper (
285405 inference_pipelines .retrieve ,
286406 )
407+ self .update = to_streamed_response_wrapper (
408+ inference_pipelines .update ,
409+ )
287410 self .delete = to_streamed_response_wrapper (
288411 inference_pipelines .delete ,
289412 )
@@ -308,6 +431,9 @@ def __init__(self, inference_pipelines: AsyncInferencePipelinesResource) -> None
308431 self .retrieve = async_to_streamed_response_wrapper (
309432 inference_pipelines .retrieve ,
310433 )
434+ self .update = async_to_streamed_response_wrapper (
435+ inference_pipelines .update ,
436+ )
311437 self .delete = async_to_streamed_response_wrapper (
312438 inference_pipelines .delete ,
313439 )
0 commit comments