2
2
3
3
from __future__ import annotations
4
4
5
+ from typing import Optional
6
+ from typing_extensions import Literal
7
+
5
8
import httpx
6
9
7
10
from ..._types import NOT_GIVEN , Body , Query , Headers , NotGiven
20
23
from ..._base_client import (
21
24
make_request_options ,
22
25
)
23
- from ...types .projects import inference_pipeline_list_params
26
+ from ...types .projects import inference_pipeline_list_params , inference_pipeline_create_params
24
27
from ...types .projects .inference_pipeline_list_response import InferencePipelineListResponse
28
+ from ...types .projects .inference_pipeline_create_response import InferencePipelineCreateResponse
25
29
26
30
__all__ = ["InferencePipelinesResource" , "AsyncInferencePipelinesResource" ]
27
31
@@ -35,6 +39,60 @@ def with_raw_response(self) -> InferencePipelinesResourceWithRawResponse:
35
39
def with_streaming_response (self ) -> InferencePipelinesResourceWithStreamingResponse :
36
40
return InferencePipelinesResourceWithStreamingResponse (self )
37
41
42
+ def create (
43
+ self ,
44
+ id : str ,
45
+ * ,
46
+ description : Optional [str ],
47
+ name : str ,
48
+ reference_dataset_uri : Optional [str ] | NotGiven = NOT_GIVEN ,
49
+ storage_type : Literal ["local" , "s3" , "gcs" , "azure" ] | NotGiven = NOT_GIVEN ,
50
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
51
+ # The extra values given here take precedence over values defined on the client or passed to this method.
52
+ extra_headers : Headers | None = None ,
53
+ extra_query : Query | None = None ,
54
+ extra_body : Body | None = None ,
55
+ timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
56
+ ) -> InferencePipelineCreateResponse :
57
+ """
58
+ Create an inference pipeline under a project.
59
+
60
+ Args:
61
+ description: The inference pipeline description.
62
+
63
+ name: The inference pipeline name.
64
+
65
+ reference_dataset_uri: The reference dataset URI.
66
+
67
+ storage_type: The storage type.
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
+ if not id :
78
+ raise ValueError (f"Expected a non-empty value for `id` but received { id !r} " )
79
+ return self ._post (
80
+ f"/projects/{ id } /inference-pipelines" ,
81
+ body = maybe_transform (
82
+ {
83
+ "description" : description ,
84
+ "name" : name ,
85
+ "reference_dataset_uri" : reference_dataset_uri ,
86
+ "storage_type" : storage_type ,
87
+ },
88
+ inference_pipeline_create_params .InferencePipelineCreateParams ,
89
+ ),
90
+ options = make_request_options (
91
+ extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
92
+ ),
93
+ cast_to = InferencePipelineCreateResponse ,
94
+ )
95
+
38
96
def list (
39
97
self ,
40
98
id : str ,
@@ -98,6 +156,60 @@ def with_raw_response(self) -> AsyncInferencePipelinesResourceWithRawResponse:
98
156
def with_streaming_response (self ) -> AsyncInferencePipelinesResourceWithStreamingResponse :
99
157
return AsyncInferencePipelinesResourceWithStreamingResponse (self )
100
158
159
+ async def create (
160
+ self ,
161
+ id : str ,
162
+ * ,
163
+ description : Optional [str ],
164
+ name : str ,
165
+ reference_dataset_uri : Optional [str ] | NotGiven = NOT_GIVEN ,
166
+ storage_type : Literal ["local" , "s3" , "gcs" , "azure" ] | NotGiven = NOT_GIVEN ,
167
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
168
+ # The extra values given here take precedence over values defined on the client or passed to this method.
169
+ extra_headers : Headers | None = None ,
170
+ extra_query : Query | None = None ,
171
+ extra_body : Body | None = None ,
172
+ timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
173
+ ) -> InferencePipelineCreateResponse :
174
+ """
175
+ Create an inference pipeline under a project.
176
+
177
+ Args:
178
+ description: The inference pipeline description.
179
+
180
+ name: The inference pipeline name.
181
+
182
+ reference_dataset_uri: The reference dataset URI.
183
+
184
+ storage_type: The storage type.
185
+
186
+ extra_headers: Send extra headers
187
+
188
+ extra_query: Add additional query parameters to the request
189
+
190
+ extra_body: Add additional JSON properties to the request
191
+
192
+ timeout: Override the client-level default timeout for this request, in seconds
193
+ """
194
+ if not id :
195
+ raise ValueError (f"Expected a non-empty value for `id` but received { id !r} " )
196
+ return await self ._post (
197
+ f"/projects/{ id } /inference-pipelines" ,
198
+ body = await async_maybe_transform (
199
+ {
200
+ "description" : description ,
201
+ "name" : name ,
202
+ "reference_dataset_uri" : reference_dataset_uri ,
203
+ "storage_type" : storage_type ,
204
+ },
205
+ inference_pipeline_create_params .InferencePipelineCreateParams ,
206
+ ),
207
+ options = make_request_options (
208
+ extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
209
+ ),
210
+ cast_to = InferencePipelineCreateResponse ,
211
+ )
212
+
101
213
async def list (
102
214
self ,
103
215
id : str ,
@@ -156,6 +268,9 @@ class InferencePipelinesResourceWithRawResponse:
156
268
def __init__ (self , inference_pipelines : InferencePipelinesResource ) -> None :
157
269
self ._inference_pipelines = inference_pipelines
158
270
271
+ self .create = to_raw_response_wrapper (
272
+ inference_pipelines .create ,
273
+ )
159
274
self .list = to_raw_response_wrapper (
160
275
inference_pipelines .list ,
161
276
)
@@ -165,6 +280,9 @@ class AsyncInferencePipelinesResourceWithRawResponse:
165
280
def __init__ (self , inference_pipelines : AsyncInferencePipelinesResource ) -> None :
166
281
self ._inference_pipelines = inference_pipelines
167
282
283
+ self .create = async_to_raw_response_wrapper (
284
+ inference_pipelines .create ,
285
+ )
168
286
self .list = async_to_raw_response_wrapper (
169
287
inference_pipelines .list ,
170
288
)
@@ -174,6 +292,9 @@ class InferencePipelinesResourceWithStreamingResponse:
174
292
def __init__ (self , inference_pipelines : InferencePipelinesResource ) -> None :
175
293
self ._inference_pipelines = inference_pipelines
176
294
295
+ self .create = to_streamed_response_wrapper (
296
+ inference_pipelines .create ,
297
+ )
177
298
self .list = to_streamed_response_wrapper (
178
299
inference_pipelines .list ,
179
300
)
@@ -183,6 +304,9 @@ class AsyncInferencePipelinesResourceWithStreamingResponse:
183
304
def __init__ (self , inference_pipelines : AsyncInferencePipelinesResource ) -> None :
184
305
self ._inference_pipelines = inference_pipelines
185
306
307
+ self .create = async_to_streamed_response_wrapper (
308
+ inference_pipelines .create ,
309
+ )
186
310
self .list = async_to_streamed_response_wrapper (
187
311
inference_pipelines .list ,
188
312
)
0 commit comments