scale-gp-beta 0.1.0a8__py3-none-any.whl → 0.1.0a10__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 +40 -2
- scale_gp_beta/_client.py +9 -1
- scale_gp_beta/_models.py +0 -1
- scale_gp_beta/_utils/_transform.py +46 -1
- scale_gp_beta/_utils/_typing.py +3 -1
- scale_gp_beta/_version.py +1 -1
- scale_gp_beta/resources/__init__.py +14 -0
- scale_gp_beta/resources/chat/completions.py +6 -2
- scale_gp_beta/resources/completions.py +6 -2
- scale_gp_beta/resources/datasets.py +17 -1
- scale_gp_beta/resources/evaluations.py +40 -4
- scale_gp_beta/resources/spans.py +654 -0
- scale_gp_beta/types/__init__.py +5 -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 +7 -0
- scale_gp_beta/types/evaluation_create_params.py +12 -0
- scale_gp_beta/types/evaluation_list_params.py +4 -2
- scale_gp_beta/types/evaluation_retrieve_params.py +4 -1
- scale_gp_beta/types/evaluation_task.py +205 -0
- scale_gp_beta/types/evaluation_task_param.py +39 -45
- 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 +27 -0
- scale_gp_beta/types/span_update_params.py +21 -0
- {scale_gp_beta-0.1.0a8.dist-info → scale_gp_beta-0.1.0a10.dist-info}/METADATA +8 -8
- {scale_gp_beta-0.1.0a8.dist-info → scale_gp_beta-0.1.0a10.dist-info}/RECORD +30 -24
- {scale_gp_beta-0.1.0a8.dist-info → scale_gp_beta-0.1.0a10.dist-info}/WHEEL +0 -0
- {scale_gp_beta-0.1.0a8.dist-info → scale_gp_beta-0.1.0a10.dist-info}/licenses/LICENSE +0 -0
scale_gp_beta/_base_client.py
CHANGED
|
@@ -98,7 +98,11 @@ _StreamT = TypeVar("_StreamT", bound=Stream[Any])
|
|
|
98
98
|
_AsyncStreamT = TypeVar("_AsyncStreamT", bound=AsyncStream[Any])
|
|
99
99
|
|
|
100
100
|
if TYPE_CHECKING:
|
|
101
|
-
from httpx._config import
|
|
101
|
+
from httpx._config import (
|
|
102
|
+
DEFAULT_TIMEOUT_CONFIG, # pyright: ignore[reportPrivateImportUsage]
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
HTTPX_DEFAULT_TIMEOUT = DEFAULT_TIMEOUT_CONFIG
|
|
102
106
|
else:
|
|
103
107
|
try:
|
|
104
108
|
from httpx._config import DEFAULT_TIMEOUT_CONFIG as HTTPX_DEFAULT_TIMEOUT
|
|
@@ -115,6 +119,7 @@ class PageInfo:
|
|
|
115
119
|
|
|
116
120
|
url: URL | NotGiven
|
|
117
121
|
params: Query | NotGiven
|
|
122
|
+
json: Body | NotGiven
|
|
118
123
|
|
|
119
124
|
@overload
|
|
120
125
|
def __init__(
|
|
@@ -130,19 +135,30 @@ class PageInfo:
|
|
|
130
135
|
params: Query,
|
|
131
136
|
) -> None: ...
|
|
132
137
|
|
|
138
|
+
@overload
|
|
139
|
+
def __init__(
|
|
140
|
+
self,
|
|
141
|
+
*,
|
|
142
|
+
json: Body,
|
|
143
|
+
) -> None: ...
|
|
144
|
+
|
|
133
145
|
def __init__(
|
|
134
146
|
self,
|
|
135
147
|
*,
|
|
136
148
|
url: URL | NotGiven = NOT_GIVEN,
|
|
149
|
+
json: Body | NotGiven = NOT_GIVEN,
|
|
137
150
|
params: Query | NotGiven = NOT_GIVEN,
|
|
138
151
|
) -> None:
|
|
139
152
|
self.url = url
|
|
153
|
+
self.json = json
|
|
140
154
|
self.params = params
|
|
141
155
|
|
|
142
156
|
@override
|
|
143
157
|
def __repr__(self) -> str:
|
|
144
158
|
if self.url:
|
|
145
159
|
return f"{self.__class__.__name__}(url={self.url})"
|
|
160
|
+
if self.json:
|
|
161
|
+
return f"{self.__class__.__name__}(json={self.json})"
|
|
146
162
|
return f"{self.__class__.__name__}(params={self.params})"
|
|
147
163
|
|
|
148
164
|
|
|
@@ -191,6 +207,19 @@ class BasePage(GenericModel, Generic[_T]):
|
|
|
191
207
|
options.url = str(url)
|
|
192
208
|
return options
|
|
193
209
|
|
|
210
|
+
if not isinstance(info.json, NotGiven):
|
|
211
|
+
if not is_mapping(info.json):
|
|
212
|
+
raise TypeError("Pagination is only supported with mappings")
|
|
213
|
+
|
|
214
|
+
if not options.json_data:
|
|
215
|
+
options.json_data = {**info.json}
|
|
216
|
+
else:
|
|
217
|
+
if not is_mapping(options.json_data):
|
|
218
|
+
raise TypeError("Pagination is only supported with mappings")
|
|
219
|
+
|
|
220
|
+
options.json_data = {**options.json_data, **info.json}
|
|
221
|
+
return options
|
|
222
|
+
|
|
194
223
|
raise ValueError("Unexpected PageInfo state")
|
|
195
224
|
|
|
196
225
|
|
|
@@ -409,7 +438,8 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
|
|
|
409
438
|
|
|
410
439
|
idempotency_header = self._idempotency_header
|
|
411
440
|
if idempotency_header and options.method.lower() != "get" and idempotency_header not in headers:
|
|
412
|
-
|
|
441
|
+
options.idempotency_key = options.idempotency_key or self._idempotency_key()
|
|
442
|
+
headers[idempotency_header] = options.idempotency_key
|
|
413
443
|
|
|
414
444
|
# Don't set these headers if they were already set or removed by the caller. We check
|
|
415
445
|
# `custom_headers`, which can contain `Omit()`, instead of `headers` to account for the removal case.
|
|
@@ -943,6 +973,10 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
|
|
|
943
973
|
request = self._build_request(options, retries_taken=retries_taken)
|
|
944
974
|
self._prepare_request(request)
|
|
945
975
|
|
|
976
|
+
if options.idempotency_key:
|
|
977
|
+
# ensure the idempotency key is reused between requests
|
|
978
|
+
input_options.idempotency_key = options.idempotency_key
|
|
979
|
+
|
|
946
980
|
kwargs: HttpxSendArgs = {}
|
|
947
981
|
if self.custom_auth is not None:
|
|
948
982
|
kwargs["auth"] = self.custom_auth
|
|
@@ -1475,6 +1509,10 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
|
|
|
1475
1509
|
request = self._build_request(options, retries_taken=retries_taken)
|
|
1476
1510
|
await self._prepare_request(request)
|
|
1477
1511
|
|
|
1512
|
+
if options.idempotency_key:
|
|
1513
|
+
# ensure the idempotency key is reused between requests
|
|
1514
|
+
input_options.idempotency_key = options.idempotency_key
|
|
1515
|
+
|
|
1478
1516
|
kwargs: HttpxSendArgs = {}
|
|
1479
1517
|
if self.custom_auth is not None:
|
|
1480
1518
|
kwargs["auth"] = self.custom_auth
|
scale_gp_beta/_client.py
CHANGED
|
@@ -24,7 +24,7 @@ from ._utils import (
|
|
|
24
24
|
get_async_library,
|
|
25
25
|
)
|
|
26
26
|
from ._version import __version__
|
|
27
|
-
from .resources import models, datasets, inference, completions, evaluations, dataset_items, evaluation_items
|
|
27
|
+
from .resources import spans, models, datasets, inference, completions, evaluations, dataset_items, evaluation_items
|
|
28
28
|
from ._streaming import Stream as Stream, AsyncStream as AsyncStream
|
|
29
29
|
from ._exceptions import APIStatusError, SGPClientError
|
|
30
30
|
from ._base_client import (
|
|
@@ -63,6 +63,7 @@ class SGPClient(SyncAPIClient):
|
|
|
63
63
|
evaluations: evaluations.EvaluationsResource
|
|
64
64
|
dataset_items: dataset_items.DatasetItemsResource
|
|
65
65
|
evaluation_items: evaluation_items.EvaluationItemsResource
|
|
66
|
+
spans: spans.SpansResource
|
|
66
67
|
with_raw_response: SGPClientWithRawResponse
|
|
67
68
|
with_streaming_response: SGPClientWithStreamedResponse
|
|
68
69
|
|
|
@@ -165,6 +166,7 @@ class SGPClient(SyncAPIClient):
|
|
|
165
166
|
self.evaluations = evaluations.EvaluationsResource(self)
|
|
166
167
|
self.dataset_items = dataset_items.DatasetItemsResource(self)
|
|
167
168
|
self.evaluation_items = evaluation_items.EvaluationItemsResource(self)
|
|
169
|
+
self.spans = spans.SpansResource(self)
|
|
168
170
|
self.with_raw_response = SGPClientWithRawResponse(self)
|
|
169
171
|
self.with_streaming_response = SGPClientWithStreamedResponse(self)
|
|
170
172
|
|
|
@@ -288,6 +290,7 @@ class AsyncSGPClient(AsyncAPIClient):
|
|
|
288
290
|
evaluations: evaluations.AsyncEvaluationsResource
|
|
289
291
|
dataset_items: dataset_items.AsyncDatasetItemsResource
|
|
290
292
|
evaluation_items: evaluation_items.AsyncEvaluationItemsResource
|
|
293
|
+
spans: spans.AsyncSpansResource
|
|
291
294
|
with_raw_response: AsyncSGPClientWithRawResponse
|
|
292
295
|
with_streaming_response: AsyncSGPClientWithStreamedResponse
|
|
293
296
|
|
|
@@ -390,6 +393,7 @@ class AsyncSGPClient(AsyncAPIClient):
|
|
|
390
393
|
self.evaluations = evaluations.AsyncEvaluationsResource(self)
|
|
391
394
|
self.dataset_items = dataset_items.AsyncDatasetItemsResource(self)
|
|
392
395
|
self.evaluation_items = evaluation_items.AsyncEvaluationItemsResource(self)
|
|
396
|
+
self.spans = spans.AsyncSpansResource(self)
|
|
393
397
|
self.with_raw_response = AsyncSGPClientWithRawResponse(self)
|
|
394
398
|
self.with_streaming_response = AsyncSGPClientWithStreamedResponse(self)
|
|
395
399
|
|
|
@@ -514,6 +518,7 @@ class SGPClientWithRawResponse:
|
|
|
514
518
|
self.evaluations = evaluations.EvaluationsResourceWithRawResponse(client.evaluations)
|
|
515
519
|
self.dataset_items = dataset_items.DatasetItemsResourceWithRawResponse(client.dataset_items)
|
|
516
520
|
self.evaluation_items = evaluation_items.EvaluationItemsResourceWithRawResponse(client.evaluation_items)
|
|
521
|
+
self.spans = spans.SpansResourceWithRawResponse(client.spans)
|
|
517
522
|
|
|
518
523
|
|
|
519
524
|
class AsyncSGPClientWithRawResponse:
|
|
@@ -527,6 +532,7 @@ class AsyncSGPClientWithRawResponse:
|
|
|
527
532
|
self.evaluations = evaluations.AsyncEvaluationsResourceWithRawResponse(client.evaluations)
|
|
528
533
|
self.dataset_items = dataset_items.AsyncDatasetItemsResourceWithRawResponse(client.dataset_items)
|
|
529
534
|
self.evaluation_items = evaluation_items.AsyncEvaluationItemsResourceWithRawResponse(client.evaluation_items)
|
|
535
|
+
self.spans = spans.AsyncSpansResourceWithRawResponse(client.spans)
|
|
530
536
|
|
|
531
537
|
|
|
532
538
|
class SGPClientWithStreamedResponse:
|
|
@@ -540,6 +546,7 @@ class SGPClientWithStreamedResponse:
|
|
|
540
546
|
self.evaluations = evaluations.EvaluationsResourceWithStreamingResponse(client.evaluations)
|
|
541
547
|
self.dataset_items = dataset_items.DatasetItemsResourceWithStreamingResponse(client.dataset_items)
|
|
542
548
|
self.evaluation_items = evaluation_items.EvaluationItemsResourceWithStreamingResponse(client.evaluation_items)
|
|
549
|
+
self.spans = spans.SpansResourceWithStreamingResponse(client.spans)
|
|
543
550
|
|
|
544
551
|
|
|
545
552
|
class AsyncSGPClientWithStreamedResponse:
|
|
@@ -555,6 +562,7 @@ class AsyncSGPClientWithStreamedResponse:
|
|
|
555
562
|
self.evaluation_items = evaluation_items.AsyncEvaluationItemsResourceWithStreamingResponse(
|
|
556
563
|
client.evaluation_items
|
|
557
564
|
)
|
|
565
|
+
self.spans = spans.AsyncSpansResourceWithStreamingResponse(client.spans)
|
|
558
566
|
|
|
559
567
|
|
|
560
568
|
Client = SGPClient
|
scale_gp_beta/_models.py
CHANGED
|
@@ -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/_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
|
]
|
|
@@ -508,7 +508,9 @@ class CompletionsResource(SyncAPIResource):
|
|
|
508
508
|
"top_logprobs": top_logprobs,
|
|
509
509
|
"top_p": top_p,
|
|
510
510
|
},
|
|
511
|
-
completion_create_params.
|
|
511
|
+
completion_create_params.CompletionCreateParamsStreaming
|
|
512
|
+
if stream
|
|
513
|
+
else completion_create_params.CompletionCreateParamsNonStreaming,
|
|
512
514
|
),
|
|
513
515
|
options=make_request_options(
|
|
514
516
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
@@ -999,7 +1001,9 @@ class AsyncCompletionsResource(AsyncAPIResource):
|
|
|
999
1001
|
"top_logprobs": top_logprobs,
|
|
1000
1002
|
"top_p": top_p,
|
|
1001
1003
|
},
|
|
1002
|
-
completion_create_params.
|
|
1004
|
+
completion_create_params.CompletionCreateParamsStreaming
|
|
1005
|
+
if stream
|
|
1006
|
+
else completion_create_params.CompletionCreateParamsNonStreaming,
|
|
1003
1007
|
),
|
|
1004
1008
|
options=make_request_options(
|
|
1005
1009
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
@@ -368,7 +368,9 @@ class CompletionsResource(SyncAPIResource):
|
|
|
368
368
|
"top_p": top_p,
|
|
369
369
|
"user": user,
|
|
370
370
|
},
|
|
371
|
-
completion_create_params.
|
|
371
|
+
completion_create_params.CompletionCreateParamsStreaming
|
|
372
|
+
if stream
|
|
373
|
+
else completion_create_params.CompletionCreateParamsNonStreaming,
|
|
372
374
|
),
|
|
373
375
|
options=make_request_options(
|
|
374
376
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
@@ -718,7 +720,9 @@ class AsyncCompletionsResource(AsyncAPIResource):
|
|
|
718
720
|
"top_p": top_p,
|
|
719
721
|
"user": user,
|
|
720
722
|
},
|
|
721
|
-
completion_create_params.
|
|
723
|
+
completion_create_params.CompletionCreateParamsStreaming
|
|
724
|
+
if stream
|
|
725
|
+
else completion_create_params.CompletionCreateParamsNonStreaming,
|
|
722
726
|
),
|
|
723
727
|
options=make_request_options(
|
|
724
728
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
@@ -2,7 +2,7 @@
|
|
|
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
|
|
|
@@ -59,6 +59,7 @@ class DatasetsResource(SyncAPIResource):
|
|
|
59
59
|
data: Iterable[Dict[str, object]],
|
|
60
60
|
name: str,
|
|
61
61
|
description: str | NotGiven = NOT_GIVEN,
|
|
62
|
+
tags: List[str] | NotGiven = NOT_GIVEN,
|
|
62
63
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
63
64
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
64
65
|
extra_headers: Headers | None = None,
|
|
@@ -72,6 +73,8 @@ class DatasetsResource(SyncAPIResource):
|
|
|
72
73
|
Args:
|
|
73
74
|
data: Items to be included in the dataset
|
|
74
75
|
|
|
76
|
+
tags: The tags associated with the entity
|
|
77
|
+
|
|
75
78
|
extra_headers: Send extra headers
|
|
76
79
|
|
|
77
80
|
extra_query: Add additional query parameters to the request
|
|
@@ -87,6 +90,7 @@ class DatasetsResource(SyncAPIResource):
|
|
|
87
90
|
"data": data,
|
|
88
91
|
"name": name,
|
|
89
92
|
"description": description,
|
|
93
|
+
"tags": tags,
|
|
90
94
|
},
|
|
91
95
|
dataset_create_params.DatasetCreateParams,
|
|
92
96
|
),
|
|
@@ -142,6 +146,7 @@ class DatasetsResource(SyncAPIResource):
|
|
|
142
146
|
*,
|
|
143
147
|
description: str | NotGiven = NOT_GIVEN,
|
|
144
148
|
name: str | NotGiven = NOT_GIVEN,
|
|
149
|
+
tags: List[str] | NotGiven = NOT_GIVEN,
|
|
145
150
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
146
151
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
147
152
|
extra_headers: Headers | None = None,
|
|
@@ -153,6 +158,8 @@ class DatasetsResource(SyncAPIResource):
|
|
|
153
158
|
Update Dataset
|
|
154
159
|
|
|
155
160
|
Args:
|
|
161
|
+
tags: The tags associated with the entity
|
|
162
|
+
|
|
156
163
|
extra_headers: Send extra headers
|
|
157
164
|
|
|
158
165
|
extra_query: Add additional query parameters to the request
|
|
@@ -169,6 +176,7 @@ class DatasetsResource(SyncAPIResource):
|
|
|
169
176
|
{
|
|
170
177
|
"description": description,
|
|
171
178
|
"name": name,
|
|
179
|
+
"tags": tags,
|
|
172
180
|
},
|
|
173
181
|
dataset_update_params.DatasetUpdateParams,
|
|
174
182
|
),
|
|
@@ -285,6 +293,7 @@ class AsyncDatasetsResource(AsyncAPIResource):
|
|
|
285
293
|
data: Iterable[Dict[str, object]],
|
|
286
294
|
name: str,
|
|
287
295
|
description: str | NotGiven = NOT_GIVEN,
|
|
296
|
+
tags: List[str] | NotGiven = NOT_GIVEN,
|
|
288
297
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
289
298
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
290
299
|
extra_headers: Headers | None = None,
|
|
@@ -298,6 +307,8 @@ class AsyncDatasetsResource(AsyncAPIResource):
|
|
|
298
307
|
Args:
|
|
299
308
|
data: Items to be included in the dataset
|
|
300
309
|
|
|
310
|
+
tags: The tags associated with the entity
|
|
311
|
+
|
|
301
312
|
extra_headers: Send extra headers
|
|
302
313
|
|
|
303
314
|
extra_query: Add additional query parameters to the request
|
|
@@ -313,6 +324,7 @@ class AsyncDatasetsResource(AsyncAPIResource):
|
|
|
313
324
|
"data": data,
|
|
314
325
|
"name": name,
|
|
315
326
|
"description": description,
|
|
327
|
+
"tags": tags,
|
|
316
328
|
},
|
|
317
329
|
dataset_create_params.DatasetCreateParams,
|
|
318
330
|
),
|
|
@@ -368,6 +380,7 @@ class AsyncDatasetsResource(AsyncAPIResource):
|
|
|
368
380
|
*,
|
|
369
381
|
description: str | NotGiven = NOT_GIVEN,
|
|
370
382
|
name: str | NotGiven = NOT_GIVEN,
|
|
383
|
+
tags: List[str] | NotGiven = NOT_GIVEN,
|
|
371
384
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
372
385
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
373
386
|
extra_headers: Headers | None = None,
|
|
@@ -379,6 +392,8 @@ class AsyncDatasetsResource(AsyncAPIResource):
|
|
|
379
392
|
Update Dataset
|
|
380
393
|
|
|
381
394
|
Args:
|
|
395
|
+
tags: The tags associated with the entity
|
|
396
|
+
|
|
382
397
|
extra_headers: Send extra headers
|
|
383
398
|
|
|
384
399
|
extra_query: Add additional query parameters to the request
|
|
@@ -395,6 +410,7 @@ class AsyncDatasetsResource(AsyncAPIResource):
|
|
|
395
410
|
{
|
|
396
411
|
"description": description,
|
|
397
412
|
"name": name,
|
|
413
|
+
"tags": tags,
|
|
398
414
|
},
|
|
399
415
|
dataset_update_params.DatasetUpdateParams,
|
|
400
416
|
),
|