scale-gp-beta 0.1.0a35__py3-none-any.whl → 0.1.0a37__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 +8 -3
- scale_gp_beta/_streaming.py +4 -6
- 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 +107 -3
- scale_gp_beta/resources/evaluations.py +16 -0
- scale_gp_beta/resources/questions.py +107 -1
- scale_gp_beta/types/dataset_create_params.py +3 -0
- scale_gp_beta/types/dataset_item.py +3 -1
- 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/dataset_update_params.py +12 -3
- scale_gp_beta/types/evaluation.py +40 -1
- scale_gp_beta/types/evaluation_create_params.py +6 -0
- scale_gp_beta/types/evaluation_item.py +2 -0
- scale_gp_beta/types/evaluation_task.py +3 -0
- scale_gp_beta/types/evaluation_task_param.py +3 -0
- scale_gp_beta/types/file.py +2 -0
- scale_gp_beta/types/question.py +54 -1
- scale_gp_beta/types/question_create_params.py +44 -1
- {scale_gp_beta-0.1.0a35.dist-info → scale_gp_beta-0.1.0a37.dist-info}/METADATA +5 -6
- {scale_gp_beta-0.1.0a35.dist-info → scale_gp_beta-0.1.0a37.dist-info}/RECORD +26 -26
- {scale_gp_beta-0.1.0a35.dist-info → scale_gp_beta-0.1.0a37.dist-info}/WHEEL +0 -0
- {scale_gp_beta-0.1.0a35.dist-info → scale_gp_beta-0.1.0a37.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 (
|
|
@@ -573,6 +574,9 @@ class CachedDiscriminatorType(Protocol):
|
|
|
573
574
|
__discriminator__: DiscriminatorDetails
|
|
574
575
|
|
|
575
576
|
|
|
577
|
+
DISCRIMINATOR_CACHE: weakref.WeakKeyDictionary[type, DiscriminatorDetails] = weakref.WeakKeyDictionary()
|
|
578
|
+
|
|
579
|
+
|
|
576
580
|
class DiscriminatorDetails:
|
|
577
581
|
field_name: str
|
|
578
582
|
"""The name of the discriminator field in the variant class, e.g.
|
|
@@ -615,8 +619,9 @@ class DiscriminatorDetails:
|
|
|
615
619
|
|
|
616
620
|
|
|
617
621
|
def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any, ...]) -> DiscriminatorDetails | None:
|
|
618
|
-
|
|
619
|
-
|
|
622
|
+
cached = DISCRIMINATOR_CACHE.get(union)
|
|
623
|
+
if cached is not None:
|
|
624
|
+
return cached
|
|
620
625
|
|
|
621
626
|
discriminator_field_name: str | None = None
|
|
622
627
|
|
|
@@ -669,7 +674,7 @@ def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any,
|
|
|
669
674
|
discriminator_field=discriminator_field_name,
|
|
670
675
|
discriminator_alias=discriminator_alias,
|
|
671
676
|
)
|
|
672
|
-
|
|
677
|
+
DISCRIMINATOR_CACHE.setdefault(union, details)
|
|
673
678
|
return details
|
|
674
679
|
|
|
675
680
|
|
scale_gp_beta/_streaming.py
CHANGED
|
@@ -57,9 +57,8 @@ class Stream(Generic[_T]):
|
|
|
57
57
|
for sse in iterator:
|
|
58
58
|
yield process_data(data=sse.json(), cast_to=cast_to, response=response)
|
|
59
59
|
|
|
60
|
-
#
|
|
61
|
-
|
|
62
|
-
...
|
|
60
|
+
# As we might not fully consume the response stream, we need to close it explicitly
|
|
61
|
+
response.close()
|
|
63
62
|
|
|
64
63
|
def __enter__(self) -> Self:
|
|
65
64
|
return self
|
|
@@ -121,9 +120,8 @@ class AsyncStream(Generic[_T]):
|
|
|
121
120
|
async for sse in iterator:
|
|
122
121
|
yield process_data(data=sse.json(), cast_to=cast_to, response=response)
|
|
123
122
|
|
|
124
|
-
#
|
|
125
|
-
|
|
126
|
-
...
|
|
123
|
+
# As we might not fully consume the response stream, we need to close it explicitly
|
|
124
|
+
await response.aclose()
|
|
127
125
|
|
|
128
126
|
async def __aenter__(self) -> Self:
|
|
129
127
|
return self
|
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
|
),
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
from typing import Dict, Iterable
|
|
6
|
-
from typing_extensions import Literal
|
|
6
|
+
from typing_extensions import Literal, overload
|
|
7
7
|
|
|
8
8
|
import httpx
|
|
9
9
|
|
|
@@ -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,
|
|
@@ -133,6 +137,7 @@ class DatasetsResource(SyncAPIResource):
|
|
|
133
137
|
cast_to=Dataset,
|
|
134
138
|
)
|
|
135
139
|
|
|
140
|
+
@overload
|
|
136
141
|
def update(
|
|
137
142
|
self,
|
|
138
143
|
dataset_id: str,
|
|
@@ -148,7 +153,7 @@ class DatasetsResource(SyncAPIResource):
|
|
|
148
153
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
149
154
|
) -> Dataset:
|
|
150
155
|
"""
|
|
151
|
-
Update Dataset
|
|
156
|
+
Update or Restore Dataset
|
|
152
157
|
|
|
153
158
|
Args:
|
|
154
159
|
tags: The tags associated with the entity
|
|
@@ -161,6 +166,52 @@ class DatasetsResource(SyncAPIResource):
|
|
|
161
166
|
|
|
162
167
|
timeout: Override the client-level default timeout for this request, in seconds
|
|
163
168
|
"""
|
|
169
|
+
...
|
|
170
|
+
|
|
171
|
+
@overload
|
|
172
|
+
def update(
|
|
173
|
+
self,
|
|
174
|
+
dataset_id: str,
|
|
175
|
+
*,
|
|
176
|
+
restore: Literal[True],
|
|
177
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
178
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
179
|
+
extra_headers: Headers | None = None,
|
|
180
|
+
extra_query: Query | None = None,
|
|
181
|
+
extra_body: Body | None = None,
|
|
182
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
183
|
+
) -> Dataset:
|
|
184
|
+
"""
|
|
185
|
+
Update or Restore Dataset
|
|
186
|
+
|
|
187
|
+
Args:
|
|
188
|
+
restore: Set to true to restore the entity from the database.
|
|
189
|
+
|
|
190
|
+
extra_headers: Send extra headers
|
|
191
|
+
|
|
192
|
+
extra_query: Add additional query parameters to the request
|
|
193
|
+
|
|
194
|
+
extra_body: Add additional JSON properties to the request
|
|
195
|
+
|
|
196
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
197
|
+
"""
|
|
198
|
+
...
|
|
199
|
+
|
|
200
|
+
def update(
|
|
201
|
+
self,
|
|
202
|
+
dataset_id: str,
|
|
203
|
+
*,
|
|
204
|
+
description: str | Omit = omit,
|
|
205
|
+
name: str | Omit = omit,
|
|
206
|
+
tags: SequenceNotStr[str] | Omit = omit,
|
|
207
|
+
restore: Literal[True] | Omit = omit,
|
|
208
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
209
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
210
|
+
extra_headers: Headers | None = None,
|
|
211
|
+
extra_query: Query | None = None,
|
|
212
|
+
extra_body: Body | None = None,
|
|
213
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
214
|
+
) -> Dataset:
|
|
164
215
|
if not dataset_id:
|
|
165
216
|
raise ValueError(f"Expected a non-empty value for `dataset_id` but received {dataset_id!r}")
|
|
166
217
|
return self._patch(
|
|
@@ -170,6 +221,7 @@ class DatasetsResource(SyncAPIResource):
|
|
|
170
221
|
"description": description,
|
|
171
222
|
"name": name,
|
|
172
223
|
"tags": tags,
|
|
224
|
+
"restore": restore,
|
|
173
225
|
},
|
|
174
226
|
dataset_update_params.DatasetUpdateParams,
|
|
175
227
|
),
|
|
@@ -292,6 +344,7 @@ class AsyncDatasetsResource(AsyncAPIResource):
|
|
|
292
344
|
data: Iterable[Dict[str, object]],
|
|
293
345
|
name: str,
|
|
294
346
|
description: str | Omit = omit,
|
|
347
|
+
files: Iterable[Dict[str, str]] | Omit = omit,
|
|
295
348
|
tags: SequenceNotStr[str] | Omit = omit,
|
|
296
349
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
297
350
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
@@ -306,6 +359,8 @@ class AsyncDatasetsResource(AsyncAPIResource):
|
|
|
306
359
|
Args:
|
|
307
360
|
data: Items to be included in the dataset
|
|
308
361
|
|
|
362
|
+
files: Files to be associated to the dataset
|
|
363
|
+
|
|
309
364
|
tags: The tags associated with the entity
|
|
310
365
|
|
|
311
366
|
extra_headers: Send extra headers
|
|
@@ -323,6 +378,7 @@ class AsyncDatasetsResource(AsyncAPIResource):
|
|
|
323
378
|
"data": data,
|
|
324
379
|
"name": name,
|
|
325
380
|
"description": description,
|
|
381
|
+
"files": files,
|
|
326
382
|
"tags": tags,
|
|
327
383
|
},
|
|
328
384
|
dataset_create_params.DatasetCreateParams,
|
|
@@ -373,6 +429,7 @@ class AsyncDatasetsResource(AsyncAPIResource):
|
|
|
373
429
|
cast_to=Dataset,
|
|
374
430
|
)
|
|
375
431
|
|
|
432
|
+
@overload
|
|
376
433
|
async def update(
|
|
377
434
|
self,
|
|
378
435
|
dataset_id: str,
|
|
@@ -388,7 +445,7 @@ class AsyncDatasetsResource(AsyncAPIResource):
|
|
|
388
445
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
389
446
|
) -> Dataset:
|
|
390
447
|
"""
|
|
391
|
-
Update Dataset
|
|
448
|
+
Update or Restore Dataset
|
|
392
449
|
|
|
393
450
|
Args:
|
|
394
451
|
tags: The tags associated with the entity
|
|
@@ -401,6 +458,52 @@ class AsyncDatasetsResource(AsyncAPIResource):
|
|
|
401
458
|
|
|
402
459
|
timeout: Override the client-level default timeout for this request, in seconds
|
|
403
460
|
"""
|
|
461
|
+
...
|
|
462
|
+
|
|
463
|
+
@overload
|
|
464
|
+
async def update(
|
|
465
|
+
self,
|
|
466
|
+
dataset_id: str,
|
|
467
|
+
*,
|
|
468
|
+
restore: Literal[True],
|
|
469
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
470
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
471
|
+
extra_headers: Headers | None = None,
|
|
472
|
+
extra_query: Query | None = None,
|
|
473
|
+
extra_body: Body | None = None,
|
|
474
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
475
|
+
) -> Dataset:
|
|
476
|
+
"""
|
|
477
|
+
Update or Restore Dataset
|
|
478
|
+
|
|
479
|
+
Args:
|
|
480
|
+
restore: Set to true to restore the entity from the database.
|
|
481
|
+
|
|
482
|
+
extra_headers: Send extra headers
|
|
483
|
+
|
|
484
|
+
extra_query: Add additional query parameters to the request
|
|
485
|
+
|
|
486
|
+
extra_body: Add additional JSON properties to the request
|
|
487
|
+
|
|
488
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
489
|
+
"""
|
|
490
|
+
...
|
|
491
|
+
|
|
492
|
+
async def update(
|
|
493
|
+
self,
|
|
494
|
+
dataset_id: str,
|
|
495
|
+
*,
|
|
496
|
+
description: str | Omit = omit,
|
|
497
|
+
name: str | Omit = omit,
|
|
498
|
+
tags: SequenceNotStr[str] | Omit = omit,
|
|
499
|
+
restore: Literal[True] | Omit = omit,
|
|
500
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
501
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
502
|
+
extra_headers: Headers | None = None,
|
|
503
|
+
extra_query: Query | None = None,
|
|
504
|
+
extra_body: Body | None = None,
|
|
505
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
506
|
+
) -> Dataset:
|
|
404
507
|
if not dataset_id:
|
|
405
508
|
raise ValueError(f"Expected a non-empty value for `dataset_id` but received {dataset_id!r}")
|
|
406
509
|
return await self._patch(
|
|
@@ -410,6 +513,7 @@ class AsyncDatasetsResource(AsyncAPIResource):
|
|
|
410
513
|
"description": description,
|
|
411
514
|
"name": name,
|
|
412
515
|
"tags": tags,
|
|
516
|
+
"restore": restore,
|
|
413
517
|
},
|
|
414
518
|
dataset_update_params.DatasetUpdateParams,
|
|
415
519
|
),
|
|
@@ -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,
|