scale-gp-beta 0.1.0a9__py3-none-any.whl → 0.1.0a11__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/_base_client.py +207 -233
- scale_gp_beta/_client.py +10 -5
- scale_gp_beta/_models.py +2 -3
- scale_gp_beta/_response.py +1 -1
- scale_gp_beta/_utils/_transform.py +46 -1
- scale_gp_beta/_utils/_typing.py +3 -1
- scale_gp_beta/_utils/_utils.py +9 -1
- scale_gp_beta/_version.py +1 -1
- scale_gp_beta/resources/__init__.py +14 -0
- scale_gp_beta/resources/chat/completions.py +7 -7
- scale_gp_beta/resources/completions.py +7 -7
- scale_gp_beta/resources/dataset_items.py +1 -4
- scale_gp_beta/resources/datasets.py +19 -11
- scale_gp_beta/resources/evaluation_items.py +1 -4
- scale_gp_beta/resources/evaluations.py +23 -5
- scale_gp_beta/resources/files/files.py +1 -6
- scale_gp_beta/resources/inference.py +1 -4
- scale_gp_beta/resources/models.py +1 -5
- scale_gp_beta/resources/spans.py +658 -0
- scale_gp_beta/types/__init__.py +4 -0
- scale_gp_beta/types/dataset.py +4 -1
- scale_gp_beta/types/dataset_create_params.py +4 -1
- scale_gp_beta/types/dataset_update_params.py +4 -0
- scale_gp_beta/types/evaluation.py +3 -0
- scale_gp_beta/types/evaluation_create_params.py +12 -0
- scale_gp_beta/types/span.py +38 -0
- scale_gp_beta/types/span_create_params.py +58 -0
- scale_gp_beta/types/span_list_params.py +26 -0
- scale_gp_beta/types/span_update_params.py +21 -0
- {scale_gp_beta-0.1.0a9.dist-info → scale_gp_beta-0.1.0a11.dist-info}/METADATA +8 -8
- {scale_gp_beta-0.1.0a9.dist-info → scale_gp_beta-0.1.0a11.dist-info}/RECORD +33 -28
- {scale_gp_beta-0.1.0a9.dist-info → scale_gp_beta-0.1.0a11.dist-info}/WHEEL +0 -0
- {scale_gp_beta-0.1.0a9.dist-info → scale_gp_beta-0.1.0a11.dist-info}/licenses/LICENSE +0 -0
scale_gp_beta/_client.py
CHANGED
|
@@ -19,12 +19,9 @@ from ._types import (
|
|
|
19
19
|
ProxiesTypes,
|
|
20
20
|
RequestOptions,
|
|
21
21
|
)
|
|
22
|
-
from ._utils import
|
|
23
|
-
is_given,
|
|
24
|
-
get_async_library,
|
|
25
|
-
)
|
|
22
|
+
from ._utils import is_given, get_async_library
|
|
26
23
|
from ._version import __version__
|
|
27
|
-
from .resources import models, datasets, inference, completions, evaluations, dataset_items, evaluation_items
|
|
24
|
+
from .resources import spans, models, datasets, inference, completions, evaluations, dataset_items, evaluation_items
|
|
28
25
|
from ._streaming import Stream as Stream, AsyncStream as AsyncStream
|
|
29
26
|
from ._exceptions import APIStatusError, SGPClientError
|
|
30
27
|
from ._base_client import (
|
|
@@ -63,6 +60,7 @@ class SGPClient(SyncAPIClient):
|
|
|
63
60
|
evaluations: evaluations.EvaluationsResource
|
|
64
61
|
dataset_items: dataset_items.DatasetItemsResource
|
|
65
62
|
evaluation_items: evaluation_items.EvaluationItemsResource
|
|
63
|
+
spans: spans.SpansResource
|
|
66
64
|
with_raw_response: SGPClientWithRawResponse
|
|
67
65
|
with_streaming_response: SGPClientWithStreamedResponse
|
|
68
66
|
|
|
@@ -165,6 +163,7 @@ class SGPClient(SyncAPIClient):
|
|
|
165
163
|
self.evaluations = evaluations.EvaluationsResource(self)
|
|
166
164
|
self.dataset_items = dataset_items.DatasetItemsResource(self)
|
|
167
165
|
self.evaluation_items = evaluation_items.EvaluationItemsResource(self)
|
|
166
|
+
self.spans = spans.SpansResource(self)
|
|
168
167
|
self.with_raw_response = SGPClientWithRawResponse(self)
|
|
169
168
|
self.with_streaming_response = SGPClientWithStreamedResponse(self)
|
|
170
169
|
|
|
@@ -288,6 +287,7 @@ class AsyncSGPClient(AsyncAPIClient):
|
|
|
288
287
|
evaluations: evaluations.AsyncEvaluationsResource
|
|
289
288
|
dataset_items: dataset_items.AsyncDatasetItemsResource
|
|
290
289
|
evaluation_items: evaluation_items.AsyncEvaluationItemsResource
|
|
290
|
+
spans: spans.AsyncSpansResource
|
|
291
291
|
with_raw_response: AsyncSGPClientWithRawResponse
|
|
292
292
|
with_streaming_response: AsyncSGPClientWithStreamedResponse
|
|
293
293
|
|
|
@@ -390,6 +390,7 @@ class AsyncSGPClient(AsyncAPIClient):
|
|
|
390
390
|
self.evaluations = evaluations.AsyncEvaluationsResource(self)
|
|
391
391
|
self.dataset_items = dataset_items.AsyncDatasetItemsResource(self)
|
|
392
392
|
self.evaluation_items = evaluation_items.AsyncEvaluationItemsResource(self)
|
|
393
|
+
self.spans = spans.AsyncSpansResource(self)
|
|
393
394
|
self.with_raw_response = AsyncSGPClientWithRawResponse(self)
|
|
394
395
|
self.with_streaming_response = AsyncSGPClientWithStreamedResponse(self)
|
|
395
396
|
|
|
@@ -514,6 +515,7 @@ class SGPClientWithRawResponse:
|
|
|
514
515
|
self.evaluations = evaluations.EvaluationsResourceWithRawResponse(client.evaluations)
|
|
515
516
|
self.dataset_items = dataset_items.DatasetItemsResourceWithRawResponse(client.dataset_items)
|
|
516
517
|
self.evaluation_items = evaluation_items.EvaluationItemsResourceWithRawResponse(client.evaluation_items)
|
|
518
|
+
self.spans = spans.SpansResourceWithRawResponse(client.spans)
|
|
517
519
|
|
|
518
520
|
|
|
519
521
|
class AsyncSGPClientWithRawResponse:
|
|
@@ -527,6 +529,7 @@ class AsyncSGPClientWithRawResponse:
|
|
|
527
529
|
self.evaluations = evaluations.AsyncEvaluationsResourceWithRawResponse(client.evaluations)
|
|
528
530
|
self.dataset_items = dataset_items.AsyncDatasetItemsResourceWithRawResponse(client.dataset_items)
|
|
529
531
|
self.evaluation_items = evaluation_items.AsyncEvaluationItemsResourceWithRawResponse(client.evaluation_items)
|
|
532
|
+
self.spans = spans.AsyncSpansResourceWithRawResponse(client.spans)
|
|
530
533
|
|
|
531
534
|
|
|
532
535
|
class SGPClientWithStreamedResponse:
|
|
@@ -540,6 +543,7 @@ class SGPClientWithStreamedResponse:
|
|
|
540
543
|
self.evaluations = evaluations.EvaluationsResourceWithStreamingResponse(client.evaluations)
|
|
541
544
|
self.dataset_items = dataset_items.DatasetItemsResourceWithStreamingResponse(client.dataset_items)
|
|
542
545
|
self.evaluation_items = evaluation_items.EvaluationItemsResourceWithStreamingResponse(client.evaluation_items)
|
|
546
|
+
self.spans = spans.SpansResourceWithStreamingResponse(client.spans)
|
|
543
547
|
|
|
544
548
|
|
|
545
549
|
class AsyncSGPClientWithStreamedResponse:
|
|
@@ -555,6 +559,7 @@ class AsyncSGPClientWithStreamedResponse:
|
|
|
555
559
|
self.evaluation_items = evaluation_items.AsyncEvaluationItemsResourceWithStreamingResponse(
|
|
556
560
|
client.evaluation_items
|
|
557
561
|
)
|
|
562
|
+
self.spans = spans.AsyncSpansResourceWithStreamingResponse(client.spans)
|
|
558
563
|
|
|
559
564
|
|
|
560
565
|
Client = SGPClient
|
scale_gp_beta/_models.py
CHANGED
|
@@ -19,7 +19,6 @@ from typing_extensions import (
|
|
|
19
19
|
)
|
|
20
20
|
|
|
21
21
|
import pydantic
|
|
22
|
-
import pydantic.generics
|
|
23
22
|
from pydantic.fields import FieldInfo
|
|
24
23
|
|
|
25
24
|
from ._types import (
|
|
@@ -627,8 +626,8 @@ def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any,
|
|
|
627
626
|
# Note: if one variant defines an alias then they all should
|
|
628
627
|
discriminator_alias = field_info.alias
|
|
629
628
|
|
|
630
|
-
if field_info
|
|
631
|
-
for entry in get_args(
|
|
629
|
+
if (annotation := getattr(field_info, "annotation", None)) and is_literal_type(annotation):
|
|
630
|
+
for entry in get_args(annotation):
|
|
632
631
|
if isinstance(entry, str):
|
|
633
632
|
mapping[entry] = variant
|
|
634
633
|
|
scale_gp_beta/_response.py
CHANGED
|
@@ -235,7 +235,7 @@ class BaseAPIResponse(Generic[R]):
|
|
|
235
235
|
# split is required to handle cases where additional information is included
|
|
236
236
|
# in the response, e.g. application/json; charset=utf-8
|
|
237
237
|
content_type, *_ = response.headers.get("content-type", "*").split(";")
|
|
238
|
-
if content_type
|
|
238
|
+
if not content_type.endswith("json"):
|
|
239
239
|
if is_basemodel(cast_to):
|
|
240
240
|
try:
|
|
241
241
|
data = response.json()
|
|
@@ -5,13 +5,15 @@ import base64
|
|
|
5
5
|
import pathlib
|
|
6
6
|
from typing import Any, Mapping, TypeVar, cast
|
|
7
7
|
from datetime import date, datetime
|
|
8
|
-
from typing_extensions import Literal, get_args, override, get_type_hints
|
|
8
|
+
from typing_extensions import Literal, get_args, override, get_type_hints as _get_type_hints
|
|
9
9
|
|
|
10
10
|
import anyio
|
|
11
11
|
import pydantic
|
|
12
12
|
|
|
13
13
|
from ._utils import (
|
|
14
14
|
is_list,
|
|
15
|
+
is_given,
|
|
16
|
+
lru_cache,
|
|
15
17
|
is_mapping,
|
|
16
18
|
is_iterable,
|
|
17
19
|
)
|
|
@@ -108,6 +110,7 @@ def transform(
|
|
|
108
110
|
return cast(_T, transformed)
|
|
109
111
|
|
|
110
112
|
|
|
113
|
+
@lru_cache(maxsize=8096)
|
|
111
114
|
def _get_annotated_type(type_: type) -> type | None:
|
|
112
115
|
"""If the given type is an `Annotated` type then it is returned, if not `None` is returned.
|
|
113
116
|
|
|
@@ -142,6 +145,10 @@ def _maybe_transform_key(key: str, type_: type) -> str:
|
|
|
142
145
|
return key
|
|
143
146
|
|
|
144
147
|
|
|
148
|
+
def _no_transform_needed(annotation: type) -> bool:
|
|
149
|
+
return annotation == float or annotation == int
|
|
150
|
+
|
|
151
|
+
|
|
145
152
|
def _transform_recursive(
|
|
146
153
|
data: object,
|
|
147
154
|
*,
|
|
@@ -184,6 +191,15 @@ def _transform_recursive(
|
|
|
184
191
|
return cast(object, data)
|
|
185
192
|
|
|
186
193
|
inner_type = extract_type_arg(stripped_type, 0)
|
|
194
|
+
if _no_transform_needed(inner_type):
|
|
195
|
+
# for some types there is no need to transform anything, so we can get a small
|
|
196
|
+
# perf boost from skipping that work.
|
|
197
|
+
#
|
|
198
|
+
# but we still need to convert to a list to ensure the data is json-serializable
|
|
199
|
+
if is_list(data):
|
|
200
|
+
return data
|
|
201
|
+
return list(data)
|
|
202
|
+
|
|
187
203
|
return [_transform_recursive(d, annotation=annotation, inner_type=inner_type) for d in data]
|
|
188
204
|
|
|
189
205
|
if is_union_type(stripped_type):
|
|
@@ -245,6 +261,11 @@ def _transform_typeddict(
|
|
|
245
261
|
result: dict[str, object] = {}
|
|
246
262
|
annotations = get_type_hints(expected_type, include_extras=True)
|
|
247
263
|
for key, value in data.items():
|
|
264
|
+
if not is_given(value):
|
|
265
|
+
# we don't need to include `NotGiven` values here as they'll
|
|
266
|
+
# be stripped out before the request is sent anyway
|
|
267
|
+
continue
|
|
268
|
+
|
|
248
269
|
type_ = annotations.get(key)
|
|
249
270
|
if type_ is None:
|
|
250
271
|
# we do not have a type annotation for this field, leave it as is
|
|
@@ -332,6 +353,15 @@ async def _async_transform_recursive(
|
|
|
332
353
|
return cast(object, data)
|
|
333
354
|
|
|
334
355
|
inner_type = extract_type_arg(stripped_type, 0)
|
|
356
|
+
if _no_transform_needed(inner_type):
|
|
357
|
+
# for some types there is no need to transform anything, so we can get a small
|
|
358
|
+
# perf boost from skipping that work.
|
|
359
|
+
#
|
|
360
|
+
# but we still need to convert to a list to ensure the data is json-serializable
|
|
361
|
+
if is_list(data):
|
|
362
|
+
return data
|
|
363
|
+
return list(data)
|
|
364
|
+
|
|
335
365
|
return [await _async_transform_recursive(d, annotation=annotation, inner_type=inner_type) for d in data]
|
|
336
366
|
|
|
337
367
|
if is_union_type(stripped_type):
|
|
@@ -393,6 +423,11 @@ async def _async_transform_typeddict(
|
|
|
393
423
|
result: dict[str, object] = {}
|
|
394
424
|
annotations = get_type_hints(expected_type, include_extras=True)
|
|
395
425
|
for key, value in data.items():
|
|
426
|
+
if not is_given(value):
|
|
427
|
+
# we don't need to include `NotGiven` values here as they'll
|
|
428
|
+
# be stripped out before the request is sent anyway
|
|
429
|
+
continue
|
|
430
|
+
|
|
396
431
|
type_ = annotations.get(key)
|
|
397
432
|
if type_ is None:
|
|
398
433
|
# we do not have a type annotation for this field, leave it as is
|
|
@@ -400,3 +435,13 @@ async def _async_transform_typeddict(
|
|
|
400
435
|
else:
|
|
401
436
|
result[_maybe_transform_key(key, type_)] = await _async_transform_recursive(value, annotation=type_)
|
|
402
437
|
return result
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
@lru_cache(maxsize=8096)
|
|
441
|
+
def get_type_hints(
|
|
442
|
+
obj: Any,
|
|
443
|
+
globalns: dict[str, Any] | None = None,
|
|
444
|
+
localns: Mapping[str, Any] | None = None,
|
|
445
|
+
include_extras: bool = False,
|
|
446
|
+
) -> dict[str, Any]:
|
|
447
|
+
return _get_type_hints(obj, globalns=globalns, localns=localns, include_extras=include_extras)
|
scale_gp_beta/_utils/_typing.py
CHANGED
|
@@ -13,6 +13,7 @@ from typing_extensions import (
|
|
|
13
13
|
get_origin,
|
|
14
14
|
)
|
|
15
15
|
|
|
16
|
+
from ._utils import lru_cache
|
|
16
17
|
from .._types import InheritsGeneric
|
|
17
18
|
from .._compat import is_union as _is_union
|
|
18
19
|
|
|
@@ -66,6 +67,7 @@ def is_type_alias_type(tp: Any, /) -> TypeIs[typing_extensions.TypeAliasType]:
|
|
|
66
67
|
|
|
67
68
|
|
|
68
69
|
# Extracts T from Annotated[T, ...] or from Required[Annotated[T, ...]]
|
|
70
|
+
@lru_cache(maxsize=8096)
|
|
69
71
|
def strip_annotated_type(typ: type) -> type:
|
|
70
72
|
if is_required_type(typ) or is_annotated_type(typ):
|
|
71
73
|
return strip_annotated_type(cast(type, get_args(typ)[0]))
|
|
@@ -108,7 +110,7 @@ def extract_type_var_from_base(
|
|
|
108
110
|
```
|
|
109
111
|
"""
|
|
110
112
|
cls = cast(object, get_origin(typ) or typ)
|
|
111
|
-
if cls in generic_bases:
|
|
113
|
+
if cls in generic_bases: # pyright: ignore[reportUnnecessaryContains]
|
|
112
114
|
# we're given the class directly
|
|
113
115
|
return extract_type_arg(typ, index)
|
|
114
116
|
|
scale_gp_beta/_utils/_utils.py
CHANGED
|
@@ -72,8 +72,16 @@ def _extract_items(
|
|
|
72
72
|
from .._files import assert_is_file_content
|
|
73
73
|
|
|
74
74
|
# We have exhausted the path, return the entry we found.
|
|
75
|
-
assert_is_file_content(obj, key=flattened_key)
|
|
76
75
|
assert flattened_key is not None
|
|
76
|
+
|
|
77
|
+
if is_list(obj):
|
|
78
|
+
files: list[tuple[str, FileTypes]] = []
|
|
79
|
+
for entry in obj:
|
|
80
|
+
assert_is_file_content(entry, key=flattened_key + "[]" if flattened_key else "")
|
|
81
|
+
files.append((flattened_key + "[]", cast(FileTypes, entry)))
|
|
82
|
+
return files
|
|
83
|
+
|
|
84
|
+
assert_is_file_content(obj, key=flattened_key)
|
|
77
85
|
return [(flattened_key, cast(FileTypes, obj))]
|
|
78
86
|
|
|
79
87
|
index += 1
|
scale_gp_beta/_version.py
CHANGED
|
@@ -16,6 +16,14 @@ from .files import (
|
|
|
16
16
|
FilesResourceWithStreamingResponse,
|
|
17
17
|
AsyncFilesResourceWithStreamingResponse,
|
|
18
18
|
)
|
|
19
|
+
from .spans import (
|
|
20
|
+
SpansResource,
|
|
21
|
+
AsyncSpansResource,
|
|
22
|
+
SpansResourceWithRawResponse,
|
|
23
|
+
AsyncSpansResourceWithRawResponse,
|
|
24
|
+
SpansResourceWithStreamingResponse,
|
|
25
|
+
AsyncSpansResourceWithStreamingResponse,
|
|
26
|
+
)
|
|
19
27
|
from .models import (
|
|
20
28
|
ModelsResource,
|
|
21
29
|
AsyncModelsResource,
|
|
@@ -128,4 +136,10 @@ __all__ = [
|
|
|
128
136
|
"AsyncEvaluationItemsResourceWithRawResponse",
|
|
129
137
|
"EvaluationItemsResourceWithStreamingResponse",
|
|
130
138
|
"AsyncEvaluationItemsResourceWithStreamingResponse",
|
|
139
|
+
"SpansResource",
|
|
140
|
+
"AsyncSpansResource",
|
|
141
|
+
"SpansResourceWithRawResponse",
|
|
142
|
+
"AsyncSpansResourceWithRawResponse",
|
|
143
|
+
"SpansResourceWithStreamingResponse",
|
|
144
|
+
"AsyncSpansResourceWithStreamingResponse",
|
|
131
145
|
]
|
|
@@ -8,11 +8,7 @@ from typing_extensions import Literal, overload
|
|
|
8
8
|
import httpx
|
|
9
9
|
|
|
10
10
|
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
|
11
|
-
from ..._utils import
|
|
12
|
-
required_args,
|
|
13
|
-
maybe_transform,
|
|
14
|
-
async_maybe_transform,
|
|
15
|
-
)
|
|
11
|
+
from ..._utils import required_args, maybe_transform, async_maybe_transform
|
|
16
12
|
from ..._compat import cached_property
|
|
17
13
|
from ..._resource import SyncAPIResource, AsyncAPIResource
|
|
18
14
|
from ..._response import (
|
|
@@ -508,7 +504,9 @@ class CompletionsResource(SyncAPIResource):
|
|
|
508
504
|
"top_logprobs": top_logprobs,
|
|
509
505
|
"top_p": top_p,
|
|
510
506
|
},
|
|
511
|
-
completion_create_params.
|
|
507
|
+
completion_create_params.CompletionCreateParamsStreaming
|
|
508
|
+
if stream
|
|
509
|
+
else completion_create_params.CompletionCreateParamsNonStreaming,
|
|
512
510
|
),
|
|
513
511
|
options=make_request_options(
|
|
514
512
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
@@ -999,7 +997,9 @@ class AsyncCompletionsResource(AsyncAPIResource):
|
|
|
999
997
|
"top_logprobs": top_logprobs,
|
|
1000
998
|
"top_p": top_p,
|
|
1001
999
|
},
|
|
1002
|
-
completion_create_params.
|
|
1000
|
+
completion_create_params.CompletionCreateParamsStreaming
|
|
1001
|
+
if stream
|
|
1002
|
+
else completion_create_params.CompletionCreateParamsNonStreaming,
|
|
1003
1003
|
),
|
|
1004
1004
|
options=make_request_options(
|
|
1005
1005
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
@@ -9,11 +9,7 @@ import httpx
|
|
|
9
9
|
|
|
10
10
|
from ..types import completion_create_params
|
|
11
11
|
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
|
12
|
-
from .._utils import
|
|
13
|
-
required_args,
|
|
14
|
-
maybe_transform,
|
|
15
|
-
async_maybe_transform,
|
|
16
|
-
)
|
|
12
|
+
from .._utils import required_args, maybe_transform, async_maybe_transform
|
|
17
13
|
from .._compat import cached_property
|
|
18
14
|
from .._resource import SyncAPIResource, AsyncAPIResource
|
|
19
15
|
from .._response import (
|
|
@@ -368,7 +364,9 @@ class CompletionsResource(SyncAPIResource):
|
|
|
368
364
|
"top_p": top_p,
|
|
369
365
|
"user": user,
|
|
370
366
|
},
|
|
371
|
-
completion_create_params.
|
|
367
|
+
completion_create_params.CompletionCreateParamsStreaming
|
|
368
|
+
if stream
|
|
369
|
+
else completion_create_params.CompletionCreateParamsNonStreaming,
|
|
372
370
|
),
|
|
373
371
|
options=make_request_options(
|
|
374
372
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
@@ -718,7 +716,9 @@ class AsyncCompletionsResource(AsyncAPIResource):
|
|
|
718
716
|
"top_p": top_p,
|
|
719
717
|
"user": user,
|
|
720
718
|
},
|
|
721
|
-
completion_create_params.
|
|
719
|
+
completion_create_params.CompletionCreateParamsStreaming
|
|
720
|
+
if stream
|
|
721
|
+
else completion_create_params.CompletionCreateParamsNonStreaming,
|
|
722
722
|
),
|
|
723
723
|
options=make_request_options(
|
|
724
724
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
@@ -13,10 +13,7 @@ from ..types import (
|
|
|
13
13
|
dataset_item_batch_create_params,
|
|
14
14
|
)
|
|
15
15
|
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
|
16
|
-
from .._utils import
|
|
17
|
-
maybe_transform,
|
|
18
|
-
async_maybe_transform,
|
|
19
|
-
)
|
|
16
|
+
from .._utils import maybe_transform, async_maybe_transform
|
|
20
17
|
from .._compat import cached_property
|
|
21
18
|
from .._resource import SyncAPIResource, AsyncAPIResource
|
|
22
19
|
from .._response import (
|
|
@@ -2,21 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing import Dict, Iterable, Optional
|
|
5
|
+
from typing import Dict, List, Iterable, Optional
|
|
6
6
|
|
|
7
7
|
import httpx
|
|
8
8
|
|
|
9
|
-
from ..types import
|
|
10
|
-
dataset_list_params,
|
|
11
|
-
dataset_create_params,
|
|
12
|
-
dataset_update_params,
|
|
13
|
-
dataset_retrieve_params,
|
|
14
|
-
)
|
|
9
|
+
from ..types import dataset_list_params, dataset_create_params, dataset_update_params, dataset_retrieve_params
|
|
15
10
|
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
|
16
|
-
from .._utils import
|
|
17
|
-
maybe_transform,
|
|
18
|
-
async_maybe_transform,
|
|
19
|
-
)
|
|
11
|
+
from .._utils import maybe_transform, async_maybe_transform
|
|
20
12
|
from .._compat import cached_property
|
|
21
13
|
from .._resource import SyncAPIResource, AsyncAPIResource
|
|
22
14
|
from .._response import (
|
|
@@ -59,6 +51,7 @@ class DatasetsResource(SyncAPIResource):
|
|
|
59
51
|
data: Iterable[Dict[str, object]],
|
|
60
52
|
name: str,
|
|
61
53
|
description: str | NotGiven = NOT_GIVEN,
|
|
54
|
+
tags: List[str] | NotGiven = NOT_GIVEN,
|
|
62
55
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
63
56
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
64
57
|
extra_headers: Headers | None = None,
|
|
@@ -72,6 +65,8 @@ class DatasetsResource(SyncAPIResource):
|
|
|
72
65
|
Args:
|
|
73
66
|
data: Items to be included in the dataset
|
|
74
67
|
|
|
68
|
+
tags: The tags associated with the entity
|
|
69
|
+
|
|
75
70
|
extra_headers: Send extra headers
|
|
76
71
|
|
|
77
72
|
extra_query: Add additional query parameters to the request
|
|
@@ -87,6 +82,7 @@ class DatasetsResource(SyncAPIResource):
|
|
|
87
82
|
"data": data,
|
|
88
83
|
"name": name,
|
|
89
84
|
"description": description,
|
|
85
|
+
"tags": tags,
|
|
90
86
|
},
|
|
91
87
|
dataset_create_params.DatasetCreateParams,
|
|
92
88
|
),
|
|
@@ -142,6 +138,7 @@ class DatasetsResource(SyncAPIResource):
|
|
|
142
138
|
*,
|
|
143
139
|
description: str | NotGiven = NOT_GIVEN,
|
|
144
140
|
name: str | NotGiven = NOT_GIVEN,
|
|
141
|
+
tags: List[str] | NotGiven = NOT_GIVEN,
|
|
145
142
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
146
143
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
147
144
|
extra_headers: Headers | None = None,
|
|
@@ -153,6 +150,8 @@ class DatasetsResource(SyncAPIResource):
|
|
|
153
150
|
Update Dataset
|
|
154
151
|
|
|
155
152
|
Args:
|
|
153
|
+
tags: The tags associated with the entity
|
|
154
|
+
|
|
156
155
|
extra_headers: Send extra headers
|
|
157
156
|
|
|
158
157
|
extra_query: Add additional query parameters to the request
|
|
@@ -169,6 +168,7 @@ class DatasetsResource(SyncAPIResource):
|
|
|
169
168
|
{
|
|
170
169
|
"description": description,
|
|
171
170
|
"name": name,
|
|
171
|
+
"tags": tags,
|
|
172
172
|
},
|
|
173
173
|
dataset_update_params.DatasetUpdateParams,
|
|
174
174
|
),
|
|
@@ -285,6 +285,7 @@ class AsyncDatasetsResource(AsyncAPIResource):
|
|
|
285
285
|
data: Iterable[Dict[str, object]],
|
|
286
286
|
name: str,
|
|
287
287
|
description: str | NotGiven = NOT_GIVEN,
|
|
288
|
+
tags: List[str] | NotGiven = NOT_GIVEN,
|
|
288
289
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
289
290
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
290
291
|
extra_headers: Headers | None = None,
|
|
@@ -298,6 +299,8 @@ class AsyncDatasetsResource(AsyncAPIResource):
|
|
|
298
299
|
Args:
|
|
299
300
|
data: Items to be included in the dataset
|
|
300
301
|
|
|
302
|
+
tags: The tags associated with the entity
|
|
303
|
+
|
|
301
304
|
extra_headers: Send extra headers
|
|
302
305
|
|
|
303
306
|
extra_query: Add additional query parameters to the request
|
|
@@ -313,6 +316,7 @@ class AsyncDatasetsResource(AsyncAPIResource):
|
|
|
313
316
|
"data": data,
|
|
314
317
|
"name": name,
|
|
315
318
|
"description": description,
|
|
319
|
+
"tags": tags,
|
|
316
320
|
},
|
|
317
321
|
dataset_create_params.DatasetCreateParams,
|
|
318
322
|
),
|
|
@@ -368,6 +372,7 @@ class AsyncDatasetsResource(AsyncAPIResource):
|
|
|
368
372
|
*,
|
|
369
373
|
description: str | NotGiven = NOT_GIVEN,
|
|
370
374
|
name: str | NotGiven = NOT_GIVEN,
|
|
375
|
+
tags: List[str] | NotGiven = NOT_GIVEN,
|
|
371
376
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
372
377
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
373
378
|
extra_headers: Headers | None = None,
|
|
@@ -379,6 +384,8 @@ class AsyncDatasetsResource(AsyncAPIResource):
|
|
|
379
384
|
Update Dataset
|
|
380
385
|
|
|
381
386
|
Args:
|
|
387
|
+
tags: The tags associated with the entity
|
|
388
|
+
|
|
382
389
|
extra_headers: Send extra headers
|
|
383
390
|
|
|
384
391
|
extra_query: Add additional query parameters to the request
|
|
@@ -395,6 +402,7 @@ class AsyncDatasetsResource(AsyncAPIResource):
|
|
|
395
402
|
{
|
|
396
403
|
"description": description,
|
|
397
404
|
"name": name,
|
|
405
|
+
"tags": tags,
|
|
398
406
|
},
|
|
399
407
|
dataset_update_params.DatasetUpdateParams,
|
|
400
408
|
),
|
|
@@ -8,10 +8,7 @@ import httpx
|
|
|
8
8
|
|
|
9
9
|
from ..types import evaluation_item_list_params, evaluation_item_retrieve_params
|
|
10
10
|
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
|
11
|
-
from .._utils import
|
|
12
|
-
maybe_transform,
|
|
13
|
-
async_maybe_transform,
|
|
14
|
-
)
|
|
11
|
+
from .._utils import maybe_transform, async_maybe_transform
|
|
15
12
|
from .._compat import cached_property
|
|
16
13
|
from .._resource import SyncAPIResource, AsyncAPIResource
|
|
17
14
|
from .._response import (
|
|
@@ -9,11 +9,7 @@ import httpx
|
|
|
9
9
|
|
|
10
10
|
from ..types import evaluation_list_params, evaluation_create_params, evaluation_retrieve_params
|
|
11
11
|
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
|
12
|
-
from .._utils import
|
|
13
|
-
required_args,
|
|
14
|
-
maybe_transform,
|
|
15
|
-
async_maybe_transform,
|
|
16
|
-
)
|
|
12
|
+
from .._utils import required_args, maybe_transform, async_maybe_transform
|
|
17
13
|
from .._compat import cached_property
|
|
18
14
|
from .._resource import SyncAPIResource, AsyncAPIResource
|
|
19
15
|
from .._response import (
|
|
@@ -58,6 +54,7 @@ class EvaluationsResource(SyncAPIResource):
|
|
|
58
54
|
data: Iterable[Dict[str, object]],
|
|
59
55
|
name: str,
|
|
60
56
|
description: str | NotGiven = NOT_GIVEN,
|
|
57
|
+
tags: List[str] | NotGiven = NOT_GIVEN,
|
|
61
58
|
tasks: Iterable[EvaluationTaskParam] | NotGiven = NOT_GIVEN,
|
|
62
59
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
63
60
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
@@ -72,6 +69,8 @@ class EvaluationsResource(SyncAPIResource):
|
|
|
72
69
|
Args:
|
|
73
70
|
data: Items to be evaluated
|
|
74
71
|
|
|
72
|
+
tags: The tags associated with the entity
|
|
73
|
+
|
|
75
74
|
tasks: Tasks allow you to augment and evaluate your data
|
|
76
75
|
|
|
77
76
|
extra_headers: Send extra headers
|
|
@@ -92,6 +91,7 @@ class EvaluationsResource(SyncAPIResource):
|
|
|
92
91
|
name: str,
|
|
93
92
|
data: Iterable[evaluation_create_params.EvaluationFromDatasetCreateRequestData] | NotGiven = NOT_GIVEN,
|
|
94
93
|
description: str | NotGiven = NOT_GIVEN,
|
|
94
|
+
tags: List[str] | NotGiven = NOT_GIVEN,
|
|
95
95
|
tasks: Iterable[EvaluationTaskParam] | NotGiven = NOT_GIVEN,
|
|
96
96
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
97
97
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
@@ -108,6 +108,8 @@ class EvaluationsResource(SyncAPIResource):
|
|
|
108
108
|
|
|
109
109
|
data: Items to be evaluated, including references to the input dataset items
|
|
110
110
|
|
|
111
|
+
tags: The tags associated with the entity
|
|
112
|
+
|
|
111
113
|
tasks: Tasks allow you to augment and evaluate your data
|
|
112
114
|
|
|
113
115
|
extra_headers: Send extra headers
|
|
@@ -128,6 +130,7 @@ class EvaluationsResource(SyncAPIResource):
|
|
|
128
130
|
dataset: evaluation_create_params.EvaluationWithDatasetCreateRequestDataset,
|
|
129
131
|
name: str,
|
|
130
132
|
description: str | NotGiven = NOT_GIVEN,
|
|
133
|
+
tags: List[str] | NotGiven = NOT_GIVEN,
|
|
131
134
|
tasks: Iterable[EvaluationTaskParam] | NotGiven = NOT_GIVEN,
|
|
132
135
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
133
136
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
@@ -144,6 +147,8 @@ class EvaluationsResource(SyncAPIResource):
|
|
|
144
147
|
|
|
145
148
|
dataset: Create a reusable dataset from items in the `data` field
|
|
146
149
|
|
|
150
|
+
tags: The tags associated with the entity
|
|
151
|
+
|
|
147
152
|
tasks: Tasks allow you to augment and evaluate your data
|
|
148
153
|
|
|
149
154
|
extra_headers: Send extra headers
|
|
@@ -165,6 +170,7 @@ class EvaluationsResource(SyncAPIResource):
|
|
|
165
170
|
| NotGiven = NOT_GIVEN,
|
|
166
171
|
name: str,
|
|
167
172
|
description: str | NotGiven = NOT_GIVEN,
|
|
173
|
+
tags: List[str] | NotGiven = NOT_GIVEN,
|
|
168
174
|
tasks: Iterable[EvaluationTaskParam] | NotGiven = NOT_GIVEN,
|
|
169
175
|
dataset_id: str | NotGiven = NOT_GIVEN,
|
|
170
176
|
dataset: evaluation_create_params.EvaluationWithDatasetCreateRequestDataset | NotGiven = NOT_GIVEN,
|
|
@@ -182,6 +188,7 @@ class EvaluationsResource(SyncAPIResource):
|
|
|
182
188
|
"data": data,
|
|
183
189
|
"name": name,
|
|
184
190
|
"description": description,
|
|
191
|
+
"tags": tags,
|
|
185
192
|
"tasks": tasks,
|
|
186
193
|
"dataset_id": dataset_id,
|
|
187
194
|
"dataset": dataset,
|
|
@@ -349,6 +356,7 @@ class AsyncEvaluationsResource(AsyncAPIResource):
|
|
|
349
356
|
data: Iterable[Dict[str, object]],
|
|
350
357
|
name: str,
|
|
351
358
|
description: str | NotGiven = NOT_GIVEN,
|
|
359
|
+
tags: List[str] | NotGiven = NOT_GIVEN,
|
|
352
360
|
tasks: Iterable[EvaluationTaskParam] | NotGiven = NOT_GIVEN,
|
|
353
361
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
354
362
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
@@ -363,6 +371,8 @@ class AsyncEvaluationsResource(AsyncAPIResource):
|
|
|
363
371
|
Args:
|
|
364
372
|
data: Items to be evaluated
|
|
365
373
|
|
|
374
|
+
tags: The tags associated with the entity
|
|
375
|
+
|
|
366
376
|
tasks: Tasks allow you to augment and evaluate your data
|
|
367
377
|
|
|
368
378
|
extra_headers: Send extra headers
|
|
@@ -383,6 +393,7 @@ class AsyncEvaluationsResource(AsyncAPIResource):
|
|
|
383
393
|
name: str,
|
|
384
394
|
data: Iterable[evaluation_create_params.EvaluationFromDatasetCreateRequestData] | NotGiven = NOT_GIVEN,
|
|
385
395
|
description: str | NotGiven = NOT_GIVEN,
|
|
396
|
+
tags: List[str] | NotGiven = NOT_GIVEN,
|
|
386
397
|
tasks: Iterable[EvaluationTaskParam] | NotGiven = NOT_GIVEN,
|
|
387
398
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
388
399
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
@@ -399,6 +410,8 @@ class AsyncEvaluationsResource(AsyncAPIResource):
|
|
|
399
410
|
|
|
400
411
|
data: Items to be evaluated, including references to the input dataset items
|
|
401
412
|
|
|
413
|
+
tags: The tags associated with the entity
|
|
414
|
+
|
|
402
415
|
tasks: Tasks allow you to augment and evaluate your data
|
|
403
416
|
|
|
404
417
|
extra_headers: Send extra headers
|
|
@@ -419,6 +432,7 @@ class AsyncEvaluationsResource(AsyncAPIResource):
|
|
|
419
432
|
dataset: evaluation_create_params.EvaluationWithDatasetCreateRequestDataset,
|
|
420
433
|
name: str,
|
|
421
434
|
description: str | NotGiven = NOT_GIVEN,
|
|
435
|
+
tags: List[str] | NotGiven = NOT_GIVEN,
|
|
422
436
|
tasks: Iterable[EvaluationTaskParam] | NotGiven = NOT_GIVEN,
|
|
423
437
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
424
438
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
@@ -435,6 +449,8 @@ class AsyncEvaluationsResource(AsyncAPIResource):
|
|
|
435
449
|
|
|
436
450
|
dataset: Create a reusable dataset from items in the `data` field
|
|
437
451
|
|
|
452
|
+
tags: The tags associated with the entity
|
|
453
|
+
|
|
438
454
|
tasks: Tasks allow you to augment and evaluate your data
|
|
439
455
|
|
|
440
456
|
extra_headers: Send extra headers
|
|
@@ -456,6 +472,7 @@ class AsyncEvaluationsResource(AsyncAPIResource):
|
|
|
456
472
|
| NotGiven = NOT_GIVEN,
|
|
457
473
|
name: str,
|
|
458
474
|
description: str | NotGiven = NOT_GIVEN,
|
|
475
|
+
tags: List[str] | NotGiven = NOT_GIVEN,
|
|
459
476
|
tasks: Iterable[EvaluationTaskParam] | NotGiven = NOT_GIVEN,
|
|
460
477
|
dataset_id: str | NotGiven = NOT_GIVEN,
|
|
461
478
|
dataset: evaluation_create_params.EvaluationWithDatasetCreateRequestDataset | NotGiven = NOT_GIVEN,
|
|
@@ -473,6 +490,7 @@ class AsyncEvaluationsResource(AsyncAPIResource):
|
|
|
473
490
|
"data": data,
|
|
474
491
|
"name": name,
|
|
475
492
|
"description": description,
|
|
493
|
+
"tags": tags,
|
|
476
494
|
"tasks": tasks,
|
|
477
495
|
"dataset_id": dataset_id,
|
|
478
496
|
"dataset": dataset,
|
|
@@ -16,12 +16,7 @@ from .content import (
|
|
|
16
16
|
AsyncContentResourceWithStreamingResponse,
|
|
17
17
|
)
|
|
18
18
|
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, FileTypes
|
|
19
|
-
from ..._utils import
|
|
20
|
-
extract_files,
|
|
21
|
-
maybe_transform,
|
|
22
|
-
deepcopy_minimal,
|
|
23
|
-
async_maybe_transform,
|
|
24
|
-
)
|
|
19
|
+
from ..._utils import extract_files, maybe_transform, deepcopy_minimal, async_maybe_transform
|
|
25
20
|
from ..._compat import cached_property
|
|
26
21
|
from ..._resource import SyncAPIResource, AsyncAPIResource
|
|
27
22
|
from ..._response import (
|
|
@@ -8,10 +8,7 @@ import httpx
|
|
|
8
8
|
|
|
9
9
|
from ..types import inference_create_params
|
|
10
10
|
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
|
11
|
-
from .._utils import
|
|
12
|
-
maybe_transform,
|
|
13
|
-
async_maybe_transform,
|
|
14
|
-
)
|
|
11
|
+
from .._utils import maybe_transform, async_maybe_transform
|
|
15
12
|
from .._compat import cached_property
|
|
16
13
|
from .._resource import SyncAPIResource, AsyncAPIResource
|
|
17
14
|
from .._response import (
|