scale-gp-beta 0.1.0a36__py3-none-any.whl → 0.1.0a38__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.
- scale_gp_beta/_models.py +37 -15
- scale_gp_beta/_utils/_sync.py +3 -31
- scale_gp_beta/_utils/_utils.py +1 -1
- scale_gp_beta/_version.py +1 -1
- scale_gp_beta/resources/dataset_items.py +28 -2
- scale_gp_beta/resources/datasets.py +8 -0
- scale_gp_beta/resources/evaluations.py +16 -0
- scale_gp_beta/resources/files/files.py +83 -2
- scale_gp_beta/resources/questions.py +107 -1
- scale_gp_beta/types/__init__.py +2 -0
- scale_gp_beta/types/dataset_create_params.py +3 -0
- scale_gp_beta/types/dataset_item_batch_create_params.py +3 -0
- scale_gp_beta/types/dataset_item_update_params.py +3 -0
- scale_gp_beta/types/evaluation_create_params.py +6 -0
- scale_gp_beta/types/evaluation_task.py +18 -0
- scale_gp_beta/types/evaluation_task_param.py +18 -0
- scale_gp_beta/types/file_import_from_cloud_params.py +27 -0
- scale_gp_beta/types/file_import_from_cloud_response.py +35 -0
- scale_gp_beta/types/question.py +48 -1
- scale_gp_beta/types/question_create_params.py +38 -1
- {scale_gp_beta-0.1.0a36.dist-info → scale_gp_beta-0.1.0a38.dist-info}/METADATA +4 -5
- {scale_gp_beta-0.1.0a36.dist-info → scale_gp_beta-0.1.0a38.dist-info}/RECORD +24 -22
- {scale_gp_beta-0.1.0a36.dist-info → scale_gp_beta-0.1.0a38.dist-info}/WHEEL +0 -0
- {scale_gp_beta-0.1.0a36.dist-info → scale_gp_beta-0.1.0a38.dist-info}/licenses/LICENSE +0 -0
scale_gp_beta/_models.py
CHANGED
|
@@ -2,6 +2,7 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
import os
|
|
4
4
|
import inspect
|
|
5
|
+
import weakref
|
|
5
6
|
from typing import TYPE_CHECKING, Any, Type, Union, Generic, TypeVar, Callable, Optional, cast
|
|
6
7
|
from datetime import date, datetime
|
|
7
8
|
from typing_extensions import (
|
|
@@ -256,15 +257,16 @@ class BaseModel(pydantic.BaseModel):
|
|
|
256
257
|
mode: Literal["json", "python"] | str = "python",
|
|
257
258
|
include: IncEx | None = None,
|
|
258
259
|
exclude: IncEx | None = None,
|
|
260
|
+
context: Any | None = None,
|
|
259
261
|
by_alias: bool | None = None,
|
|
260
262
|
exclude_unset: bool = False,
|
|
261
263
|
exclude_defaults: bool = False,
|
|
262
264
|
exclude_none: bool = False,
|
|
265
|
+
exclude_computed_fields: bool = False,
|
|
263
266
|
round_trip: bool = False,
|
|
264
267
|
warnings: bool | Literal["none", "warn", "error"] = True,
|
|
265
|
-
context: dict[str, Any] | None = None,
|
|
266
|
-
serialize_as_any: bool = False,
|
|
267
268
|
fallback: Callable[[Any], Any] | None = None,
|
|
269
|
+
serialize_as_any: bool = False,
|
|
268
270
|
) -> dict[str, Any]:
|
|
269
271
|
"""Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump
|
|
270
272
|
|
|
@@ -272,16 +274,24 @@ class BaseModel(pydantic.BaseModel):
|
|
|
272
274
|
|
|
273
275
|
Args:
|
|
274
276
|
mode: The mode in which `to_python` should run.
|
|
275
|
-
If mode is 'json', the
|
|
276
|
-
If mode is 'python', the
|
|
277
|
-
include: A
|
|
278
|
-
exclude: A
|
|
277
|
+
If mode is 'json', the output will only contain JSON serializable types.
|
|
278
|
+
If mode is 'python', the output may contain non-JSON-serializable Python objects.
|
|
279
|
+
include: A set of fields to include in the output.
|
|
280
|
+
exclude: A set of fields to exclude from the output.
|
|
281
|
+
context: Additional context to pass to the serializer.
|
|
279
282
|
by_alias: Whether to use the field's alias in the dictionary key if defined.
|
|
280
|
-
exclude_unset: Whether to exclude fields that
|
|
281
|
-
exclude_defaults: Whether to exclude fields that are set to their default value
|
|
282
|
-
exclude_none: Whether to exclude fields that have a value of `None
|
|
283
|
-
|
|
284
|
-
|
|
283
|
+
exclude_unset: Whether to exclude fields that have not been explicitly set.
|
|
284
|
+
exclude_defaults: Whether to exclude fields that are set to their default value.
|
|
285
|
+
exclude_none: Whether to exclude fields that have a value of `None`.
|
|
286
|
+
exclude_computed_fields: Whether to exclude computed fields.
|
|
287
|
+
While this can be useful for round-tripping, it is usually recommended to use the dedicated
|
|
288
|
+
`round_trip` parameter instead.
|
|
289
|
+
round_trip: If True, dumped values should be valid as input for non-idempotent types such as Json[T].
|
|
290
|
+
warnings: How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors,
|
|
291
|
+
"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError].
|
|
292
|
+
fallback: A function to call when an unknown value is encountered. If not provided,
|
|
293
|
+
a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised.
|
|
294
|
+
serialize_as_any: Whether to serialize fields with duck-typing serialization behavior.
|
|
285
295
|
|
|
286
296
|
Returns:
|
|
287
297
|
A dictionary representation of the model.
|
|
@@ -298,6 +308,8 @@ class BaseModel(pydantic.BaseModel):
|
|
|
298
308
|
raise ValueError("serialize_as_any is only supported in Pydantic v2")
|
|
299
309
|
if fallback is not None:
|
|
300
310
|
raise ValueError("fallback is only supported in Pydantic v2")
|
|
311
|
+
if exclude_computed_fields != False:
|
|
312
|
+
raise ValueError("exclude_computed_fields is only supported in Pydantic v2")
|
|
301
313
|
dumped = super().dict( # pyright: ignore[reportDeprecated]
|
|
302
314
|
include=include,
|
|
303
315
|
exclude=exclude,
|
|
@@ -314,15 +326,17 @@ class BaseModel(pydantic.BaseModel):
|
|
|
314
326
|
self,
|
|
315
327
|
*,
|
|
316
328
|
indent: int | None = None,
|
|
329
|
+
ensure_ascii: bool = False,
|
|
317
330
|
include: IncEx | None = None,
|
|
318
331
|
exclude: IncEx | None = None,
|
|
332
|
+
context: Any | None = None,
|
|
319
333
|
by_alias: bool | None = None,
|
|
320
334
|
exclude_unset: bool = False,
|
|
321
335
|
exclude_defaults: bool = False,
|
|
322
336
|
exclude_none: bool = False,
|
|
337
|
+
exclude_computed_fields: bool = False,
|
|
323
338
|
round_trip: bool = False,
|
|
324
339
|
warnings: bool | Literal["none", "warn", "error"] = True,
|
|
325
|
-
context: dict[str, Any] | None = None,
|
|
326
340
|
fallback: Callable[[Any], Any] | None = None,
|
|
327
341
|
serialize_as_any: bool = False,
|
|
328
342
|
) -> str:
|
|
@@ -354,6 +368,10 @@ class BaseModel(pydantic.BaseModel):
|
|
|
354
368
|
raise ValueError("serialize_as_any is only supported in Pydantic v2")
|
|
355
369
|
if fallback is not None:
|
|
356
370
|
raise ValueError("fallback is only supported in Pydantic v2")
|
|
371
|
+
if ensure_ascii != False:
|
|
372
|
+
raise ValueError("ensure_ascii is only supported in Pydantic v2")
|
|
373
|
+
if exclude_computed_fields != False:
|
|
374
|
+
raise ValueError("exclude_computed_fields is only supported in Pydantic v2")
|
|
357
375
|
return super().json( # type: ignore[reportDeprecated]
|
|
358
376
|
indent=indent,
|
|
359
377
|
include=include,
|
|
@@ -573,6 +591,9 @@ class CachedDiscriminatorType(Protocol):
|
|
|
573
591
|
__discriminator__: DiscriminatorDetails
|
|
574
592
|
|
|
575
593
|
|
|
594
|
+
DISCRIMINATOR_CACHE: weakref.WeakKeyDictionary[type, DiscriminatorDetails] = weakref.WeakKeyDictionary()
|
|
595
|
+
|
|
596
|
+
|
|
576
597
|
class DiscriminatorDetails:
|
|
577
598
|
field_name: str
|
|
578
599
|
"""The name of the discriminator field in the variant class, e.g.
|
|
@@ -615,8 +636,9 @@ class DiscriminatorDetails:
|
|
|
615
636
|
|
|
616
637
|
|
|
617
638
|
def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any, ...]) -> DiscriminatorDetails | None:
|
|
618
|
-
|
|
619
|
-
|
|
639
|
+
cached = DISCRIMINATOR_CACHE.get(union)
|
|
640
|
+
if cached is not None:
|
|
641
|
+
return cached
|
|
620
642
|
|
|
621
643
|
discriminator_field_name: str | None = None
|
|
622
644
|
|
|
@@ -669,7 +691,7 @@ def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any,
|
|
|
669
691
|
discriminator_field=discriminator_field_name,
|
|
670
692
|
discriminator_alias=discriminator_alias,
|
|
671
693
|
)
|
|
672
|
-
|
|
694
|
+
DISCRIMINATOR_CACHE.setdefault(union, details)
|
|
673
695
|
return details
|
|
674
696
|
|
|
675
697
|
|
scale_gp_beta/_utils/_sync.py
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
import sys
|
|
4
3
|
import asyncio
|
|
5
4
|
import functools
|
|
6
|
-
import
|
|
7
|
-
from typing import Any, TypeVar, Callable, Awaitable
|
|
5
|
+
from typing import TypeVar, Callable, Awaitable
|
|
8
6
|
from typing_extensions import ParamSpec
|
|
9
7
|
|
|
10
8
|
import anyio
|
|
@@ -15,34 +13,11 @@ T_Retval = TypeVar("T_Retval")
|
|
|
15
13
|
T_ParamSpec = ParamSpec("T_ParamSpec")
|
|
16
14
|
|
|
17
15
|
|
|
18
|
-
if sys.version_info >= (3, 9):
|
|
19
|
-
_asyncio_to_thread = asyncio.to_thread
|
|
20
|
-
else:
|
|
21
|
-
# backport of https://docs.python.org/3/library/asyncio-task.html#asyncio.to_thread
|
|
22
|
-
# for Python 3.8 support
|
|
23
|
-
async def _asyncio_to_thread(
|
|
24
|
-
func: Callable[T_ParamSpec, T_Retval], /, *args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs
|
|
25
|
-
) -> Any:
|
|
26
|
-
"""Asynchronously run function *func* in a separate thread.
|
|
27
|
-
|
|
28
|
-
Any *args and **kwargs supplied for this function are directly passed
|
|
29
|
-
to *func*. Also, the current :class:`contextvars.Context` is propagated,
|
|
30
|
-
allowing context variables from the main thread to be accessed in the
|
|
31
|
-
separate thread.
|
|
32
|
-
|
|
33
|
-
Returns a coroutine that can be awaited to get the eventual result of *func*.
|
|
34
|
-
"""
|
|
35
|
-
loop = asyncio.events.get_running_loop()
|
|
36
|
-
ctx = contextvars.copy_context()
|
|
37
|
-
func_call = functools.partial(ctx.run, func, *args, **kwargs)
|
|
38
|
-
return await loop.run_in_executor(None, func_call)
|
|
39
|
-
|
|
40
|
-
|
|
41
16
|
async def to_thread(
|
|
42
17
|
func: Callable[T_ParamSpec, T_Retval], /, *args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs
|
|
43
18
|
) -> T_Retval:
|
|
44
19
|
if sniffio.current_async_library() == "asyncio":
|
|
45
|
-
return await
|
|
20
|
+
return await asyncio.to_thread(func, *args, **kwargs)
|
|
46
21
|
|
|
47
22
|
return await anyio.to_thread.run_sync(
|
|
48
23
|
functools.partial(func, *args, **kwargs),
|
|
@@ -53,10 +28,7 @@ async def to_thread(
|
|
|
53
28
|
def asyncify(function: Callable[T_ParamSpec, T_Retval]) -> Callable[T_ParamSpec, Awaitable[T_Retval]]:
|
|
54
29
|
"""
|
|
55
30
|
Take a blocking function and create an async one that receives the same
|
|
56
|
-
positional and keyword arguments.
|
|
57
|
-
asyncio.to_thread to run the function in a separate thread. For python version
|
|
58
|
-
3.8, it uses locally defined copy of the asyncio.to_thread function which was
|
|
59
|
-
introduced in python 3.9.
|
|
31
|
+
positional and keyword arguments.
|
|
60
32
|
|
|
61
33
|
Usage:
|
|
62
34
|
|
scale_gp_beta/_utils/_utils.py
CHANGED
|
@@ -133,7 +133,7 @@ def is_given(obj: _T | NotGiven | Omit) -> TypeGuard[_T]:
|
|
|
133
133
|
# Type safe methods for narrowing types with TypeVars.
|
|
134
134
|
# The default narrowing for isinstance(obj, dict) is dict[unknown, unknown],
|
|
135
135
|
# however this cause Pyright to rightfully report errors. As we know we don't
|
|
136
|
-
# care about the contained types we can safely use `object` in
|
|
136
|
+
# care about the contained types we can safely use `object` in its place.
|
|
137
137
|
#
|
|
138
138
|
# There are two separate functions defined, `is_*` and `is_*_t` for different use cases.
|
|
139
139
|
# `is_*` is for when you're dealing with an unknown input
|
scale_gp_beta/_version.py
CHANGED
|
@@ -98,6 +98,7 @@ class DatasetItemsResource(SyncAPIResource):
|
|
|
98
98
|
dataset_item_id: str,
|
|
99
99
|
*,
|
|
100
100
|
data: Dict[str, object],
|
|
101
|
+
files: Dict[str, str] | Omit = omit,
|
|
101
102
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
102
103
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
103
104
|
extra_headers: Headers | None = None,
|
|
@@ -111,6 +112,8 @@ class DatasetItemsResource(SyncAPIResource):
|
|
|
111
112
|
Args:
|
|
112
113
|
data: Updated dataset item data
|
|
113
114
|
|
|
115
|
+
files: Files to be associated to the dataset
|
|
116
|
+
|
|
114
117
|
extra_headers: Send extra headers
|
|
115
118
|
|
|
116
119
|
extra_query: Add additional query parameters to the request
|
|
@@ -123,7 +126,13 @@ class DatasetItemsResource(SyncAPIResource):
|
|
|
123
126
|
raise ValueError(f"Expected a non-empty value for `dataset_item_id` but received {dataset_item_id!r}")
|
|
124
127
|
return self._patch(
|
|
125
128
|
f"/v5/dataset-items/{dataset_item_id}",
|
|
126
|
-
body=maybe_transform(
|
|
129
|
+
body=maybe_transform(
|
|
130
|
+
{
|
|
131
|
+
"data": data,
|
|
132
|
+
"files": files,
|
|
133
|
+
},
|
|
134
|
+
dataset_item_update_params.DatasetItemUpdateParams,
|
|
135
|
+
),
|
|
127
136
|
options=make_request_options(
|
|
128
137
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
129
138
|
),
|
|
@@ -228,6 +237,7 @@ class DatasetItemsResource(SyncAPIResource):
|
|
|
228
237
|
*,
|
|
229
238
|
data: Iterable[Dict[str, object]],
|
|
230
239
|
dataset_id: str,
|
|
240
|
+
files: Iterable[Dict[str, str]] | Omit = omit,
|
|
231
241
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
232
242
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
233
243
|
extra_headers: Headers | None = None,
|
|
@@ -243,6 +253,8 @@ class DatasetItemsResource(SyncAPIResource):
|
|
|
243
253
|
|
|
244
254
|
dataset_id: Identifier of the target dataset
|
|
245
255
|
|
|
256
|
+
files: Files to be associated to the dataset
|
|
257
|
+
|
|
246
258
|
extra_headers: Send extra headers
|
|
247
259
|
|
|
248
260
|
extra_query: Add additional query parameters to the request
|
|
@@ -257,6 +269,7 @@ class DatasetItemsResource(SyncAPIResource):
|
|
|
257
269
|
{
|
|
258
270
|
"data": data,
|
|
259
271
|
"dataset_id": dataset_id,
|
|
272
|
+
"files": files,
|
|
260
273
|
},
|
|
261
274
|
dataset_item_batch_create_params.DatasetItemBatchCreateParams,
|
|
262
275
|
),
|
|
@@ -335,6 +348,7 @@ class AsyncDatasetItemsResource(AsyncAPIResource):
|
|
|
335
348
|
dataset_item_id: str,
|
|
336
349
|
*,
|
|
337
350
|
data: Dict[str, object],
|
|
351
|
+
files: Dict[str, str] | Omit = omit,
|
|
338
352
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
339
353
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
340
354
|
extra_headers: Headers | None = None,
|
|
@@ -348,6 +362,8 @@ class AsyncDatasetItemsResource(AsyncAPIResource):
|
|
|
348
362
|
Args:
|
|
349
363
|
data: Updated dataset item data
|
|
350
364
|
|
|
365
|
+
files: Files to be associated to the dataset
|
|
366
|
+
|
|
351
367
|
extra_headers: Send extra headers
|
|
352
368
|
|
|
353
369
|
extra_query: Add additional query parameters to the request
|
|
@@ -360,7 +376,13 @@ class AsyncDatasetItemsResource(AsyncAPIResource):
|
|
|
360
376
|
raise ValueError(f"Expected a non-empty value for `dataset_item_id` but received {dataset_item_id!r}")
|
|
361
377
|
return await self._patch(
|
|
362
378
|
f"/v5/dataset-items/{dataset_item_id}",
|
|
363
|
-
body=await async_maybe_transform(
|
|
379
|
+
body=await async_maybe_transform(
|
|
380
|
+
{
|
|
381
|
+
"data": data,
|
|
382
|
+
"files": files,
|
|
383
|
+
},
|
|
384
|
+
dataset_item_update_params.DatasetItemUpdateParams,
|
|
385
|
+
),
|
|
364
386
|
options=make_request_options(
|
|
365
387
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
366
388
|
),
|
|
@@ -465,6 +487,7 @@ class AsyncDatasetItemsResource(AsyncAPIResource):
|
|
|
465
487
|
*,
|
|
466
488
|
data: Iterable[Dict[str, object]],
|
|
467
489
|
dataset_id: str,
|
|
490
|
+
files: Iterable[Dict[str, str]] | Omit = omit,
|
|
468
491
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
469
492
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
470
493
|
extra_headers: Headers | None = None,
|
|
@@ -480,6 +503,8 @@ class AsyncDatasetItemsResource(AsyncAPIResource):
|
|
|
480
503
|
|
|
481
504
|
dataset_id: Identifier of the target dataset
|
|
482
505
|
|
|
506
|
+
files: Files to be associated to the dataset
|
|
507
|
+
|
|
483
508
|
extra_headers: Send extra headers
|
|
484
509
|
|
|
485
510
|
extra_query: Add additional query parameters to the request
|
|
@@ -494,6 +519,7 @@ class AsyncDatasetItemsResource(AsyncAPIResource):
|
|
|
494
519
|
{
|
|
495
520
|
"data": data,
|
|
496
521
|
"dataset_id": dataset_id,
|
|
522
|
+
"files": files,
|
|
497
523
|
},
|
|
498
524
|
dataset_item_batch_create_params.DatasetItemBatchCreateParams,
|
|
499
525
|
),
|
|
@@ -52,6 +52,7 @@ class DatasetsResource(SyncAPIResource):
|
|
|
52
52
|
data: Iterable[Dict[str, object]],
|
|
53
53
|
name: str,
|
|
54
54
|
description: str | Omit = omit,
|
|
55
|
+
files: Iterable[Dict[str, str]] | Omit = omit,
|
|
55
56
|
tags: SequenceNotStr[str] | Omit = omit,
|
|
56
57
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
57
58
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
@@ -66,6 +67,8 @@ class DatasetsResource(SyncAPIResource):
|
|
|
66
67
|
Args:
|
|
67
68
|
data: Items to be included in the dataset
|
|
68
69
|
|
|
70
|
+
files: Files to be associated to the dataset
|
|
71
|
+
|
|
69
72
|
tags: The tags associated with the entity
|
|
70
73
|
|
|
71
74
|
extra_headers: Send extra headers
|
|
@@ -83,6 +86,7 @@ class DatasetsResource(SyncAPIResource):
|
|
|
83
86
|
"data": data,
|
|
84
87
|
"name": name,
|
|
85
88
|
"description": description,
|
|
89
|
+
"files": files,
|
|
86
90
|
"tags": tags,
|
|
87
91
|
},
|
|
88
92
|
dataset_create_params.DatasetCreateParams,
|
|
@@ -340,6 +344,7 @@ class AsyncDatasetsResource(AsyncAPIResource):
|
|
|
340
344
|
data: Iterable[Dict[str, object]],
|
|
341
345
|
name: str,
|
|
342
346
|
description: str | Omit = omit,
|
|
347
|
+
files: Iterable[Dict[str, str]] | Omit = omit,
|
|
343
348
|
tags: SequenceNotStr[str] | Omit = omit,
|
|
344
349
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
345
350
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
@@ -354,6 +359,8 @@ class AsyncDatasetsResource(AsyncAPIResource):
|
|
|
354
359
|
Args:
|
|
355
360
|
data: Items to be included in the dataset
|
|
356
361
|
|
|
362
|
+
files: Files to be associated to the dataset
|
|
363
|
+
|
|
357
364
|
tags: The tags associated with the entity
|
|
358
365
|
|
|
359
366
|
extra_headers: Send extra headers
|
|
@@ -371,6 +378,7 @@ class AsyncDatasetsResource(AsyncAPIResource):
|
|
|
371
378
|
"data": data,
|
|
372
379
|
"name": name,
|
|
373
380
|
"description": description,
|
|
381
|
+
"files": files,
|
|
374
382
|
"tags": tags,
|
|
375
383
|
},
|
|
376
384
|
dataset_create_params.DatasetCreateParams,
|
|
@@ -58,6 +58,7 @@ class EvaluationsResource(SyncAPIResource):
|
|
|
58
58
|
data: Iterable[Dict[str, object]],
|
|
59
59
|
name: str,
|
|
60
60
|
description: str | Omit = omit,
|
|
61
|
+
files: Iterable[Dict[str, str]] | Omit = omit,
|
|
61
62
|
metadata: Dict[str, object] | Omit = omit,
|
|
62
63
|
tags: SequenceNotStr[str] | Omit = omit,
|
|
63
64
|
tasks: Iterable[EvaluationTaskParam] | Omit = omit,
|
|
@@ -74,6 +75,8 @@ class EvaluationsResource(SyncAPIResource):
|
|
|
74
75
|
Args:
|
|
75
76
|
data: Items to be evaluated
|
|
76
77
|
|
|
78
|
+
files: Files to be associated to the evaluation
|
|
79
|
+
|
|
77
80
|
metadata: Optional metadata key-value pairs for the evaluation
|
|
78
81
|
|
|
79
82
|
tags: The tags associated with the entity
|
|
@@ -140,6 +143,7 @@ class EvaluationsResource(SyncAPIResource):
|
|
|
140
143
|
dataset: evaluation_create_params.EvaluationWithDatasetCreateRequestDataset,
|
|
141
144
|
name: str,
|
|
142
145
|
description: str | Omit = omit,
|
|
146
|
+
files: Iterable[Dict[str, str]] | Omit = omit,
|
|
143
147
|
metadata: Dict[str, object] | Omit = omit,
|
|
144
148
|
tags: SequenceNotStr[str] | Omit = omit,
|
|
145
149
|
tasks: Iterable[EvaluationTaskParam] | Omit = omit,
|
|
@@ -158,6 +162,8 @@ class EvaluationsResource(SyncAPIResource):
|
|
|
158
162
|
|
|
159
163
|
dataset: Create a reusable dataset from items in the `data` field
|
|
160
164
|
|
|
165
|
+
files: Files to be associated to the evaluation
|
|
166
|
+
|
|
161
167
|
metadata: Optional metadata key-value pairs for the evaluation
|
|
162
168
|
|
|
163
169
|
tags: The tags associated with the entity
|
|
@@ -183,6 +189,7 @@ class EvaluationsResource(SyncAPIResource):
|
|
|
183
189
|
| Omit = omit,
|
|
184
190
|
name: str,
|
|
185
191
|
description: str | Omit = omit,
|
|
192
|
+
files: Iterable[Dict[str, str]] | Omit = omit,
|
|
186
193
|
metadata: Dict[str, object] | Omit = omit,
|
|
187
194
|
tags: SequenceNotStr[str] | Omit = omit,
|
|
188
195
|
tasks: Iterable[EvaluationTaskParam] | Omit = omit,
|
|
@@ -202,6 +209,7 @@ class EvaluationsResource(SyncAPIResource):
|
|
|
202
209
|
"data": data,
|
|
203
210
|
"name": name,
|
|
204
211
|
"description": description,
|
|
212
|
+
"files": files,
|
|
205
213
|
"metadata": metadata,
|
|
206
214
|
"tags": tags,
|
|
207
215
|
"tasks": tasks,
|
|
@@ -471,6 +479,7 @@ class AsyncEvaluationsResource(AsyncAPIResource):
|
|
|
471
479
|
data: Iterable[Dict[str, object]],
|
|
472
480
|
name: str,
|
|
473
481
|
description: str | Omit = omit,
|
|
482
|
+
files: Iterable[Dict[str, str]] | Omit = omit,
|
|
474
483
|
metadata: Dict[str, object] | Omit = omit,
|
|
475
484
|
tags: SequenceNotStr[str] | Omit = omit,
|
|
476
485
|
tasks: Iterable[EvaluationTaskParam] | Omit = omit,
|
|
@@ -487,6 +496,8 @@ class AsyncEvaluationsResource(AsyncAPIResource):
|
|
|
487
496
|
Args:
|
|
488
497
|
data: Items to be evaluated
|
|
489
498
|
|
|
499
|
+
files: Files to be associated to the evaluation
|
|
500
|
+
|
|
490
501
|
metadata: Optional metadata key-value pairs for the evaluation
|
|
491
502
|
|
|
492
503
|
tags: The tags associated with the entity
|
|
@@ -553,6 +564,7 @@ class AsyncEvaluationsResource(AsyncAPIResource):
|
|
|
553
564
|
dataset: evaluation_create_params.EvaluationWithDatasetCreateRequestDataset,
|
|
554
565
|
name: str,
|
|
555
566
|
description: str | Omit = omit,
|
|
567
|
+
files: Iterable[Dict[str, str]] | Omit = omit,
|
|
556
568
|
metadata: Dict[str, object] | Omit = omit,
|
|
557
569
|
tags: SequenceNotStr[str] | Omit = omit,
|
|
558
570
|
tasks: Iterable[EvaluationTaskParam] | Omit = omit,
|
|
@@ -571,6 +583,8 @@ class AsyncEvaluationsResource(AsyncAPIResource):
|
|
|
571
583
|
|
|
572
584
|
dataset: Create a reusable dataset from items in the `data` field
|
|
573
585
|
|
|
586
|
+
files: Files to be associated to the evaluation
|
|
587
|
+
|
|
574
588
|
metadata: Optional metadata key-value pairs for the evaluation
|
|
575
589
|
|
|
576
590
|
tags: The tags associated with the entity
|
|
@@ -596,6 +610,7 @@ class AsyncEvaluationsResource(AsyncAPIResource):
|
|
|
596
610
|
| Omit = omit,
|
|
597
611
|
name: str,
|
|
598
612
|
description: str | Omit = omit,
|
|
613
|
+
files: Iterable[Dict[str, str]] | Omit = omit,
|
|
599
614
|
metadata: Dict[str, object] | Omit = omit,
|
|
600
615
|
tags: SequenceNotStr[str] | Omit = omit,
|
|
601
616
|
tasks: Iterable[EvaluationTaskParam] | Omit = omit,
|
|
@@ -615,6 +630,7 @@ class AsyncEvaluationsResource(AsyncAPIResource):
|
|
|
615
630
|
"data": data,
|
|
616
631
|
"name": name,
|
|
617
632
|
"description": description,
|
|
633
|
+
"files": files,
|
|
618
634
|
"metadata": metadata,
|
|
619
635
|
"tags": tags,
|
|
620
636
|
"tasks": tasks,
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing import Dict, Mapping, cast
|
|
5
|
+
from typing import Dict, Mapping, Iterable, cast
|
|
6
6
|
from typing_extensions import Literal
|
|
7
7
|
|
|
8
8
|
import httpx
|
|
9
9
|
|
|
10
|
-
from ...types import file_list_params, file_create_params, file_update_params
|
|
10
|
+
from ...types import file_list_params, file_create_params, file_update_params, file_import_from_cloud_params
|
|
11
11
|
from .content import (
|
|
12
12
|
ContentResource,
|
|
13
13
|
AsyncContentResource,
|
|
@@ -30,6 +30,7 @@ from ...pagination import SyncCursorPage, AsyncCursorPage
|
|
|
30
30
|
from ...types.file import File
|
|
31
31
|
from ..._base_client import AsyncPaginator, make_request_options
|
|
32
32
|
from ...types.file_delete_response import FileDeleteResponse
|
|
33
|
+
from ...types.file_import_from_cloud_response import FileImportFromCloudResponse
|
|
33
34
|
|
|
34
35
|
__all__ = ["FilesResource", "AsyncFilesResource"]
|
|
35
36
|
|
|
@@ -249,6 +250,40 @@ class FilesResource(SyncAPIResource):
|
|
|
249
250
|
cast_to=FileDeleteResponse,
|
|
250
251
|
)
|
|
251
252
|
|
|
253
|
+
def import_from_cloud(
|
|
254
|
+
self,
|
|
255
|
+
*,
|
|
256
|
+
files: Iterable[file_import_from_cloud_params.File],
|
|
257
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
258
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
259
|
+
extra_headers: Headers | None = None,
|
|
260
|
+
extra_query: Query | None = None,
|
|
261
|
+
extra_body: Body | None = None,
|
|
262
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
263
|
+
) -> FileImportFromCloudResponse:
|
|
264
|
+
"""
|
|
265
|
+
Import files from existing blob storage in cloud (batch operation)
|
|
266
|
+
|
|
267
|
+
Args:
|
|
268
|
+
files: List of files to import from cloud storage
|
|
269
|
+
|
|
270
|
+
extra_headers: Send extra headers
|
|
271
|
+
|
|
272
|
+
extra_query: Add additional query parameters to the request
|
|
273
|
+
|
|
274
|
+
extra_body: Add additional JSON properties to the request
|
|
275
|
+
|
|
276
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
277
|
+
"""
|
|
278
|
+
return self._post(
|
|
279
|
+
"/v5/files/cloud_imports",
|
|
280
|
+
body=maybe_transform({"files": files}, file_import_from_cloud_params.FileImportFromCloudParams),
|
|
281
|
+
options=make_request_options(
|
|
282
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
283
|
+
),
|
|
284
|
+
cast_to=FileImportFromCloudResponse,
|
|
285
|
+
)
|
|
286
|
+
|
|
252
287
|
|
|
253
288
|
class AsyncFilesResource(AsyncAPIResource):
|
|
254
289
|
@cached_property
|
|
@@ -465,6 +500,40 @@ class AsyncFilesResource(AsyncAPIResource):
|
|
|
465
500
|
cast_to=FileDeleteResponse,
|
|
466
501
|
)
|
|
467
502
|
|
|
503
|
+
async def import_from_cloud(
|
|
504
|
+
self,
|
|
505
|
+
*,
|
|
506
|
+
files: Iterable[file_import_from_cloud_params.File],
|
|
507
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
508
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
509
|
+
extra_headers: Headers | None = None,
|
|
510
|
+
extra_query: Query | None = None,
|
|
511
|
+
extra_body: Body | None = None,
|
|
512
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
513
|
+
) -> FileImportFromCloudResponse:
|
|
514
|
+
"""
|
|
515
|
+
Import files from existing blob storage in cloud (batch operation)
|
|
516
|
+
|
|
517
|
+
Args:
|
|
518
|
+
files: List of files to import from cloud storage
|
|
519
|
+
|
|
520
|
+
extra_headers: Send extra headers
|
|
521
|
+
|
|
522
|
+
extra_query: Add additional query parameters to the request
|
|
523
|
+
|
|
524
|
+
extra_body: Add additional JSON properties to the request
|
|
525
|
+
|
|
526
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
527
|
+
"""
|
|
528
|
+
return await self._post(
|
|
529
|
+
"/v5/files/cloud_imports",
|
|
530
|
+
body=await async_maybe_transform({"files": files}, file_import_from_cloud_params.FileImportFromCloudParams),
|
|
531
|
+
options=make_request_options(
|
|
532
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
533
|
+
),
|
|
534
|
+
cast_to=FileImportFromCloudResponse,
|
|
535
|
+
)
|
|
536
|
+
|
|
468
537
|
|
|
469
538
|
class FilesResourceWithRawResponse:
|
|
470
539
|
def __init__(self, files: FilesResource) -> None:
|
|
@@ -485,6 +554,9 @@ class FilesResourceWithRawResponse:
|
|
|
485
554
|
self.delete = to_raw_response_wrapper(
|
|
486
555
|
files.delete,
|
|
487
556
|
)
|
|
557
|
+
self.import_from_cloud = to_raw_response_wrapper(
|
|
558
|
+
files.import_from_cloud,
|
|
559
|
+
)
|
|
488
560
|
|
|
489
561
|
@cached_property
|
|
490
562
|
def content(self) -> ContentResourceWithRawResponse:
|
|
@@ -510,6 +582,9 @@ class AsyncFilesResourceWithRawResponse:
|
|
|
510
582
|
self.delete = async_to_raw_response_wrapper(
|
|
511
583
|
files.delete,
|
|
512
584
|
)
|
|
585
|
+
self.import_from_cloud = async_to_raw_response_wrapper(
|
|
586
|
+
files.import_from_cloud,
|
|
587
|
+
)
|
|
513
588
|
|
|
514
589
|
@cached_property
|
|
515
590
|
def content(self) -> AsyncContentResourceWithRawResponse:
|
|
@@ -535,6 +610,9 @@ class FilesResourceWithStreamingResponse:
|
|
|
535
610
|
self.delete = to_streamed_response_wrapper(
|
|
536
611
|
files.delete,
|
|
537
612
|
)
|
|
613
|
+
self.import_from_cloud = to_streamed_response_wrapper(
|
|
614
|
+
files.import_from_cloud,
|
|
615
|
+
)
|
|
538
616
|
|
|
539
617
|
@cached_property
|
|
540
618
|
def content(self) -> ContentResourceWithStreamingResponse:
|
|
@@ -560,6 +638,9 @@ class AsyncFilesResourceWithStreamingResponse:
|
|
|
560
638
|
self.delete = async_to_streamed_response_wrapper(
|
|
561
639
|
files.delete,
|
|
562
640
|
)
|
|
641
|
+
self.import_from_cloud = async_to_streamed_response_wrapper(
|
|
642
|
+
files.import_from_cloud,
|
|
643
|
+
)
|
|
563
644
|
|
|
564
645
|
@cached_property
|
|
565
646
|
def content(self) -> AsyncContentResourceWithStreamingResponse:
|