22
33from __future__ import annotations
44
5- from typing import Mapping , cast
6-
75import httpx
86
9- from ..types import snapshot_create_params , snapshot_create_from_files_params
10- from .._types import Body , Omit , Query , Headers , NotGiven , FileTypes , omit , not_given
11- from .._utils import extract_files , maybe_transform , deepcopy_minimal , async_maybe_transform
7+ from ..types import snapshot_create_params
8+ from .._types import Body , Omit , Query , Headers , NotGiven , omit , not_given
9+ from .._utils import maybe_transform , async_maybe_transform
1210from .._compat import cached_property
1311from .._resource import SyncAPIResource , AsyncAPIResource
1412from .._response import (
1917)
2018from .._base_client import make_request_options
2119from ..types .snapshot_create_response import SnapshotCreateResponse
22- from ..types .snapshot_create_from_files_response import SnapshotCreateFromFilesResponse
2320
2421__all__ = ["SnapshotsResource" , "AsyncSnapshotsResource" ]
2522
@@ -88,65 +85,6 @@ def create(
8885 cast_to = SnapshotCreateResponse ,
8986 )
9087
91- def create_from_files (
92- self ,
93- * ,
94- label : str ,
95- project_id : str ,
96- training_file : FileTypes ,
97- validation_file : FileTypes ,
98- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
99- # The extra values given here take precedence over values defined on the client or passed to this method.
100- extra_headers : Headers | None = None ,
101- extra_query : Query | None = None ,
102- extra_body : Body | None = None ,
103- timeout : float | httpx .Timeout | None | NotGiven = not_given ,
104- ) -> SnapshotCreateFromFilesResponse :
105- """
106- Create snapshot from separate training and validation files
107-
108- Args:
109- label: Snapshot name shown in the dashboard once the snapshot is created.
110-
111- project_id: Project ID that will own the generated snapshot. Must match an existing project.
112-
113- training_file: Required JSONL training file. Upload line-delimited messages that will form the
114- training split.
115-
116- validation_file: Required JSONL validation file. Upload line-delimited messages reserved for
117- validation.
118-
119- extra_headers: Send extra headers
120-
121- extra_query: Add additional query parameters to the request
122-
123- extra_body: Add additional JSON properties to the request
124-
125- timeout: Override the client-level default timeout for this request, in seconds
126- """
127- body = deepcopy_minimal (
128- {
129- "label" : label ,
130- "project_id" : project_id ,
131- "training_file" : training_file ,
132- "validation_file" : validation_file ,
133- }
134- )
135- files = extract_files (cast (Mapping [str , object ], body ), paths = [["training_file" ], ["validation_file" ]])
136- # It should be noted that the actual Content-Type header that will be
137- # sent to the server will contain a `boundary` parameter, e.g.
138- # multipart/form-data; boundary=---abc--
139- extra_headers = {"Content-Type" : "multipart/form-data" , ** (extra_headers or {})}
140- return self ._post (
141- "/api/v1/public/snapshots/create-from-files" ,
142- body = maybe_transform (body , snapshot_create_from_files_params .SnapshotCreateFromFilesParams ),
143- files = files ,
144- options = make_request_options (
145- extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
146- ),
147- cast_to = SnapshotCreateFromFilesResponse ,
148- )
149-
15088
15189class AsyncSnapshotsResource (AsyncAPIResource ):
15290 @cached_property
@@ -212,65 +150,6 @@ async def create(
212150 cast_to = SnapshotCreateResponse ,
213151 )
214152
215- async def create_from_files (
216- self ,
217- * ,
218- label : str ,
219- project_id : str ,
220- training_file : FileTypes ,
221- validation_file : FileTypes ,
222- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
223- # The extra values given here take precedence over values defined on the client or passed to this method.
224- extra_headers : Headers | None = None ,
225- extra_query : Query | None = None ,
226- extra_body : Body | None = None ,
227- timeout : float | httpx .Timeout | None | NotGiven = not_given ,
228- ) -> SnapshotCreateFromFilesResponse :
229- """
230- Create snapshot from separate training and validation files
231-
232- Args:
233- label: Snapshot name shown in the dashboard once the snapshot is created.
234-
235- project_id: Project ID that will own the generated snapshot. Must match an existing project.
236-
237- training_file: Required JSONL training file. Upload line-delimited messages that will form the
238- training split.
239-
240- validation_file: Required JSONL validation file. Upload line-delimited messages reserved for
241- validation.
242-
243- extra_headers: Send extra headers
244-
245- extra_query: Add additional query parameters to the request
246-
247- extra_body: Add additional JSON properties to the request
248-
249- timeout: Override the client-level default timeout for this request, in seconds
250- """
251- body = deepcopy_minimal (
252- {
253- "label" : label ,
254- "project_id" : project_id ,
255- "training_file" : training_file ,
256- "validation_file" : validation_file ,
257- }
258- )
259- files = extract_files (cast (Mapping [str , object ], body ), paths = [["training_file" ], ["validation_file" ]])
260- # It should be noted that the actual Content-Type header that will be
261- # sent to the server will contain a `boundary` parameter, e.g.
262- # multipart/form-data; boundary=---abc--
263- extra_headers = {"Content-Type" : "multipart/form-data" , ** (extra_headers or {})}
264- return await self ._post (
265- "/api/v1/public/snapshots/create-from-files" ,
266- body = await async_maybe_transform (body , snapshot_create_from_files_params .SnapshotCreateFromFilesParams ),
267- files = files ,
268- options = make_request_options (
269- extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
270- ),
271- cast_to = SnapshotCreateFromFilesResponse ,
272- )
273-
274153
275154class SnapshotsResourceWithRawResponse :
276155 def __init__ (self , snapshots : SnapshotsResource ) -> None :
@@ -279,9 +158,6 @@ def __init__(self, snapshots: SnapshotsResource) -> None:
279158 self .create = to_raw_response_wrapper (
280159 snapshots .create ,
281160 )
282- self .create_from_files = to_raw_response_wrapper (
283- snapshots .create_from_files ,
284- )
285161
286162
287163class AsyncSnapshotsResourceWithRawResponse :
@@ -291,9 +167,6 @@ def __init__(self, snapshots: AsyncSnapshotsResource) -> None:
291167 self .create = async_to_raw_response_wrapper (
292168 snapshots .create ,
293169 )
294- self .create_from_files = async_to_raw_response_wrapper (
295- snapshots .create_from_files ,
296- )
297170
298171
299172class SnapshotsResourceWithStreamingResponse :
@@ -303,9 +176,6 @@ def __init__(self, snapshots: SnapshotsResource) -> None:
303176 self .create = to_streamed_response_wrapper (
304177 snapshots .create ,
305178 )
306- self .create_from_files = to_streamed_response_wrapper (
307- snapshots .create_from_files ,
308- )
309179
310180
311181class AsyncSnapshotsResourceWithStreamingResponse :
@@ -315,6 +185,3 @@ def __init__(self, snapshots: AsyncSnapshotsResource) -> None:
315185 self .create = async_to_streamed_response_wrapper (
316186 snapshots .create ,
317187 )
318- self .create_from_files = async_to_streamed_response_wrapper (
319- snapshots .create_from_files ,
320- )
0 commit comments