scale-gp-beta 0.1.0a30__py3-none-any.whl → 0.1.0a31__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 +3 -3
- scale_gp_beta/_client.py +8 -8
- scale_gp_beta/_compat.py +48 -48
- scale_gp_beta/_models.py +41 -41
- scale_gp_beta/_types.py +35 -1
- scale_gp_beta/_utils/__init__.py +9 -2
- scale_gp_beta/_utils/_compat.py +45 -0
- scale_gp_beta/_utils/_datetime_parse.py +136 -0
- scale_gp_beta/_utils/_transform.py +11 -1
- scale_gp_beta/_utils/_typing.py +6 -1
- scale_gp_beta/_utils/_utils.py +0 -1
- scale_gp_beta/_version.py +1 -1
- scale_gp_beta/resources/__init__.py +6 -6
- scale_gp_beta/resources/chat/completions.py +18 -18
- scale_gp_beta/resources/completions.py +18 -18
- scale_gp_beta/resources/datasets.py +8 -8
- scale_gp_beta/resources/evaluations.py +35 -13
- scale_gp_beta/resources/responses.py +4 -4
- scale_gp_beta/resources/spans.py +15 -15
- scale_gp_beta/types/__init__.py +4 -4
- scale_gp_beta/types/chat/completion_create_params.py +5 -3
- scale_gp_beta/types/completion_create_params.py +5 -3
- scale_gp_beta/types/container.py +2 -2
- scale_gp_beta/types/container_param.py +2 -2
- scale_gp_beta/types/dataset_create_params.py +4 -2
- scale_gp_beta/types/dataset_list_params.py +3 -2
- scale_gp_beta/types/dataset_update_params.py +3 -2
- scale_gp_beta/types/evaluation.py +4 -1
- scale_gp_beta/types/evaluation_create_params.py +17 -6
- scale_gp_beta/types/evaluation_list_params.py +3 -1
- scale_gp_beta/types/evaluation_task_param.py +4 -3
- scale_gp_beta/types/evaluation_update_params.py +3 -2
- scale_gp_beta/types/inference_model.py +4 -0
- scale_gp_beta/types/model_create_params.py +6 -4
- scale_gp_beta/types/model_update_params.py +6 -4
- scale_gp_beta/types/question_create_params.py +4 -2
- scale_gp_beta/types/response_create_params.py +7 -5
- scale_gp_beta/types/span_search_params.py +8 -7
- {scale_gp_beta-0.1.0a30.dist-info → scale_gp_beta-0.1.0a31.dist-info}/METADATA +1 -1
- {scale_gp_beta-0.1.0a30.dist-info → scale_gp_beta-0.1.0a31.dist-info}/RECORD +42 -40
- {scale_gp_beta-0.1.0a30.dist-info → scale_gp_beta-0.1.0a31.dist-info}/WHEEL +0 -0
- {scale_gp_beta-0.1.0a30.dist-info → scale_gp_beta-0.1.0a31.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This file contains code from https://github.com/pydantic/pydantic/blob/main/pydantic/v1/datetime_parse.py
|
|
3
|
+
without the Pydantic v1 specific errors.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
import re
|
|
9
|
+
from typing import Dict, Union, Optional
|
|
10
|
+
from datetime import date, datetime, timezone, timedelta
|
|
11
|
+
|
|
12
|
+
from .._types import StrBytesIntFloat
|
|
13
|
+
|
|
14
|
+
date_expr = r"(?P<year>\d{4})-(?P<month>\d{1,2})-(?P<day>\d{1,2})"
|
|
15
|
+
time_expr = (
|
|
16
|
+
r"(?P<hour>\d{1,2}):(?P<minute>\d{1,2})"
|
|
17
|
+
r"(?::(?P<second>\d{1,2})(?:\.(?P<microsecond>\d{1,6})\d{0,6})?)?"
|
|
18
|
+
r"(?P<tzinfo>Z|[+-]\d{2}(?::?\d{2})?)?$"
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
date_re = re.compile(f"{date_expr}$")
|
|
22
|
+
datetime_re = re.compile(f"{date_expr}[T ]{time_expr}")
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
EPOCH = datetime(1970, 1, 1)
|
|
26
|
+
# if greater than this, the number is in ms, if less than or equal it's in seconds
|
|
27
|
+
# (in seconds this is 11th October 2603, in ms it's 20th August 1970)
|
|
28
|
+
MS_WATERSHED = int(2e10)
|
|
29
|
+
# slightly more than datetime.max in ns - (datetime.max - EPOCH).total_seconds() * 1e9
|
|
30
|
+
MAX_NUMBER = int(3e20)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _get_numeric(value: StrBytesIntFloat, native_expected_type: str) -> Union[None, int, float]:
|
|
34
|
+
if isinstance(value, (int, float)):
|
|
35
|
+
return value
|
|
36
|
+
try:
|
|
37
|
+
return float(value)
|
|
38
|
+
except ValueError:
|
|
39
|
+
return None
|
|
40
|
+
except TypeError:
|
|
41
|
+
raise TypeError(f"invalid type; expected {native_expected_type}, string, bytes, int or float") from None
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def _from_unix_seconds(seconds: Union[int, float]) -> datetime:
|
|
45
|
+
if seconds > MAX_NUMBER:
|
|
46
|
+
return datetime.max
|
|
47
|
+
elif seconds < -MAX_NUMBER:
|
|
48
|
+
return datetime.min
|
|
49
|
+
|
|
50
|
+
while abs(seconds) > MS_WATERSHED:
|
|
51
|
+
seconds /= 1000
|
|
52
|
+
dt = EPOCH + timedelta(seconds=seconds)
|
|
53
|
+
return dt.replace(tzinfo=timezone.utc)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def _parse_timezone(value: Optional[str]) -> Union[None, int, timezone]:
|
|
57
|
+
if value == "Z":
|
|
58
|
+
return timezone.utc
|
|
59
|
+
elif value is not None:
|
|
60
|
+
offset_mins = int(value[-2:]) if len(value) > 3 else 0
|
|
61
|
+
offset = 60 * int(value[1:3]) + offset_mins
|
|
62
|
+
if value[0] == "-":
|
|
63
|
+
offset = -offset
|
|
64
|
+
return timezone(timedelta(minutes=offset))
|
|
65
|
+
else:
|
|
66
|
+
return None
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def parse_datetime(value: Union[datetime, StrBytesIntFloat]) -> datetime:
|
|
70
|
+
"""
|
|
71
|
+
Parse a datetime/int/float/string and return a datetime.datetime.
|
|
72
|
+
|
|
73
|
+
This function supports time zone offsets. When the input contains one,
|
|
74
|
+
the output uses a timezone with a fixed offset from UTC.
|
|
75
|
+
|
|
76
|
+
Raise ValueError if the input is well formatted but not a valid datetime.
|
|
77
|
+
Raise ValueError if the input isn't well formatted.
|
|
78
|
+
"""
|
|
79
|
+
if isinstance(value, datetime):
|
|
80
|
+
return value
|
|
81
|
+
|
|
82
|
+
number = _get_numeric(value, "datetime")
|
|
83
|
+
if number is not None:
|
|
84
|
+
return _from_unix_seconds(number)
|
|
85
|
+
|
|
86
|
+
if isinstance(value, bytes):
|
|
87
|
+
value = value.decode()
|
|
88
|
+
|
|
89
|
+
assert not isinstance(value, (float, int))
|
|
90
|
+
|
|
91
|
+
match = datetime_re.match(value)
|
|
92
|
+
if match is None:
|
|
93
|
+
raise ValueError("invalid datetime format")
|
|
94
|
+
|
|
95
|
+
kw = match.groupdict()
|
|
96
|
+
if kw["microsecond"]:
|
|
97
|
+
kw["microsecond"] = kw["microsecond"].ljust(6, "0")
|
|
98
|
+
|
|
99
|
+
tzinfo = _parse_timezone(kw.pop("tzinfo"))
|
|
100
|
+
kw_: Dict[str, Union[None, int, timezone]] = {k: int(v) for k, v in kw.items() if v is not None}
|
|
101
|
+
kw_["tzinfo"] = tzinfo
|
|
102
|
+
|
|
103
|
+
return datetime(**kw_) # type: ignore
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def parse_date(value: Union[date, StrBytesIntFloat]) -> date:
|
|
107
|
+
"""
|
|
108
|
+
Parse a date/int/float/string and return a datetime.date.
|
|
109
|
+
|
|
110
|
+
Raise ValueError if the input is well formatted but not a valid date.
|
|
111
|
+
Raise ValueError if the input isn't well formatted.
|
|
112
|
+
"""
|
|
113
|
+
if isinstance(value, date):
|
|
114
|
+
if isinstance(value, datetime):
|
|
115
|
+
return value.date()
|
|
116
|
+
else:
|
|
117
|
+
return value
|
|
118
|
+
|
|
119
|
+
number = _get_numeric(value, "date")
|
|
120
|
+
if number is not None:
|
|
121
|
+
return _from_unix_seconds(number).date()
|
|
122
|
+
|
|
123
|
+
if isinstance(value, bytes):
|
|
124
|
+
value = value.decode()
|
|
125
|
+
|
|
126
|
+
assert not isinstance(value, (float, int))
|
|
127
|
+
match = date_re.match(value)
|
|
128
|
+
if match is None:
|
|
129
|
+
raise ValueError("invalid date format")
|
|
130
|
+
|
|
131
|
+
kw = {k: int(v) for k, v in match.groupdict().items()}
|
|
132
|
+
|
|
133
|
+
try:
|
|
134
|
+
return date(**kw)
|
|
135
|
+
except ValueError:
|
|
136
|
+
raise ValueError("invalid date format") from None
|
|
@@ -16,18 +16,20 @@ from ._utils import (
|
|
|
16
16
|
lru_cache,
|
|
17
17
|
is_mapping,
|
|
18
18
|
is_iterable,
|
|
19
|
+
is_sequence,
|
|
19
20
|
)
|
|
20
21
|
from .._files import is_base64_file_input
|
|
22
|
+
from ._compat import get_origin, is_typeddict
|
|
21
23
|
from ._typing import (
|
|
22
24
|
is_list_type,
|
|
23
25
|
is_union_type,
|
|
24
26
|
extract_type_arg,
|
|
25
27
|
is_iterable_type,
|
|
26
28
|
is_required_type,
|
|
29
|
+
is_sequence_type,
|
|
27
30
|
is_annotated_type,
|
|
28
31
|
strip_annotated_type,
|
|
29
32
|
)
|
|
30
|
-
from .._compat import get_origin, model_dump, is_typeddict
|
|
31
33
|
|
|
32
34
|
_T = TypeVar("_T")
|
|
33
35
|
|
|
@@ -167,6 +169,8 @@ def _transform_recursive(
|
|
|
167
169
|
|
|
168
170
|
Defaults to the same value as the `annotation` argument.
|
|
169
171
|
"""
|
|
172
|
+
from .._compat import model_dump
|
|
173
|
+
|
|
170
174
|
if inner_type is None:
|
|
171
175
|
inner_type = annotation
|
|
172
176
|
|
|
@@ -184,6 +188,8 @@ def _transform_recursive(
|
|
|
184
188
|
(is_list_type(stripped_type) and is_list(data))
|
|
185
189
|
# Iterable[T]
|
|
186
190
|
or (is_iterable_type(stripped_type) and is_iterable(data) and not isinstance(data, str))
|
|
191
|
+
# Sequence[T]
|
|
192
|
+
or (is_sequence_type(stripped_type) and is_sequence(data) and not isinstance(data, str))
|
|
187
193
|
):
|
|
188
194
|
# dicts are technically iterable, but it is an iterable on the keys of the dict and is not usually
|
|
189
195
|
# intended as an iterable, so we don't transform it.
|
|
@@ -329,6 +335,8 @@ async def _async_transform_recursive(
|
|
|
329
335
|
|
|
330
336
|
Defaults to the same value as the `annotation` argument.
|
|
331
337
|
"""
|
|
338
|
+
from .._compat import model_dump
|
|
339
|
+
|
|
332
340
|
if inner_type is None:
|
|
333
341
|
inner_type = annotation
|
|
334
342
|
|
|
@@ -346,6 +354,8 @@ async def _async_transform_recursive(
|
|
|
346
354
|
(is_list_type(stripped_type) and is_list(data))
|
|
347
355
|
# Iterable[T]
|
|
348
356
|
or (is_iterable_type(stripped_type) and is_iterable(data) and not isinstance(data, str))
|
|
357
|
+
# Sequence[T]
|
|
358
|
+
or (is_sequence_type(stripped_type) and is_sequence(data) and not isinstance(data, str))
|
|
349
359
|
):
|
|
350
360
|
# dicts are technically iterable, but it is an iterable on the keys of the dict and is not usually
|
|
351
361
|
# intended as an iterable, so we don't transform it.
|
scale_gp_beta/_utils/_typing.py
CHANGED
|
@@ -15,7 +15,7 @@ from typing_extensions import (
|
|
|
15
15
|
|
|
16
16
|
from ._utils import lru_cache
|
|
17
17
|
from .._types import InheritsGeneric
|
|
18
|
-
from
|
|
18
|
+
from ._compat import is_union as _is_union
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
def is_annotated_type(typ: type) -> bool:
|
|
@@ -26,6 +26,11 @@ def is_list_type(typ: type) -> bool:
|
|
|
26
26
|
return (get_origin(typ) or typ) == list
|
|
27
27
|
|
|
28
28
|
|
|
29
|
+
def is_sequence_type(typ: type) -> bool:
|
|
30
|
+
origin = get_origin(typ) or typ
|
|
31
|
+
return origin == typing_extensions.Sequence or origin == typing.Sequence or origin == _c_abc.Sequence
|
|
32
|
+
|
|
33
|
+
|
|
29
34
|
def is_iterable_type(typ: type) -> bool:
|
|
30
35
|
"""If the given type is `typing.Iterable[T]`"""
|
|
31
36
|
origin = get_origin(typ) or typ
|
scale_gp_beta/_utils/_utils.py
CHANGED
|
@@ -22,7 +22,6 @@ from typing_extensions import TypeGuard
|
|
|
22
22
|
import sniffio
|
|
23
23
|
|
|
24
24
|
from .._types import NotGiven, FileTypes, NotGivenOr, HeadersLike
|
|
25
|
-
from .._compat import parse_date as parse_date, parse_datetime as parse_datetime
|
|
26
25
|
|
|
27
26
|
_T = TypeVar("_T")
|
|
28
27
|
_TupleT = TypeVar("_TupleT", bound=Tuple[object, ...])
|
scale_gp_beta/_version.py
CHANGED
|
@@ -146,18 +146,18 @@ __all__ = [
|
|
|
146
146
|
"AsyncDatasetsResourceWithRawResponse",
|
|
147
147
|
"DatasetsResourceWithStreamingResponse",
|
|
148
148
|
"AsyncDatasetsResourceWithStreamingResponse",
|
|
149
|
-
"EvaluationsResource",
|
|
150
|
-
"AsyncEvaluationsResource",
|
|
151
|
-
"EvaluationsResourceWithRawResponse",
|
|
152
|
-
"AsyncEvaluationsResourceWithRawResponse",
|
|
153
|
-
"EvaluationsResourceWithStreamingResponse",
|
|
154
|
-
"AsyncEvaluationsResourceWithStreamingResponse",
|
|
155
149
|
"DatasetItemsResource",
|
|
156
150
|
"AsyncDatasetItemsResource",
|
|
157
151
|
"DatasetItemsResourceWithRawResponse",
|
|
158
152
|
"AsyncDatasetItemsResourceWithRawResponse",
|
|
159
153
|
"DatasetItemsResourceWithStreamingResponse",
|
|
160
154
|
"AsyncDatasetItemsResourceWithStreamingResponse",
|
|
155
|
+
"EvaluationsResource",
|
|
156
|
+
"AsyncEvaluationsResource",
|
|
157
|
+
"EvaluationsResourceWithRawResponse",
|
|
158
|
+
"AsyncEvaluationsResourceWithRawResponse",
|
|
159
|
+
"EvaluationsResourceWithStreamingResponse",
|
|
160
|
+
"AsyncEvaluationsResourceWithStreamingResponse",
|
|
161
161
|
"EvaluationItemsResource",
|
|
162
162
|
"AsyncEvaluationItemsResource",
|
|
163
163
|
"EvaluationItemsResourceWithRawResponse",
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing import Any, Dict,
|
|
5
|
+
from typing import Any, Dict, Union, Iterable, cast
|
|
6
6
|
from typing_extensions import Literal, overload
|
|
7
7
|
|
|
8
8
|
import httpx
|
|
9
9
|
|
|
10
|
-
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
|
10
|
+
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr
|
|
11
11
|
from ..._utils import required_args, maybe_transform, async_maybe_transform
|
|
12
12
|
from ..._compat import cached_property
|
|
13
13
|
from ..._resource import SyncAPIResource, AsyncAPIResource
|
|
@@ -62,7 +62,7 @@ class CompletionsResource(SyncAPIResource):
|
|
|
62
62
|
max_completion_tokens: int | NotGiven = NOT_GIVEN,
|
|
63
63
|
max_tokens: int | NotGiven = NOT_GIVEN,
|
|
64
64
|
metadata: Dict[str, str] | NotGiven = NOT_GIVEN,
|
|
65
|
-
modalities:
|
|
65
|
+
modalities: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
|
|
66
66
|
n: int | NotGiven = NOT_GIVEN,
|
|
67
67
|
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
|
|
68
68
|
prediction: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
@@ -70,7 +70,7 @@ class CompletionsResource(SyncAPIResource):
|
|
|
70
70
|
reasoning_effort: str | NotGiven = NOT_GIVEN,
|
|
71
71
|
response_format: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
72
72
|
seed: int | NotGiven = NOT_GIVEN,
|
|
73
|
-
stop: Union[str,
|
|
73
|
+
stop: Union[str, SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
|
|
74
74
|
store: bool | NotGiven = NOT_GIVEN,
|
|
75
75
|
stream: Literal[False] | NotGiven = NOT_GIVEN,
|
|
76
76
|
stream_options: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
@@ -191,7 +191,7 @@ class CompletionsResource(SyncAPIResource):
|
|
|
191
191
|
max_completion_tokens: int | NotGiven = NOT_GIVEN,
|
|
192
192
|
max_tokens: int | NotGiven = NOT_GIVEN,
|
|
193
193
|
metadata: Dict[str, str] | NotGiven = NOT_GIVEN,
|
|
194
|
-
modalities:
|
|
194
|
+
modalities: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
|
|
195
195
|
n: int | NotGiven = NOT_GIVEN,
|
|
196
196
|
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
|
|
197
197
|
prediction: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
@@ -199,7 +199,7 @@ class CompletionsResource(SyncAPIResource):
|
|
|
199
199
|
reasoning_effort: str | NotGiven = NOT_GIVEN,
|
|
200
200
|
response_format: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
201
201
|
seed: int | NotGiven = NOT_GIVEN,
|
|
202
|
-
stop: Union[str,
|
|
202
|
+
stop: Union[str, SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
|
|
203
203
|
store: bool | NotGiven = NOT_GIVEN,
|
|
204
204
|
stream_options: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
205
205
|
temperature: float | NotGiven = NOT_GIVEN,
|
|
@@ -319,7 +319,7 @@ class CompletionsResource(SyncAPIResource):
|
|
|
319
319
|
max_completion_tokens: int | NotGiven = NOT_GIVEN,
|
|
320
320
|
max_tokens: int | NotGiven = NOT_GIVEN,
|
|
321
321
|
metadata: Dict[str, str] | NotGiven = NOT_GIVEN,
|
|
322
|
-
modalities:
|
|
322
|
+
modalities: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
|
|
323
323
|
n: int | NotGiven = NOT_GIVEN,
|
|
324
324
|
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
|
|
325
325
|
prediction: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
@@ -327,7 +327,7 @@ class CompletionsResource(SyncAPIResource):
|
|
|
327
327
|
reasoning_effort: str | NotGiven = NOT_GIVEN,
|
|
328
328
|
response_format: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
329
329
|
seed: int | NotGiven = NOT_GIVEN,
|
|
330
|
-
stop: Union[str,
|
|
330
|
+
stop: Union[str, SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
|
|
331
331
|
store: bool | NotGiven = NOT_GIVEN,
|
|
332
332
|
stream_options: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
333
333
|
temperature: float | NotGiven = NOT_GIVEN,
|
|
@@ -446,7 +446,7 @@ class CompletionsResource(SyncAPIResource):
|
|
|
446
446
|
max_completion_tokens: int | NotGiven = NOT_GIVEN,
|
|
447
447
|
max_tokens: int | NotGiven = NOT_GIVEN,
|
|
448
448
|
metadata: Dict[str, str] | NotGiven = NOT_GIVEN,
|
|
449
|
-
modalities:
|
|
449
|
+
modalities: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
|
|
450
450
|
n: int | NotGiven = NOT_GIVEN,
|
|
451
451
|
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
|
|
452
452
|
prediction: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
@@ -454,7 +454,7 @@ class CompletionsResource(SyncAPIResource):
|
|
|
454
454
|
reasoning_effort: str | NotGiven = NOT_GIVEN,
|
|
455
455
|
response_format: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
456
456
|
seed: int | NotGiven = NOT_GIVEN,
|
|
457
|
-
stop: Union[str,
|
|
457
|
+
stop: Union[str, SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
|
|
458
458
|
store: bool | NotGiven = NOT_GIVEN,
|
|
459
459
|
stream: Literal[False] | Literal[True] | NotGiven = NOT_GIVEN,
|
|
460
460
|
stream_options: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
@@ -619,7 +619,7 @@ class AsyncCompletionsResource(AsyncAPIResource):
|
|
|
619
619
|
max_completion_tokens: int | NotGiven = NOT_GIVEN,
|
|
620
620
|
max_tokens: int | NotGiven = NOT_GIVEN,
|
|
621
621
|
metadata: Dict[str, str] | NotGiven = NOT_GIVEN,
|
|
622
|
-
modalities:
|
|
622
|
+
modalities: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
|
|
623
623
|
n: int | NotGiven = NOT_GIVEN,
|
|
624
624
|
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
|
|
625
625
|
prediction: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
@@ -627,7 +627,7 @@ class AsyncCompletionsResource(AsyncAPIResource):
|
|
|
627
627
|
reasoning_effort: str | NotGiven = NOT_GIVEN,
|
|
628
628
|
response_format: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
629
629
|
seed: int | NotGiven = NOT_GIVEN,
|
|
630
|
-
stop: Union[str,
|
|
630
|
+
stop: Union[str, SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
|
|
631
631
|
store: bool | NotGiven = NOT_GIVEN,
|
|
632
632
|
stream: Literal[False] | NotGiven = NOT_GIVEN,
|
|
633
633
|
stream_options: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
@@ -748,7 +748,7 @@ class AsyncCompletionsResource(AsyncAPIResource):
|
|
|
748
748
|
max_completion_tokens: int | NotGiven = NOT_GIVEN,
|
|
749
749
|
max_tokens: int | NotGiven = NOT_GIVEN,
|
|
750
750
|
metadata: Dict[str, str] | NotGiven = NOT_GIVEN,
|
|
751
|
-
modalities:
|
|
751
|
+
modalities: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
|
|
752
752
|
n: int | NotGiven = NOT_GIVEN,
|
|
753
753
|
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
|
|
754
754
|
prediction: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
@@ -756,7 +756,7 @@ class AsyncCompletionsResource(AsyncAPIResource):
|
|
|
756
756
|
reasoning_effort: str | NotGiven = NOT_GIVEN,
|
|
757
757
|
response_format: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
758
758
|
seed: int | NotGiven = NOT_GIVEN,
|
|
759
|
-
stop: Union[str,
|
|
759
|
+
stop: Union[str, SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
|
|
760
760
|
store: bool | NotGiven = NOT_GIVEN,
|
|
761
761
|
stream_options: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
762
762
|
temperature: float | NotGiven = NOT_GIVEN,
|
|
@@ -876,7 +876,7 @@ class AsyncCompletionsResource(AsyncAPIResource):
|
|
|
876
876
|
max_completion_tokens: int | NotGiven = NOT_GIVEN,
|
|
877
877
|
max_tokens: int | NotGiven = NOT_GIVEN,
|
|
878
878
|
metadata: Dict[str, str] | NotGiven = NOT_GIVEN,
|
|
879
|
-
modalities:
|
|
879
|
+
modalities: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
|
|
880
880
|
n: int | NotGiven = NOT_GIVEN,
|
|
881
881
|
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
|
|
882
882
|
prediction: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
@@ -884,7 +884,7 @@ class AsyncCompletionsResource(AsyncAPIResource):
|
|
|
884
884
|
reasoning_effort: str | NotGiven = NOT_GIVEN,
|
|
885
885
|
response_format: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
886
886
|
seed: int | NotGiven = NOT_GIVEN,
|
|
887
|
-
stop: Union[str,
|
|
887
|
+
stop: Union[str, SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
|
|
888
888
|
store: bool | NotGiven = NOT_GIVEN,
|
|
889
889
|
stream_options: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
890
890
|
temperature: float | NotGiven = NOT_GIVEN,
|
|
@@ -1003,7 +1003,7 @@ class AsyncCompletionsResource(AsyncAPIResource):
|
|
|
1003
1003
|
max_completion_tokens: int | NotGiven = NOT_GIVEN,
|
|
1004
1004
|
max_tokens: int | NotGiven = NOT_GIVEN,
|
|
1005
1005
|
metadata: Dict[str, str] | NotGiven = NOT_GIVEN,
|
|
1006
|
-
modalities:
|
|
1006
|
+
modalities: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
|
|
1007
1007
|
n: int | NotGiven = NOT_GIVEN,
|
|
1008
1008
|
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
|
|
1009
1009
|
prediction: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
@@ -1011,7 +1011,7 @@ class AsyncCompletionsResource(AsyncAPIResource):
|
|
|
1011
1011
|
reasoning_effort: str | NotGiven = NOT_GIVEN,
|
|
1012
1012
|
response_format: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
1013
1013
|
seed: int | NotGiven = NOT_GIVEN,
|
|
1014
|
-
stop: Union[str,
|
|
1014
|
+
stop: Union[str, SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
|
|
1015
1015
|
store: bool | NotGiven = NOT_GIVEN,
|
|
1016
1016
|
stream: Literal[False] | Literal[True] | NotGiven = NOT_GIVEN,
|
|
1017
1017
|
stream_options: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing import Dict,
|
|
5
|
+
from typing import Dict, Union
|
|
6
6
|
from typing_extensions import Literal, overload
|
|
7
7
|
|
|
8
8
|
import httpx
|
|
9
9
|
|
|
10
10
|
from ..types import completion_create_params
|
|
11
|
-
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
|
11
|
+
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr
|
|
12
12
|
from .._utils import required_args, maybe_transform, async_maybe_transform
|
|
13
13
|
from .._compat import cached_property
|
|
14
14
|
from .._resource import SyncAPIResource, AsyncAPIResource
|
|
@@ -50,7 +50,7 @@ class CompletionsResource(SyncAPIResource):
|
|
|
50
50
|
self,
|
|
51
51
|
*,
|
|
52
52
|
model: str,
|
|
53
|
-
prompt: Union[str,
|
|
53
|
+
prompt: Union[str, SequenceNotStr[str]],
|
|
54
54
|
best_of: int | NotGiven = NOT_GIVEN,
|
|
55
55
|
echo: bool | NotGiven = NOT_GIVEN,
|
|
56
56
|
frequency_penalty: float | NotGiven = NOT_GIVEN,
|
|
@@ -60,7 +60,7 @@ class CompletionsResource(SyncAPIResource):
|
|
|
60
60
|
n: int | NotGiven = NOT_GIVEN,
|
|
61
61
|
presence_penalty: float | NotGiven = NOT_GIVEN,
|
|
62
62
|
seed: int | NotGiven = NOT_GIVEN,
|
|
63
|
-
stop: Union[str,
|
|
63
|
+
stop: Union[str, SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
|
|
64
64
|
stream: Literal[False] | NotGiven = NOT_GIVEN,
|
|
65
65
|
stream_options: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
66
66
|
suffix: str | NotGiven = NOT_GIVEN,
|
|
@@ -139,7 +139,7 @@ class CompletionsResource(SyncAPIResource):
|
|
|
139
139
|
self,
|
|
140
140
|
*,
|
|
141
141
|
model: str,
|
|
142
|
-
prompt: Union[str,
|
|
142
|
+
prompt: Union[str, SequenceNotStr[str]],
|
|
143
143
|
stream: Literal[True],
|
|
144
144
|
best_of: int | NotGiven = NOT_GIVEN,
|
|
145
145
|
echo: bool | NotGiven = NOT_GIVEN,
|
|
@@ -150,7 +150,7 @@ class CompletionsResource(SyncAPIResource):
|
|
|
150
150
|
n: int | NotGiven = NOT_GIVEN,
|
|
151
151
|
presence_penalty: float | NotGiven = NOT_GIVEN,
|
|
152
152
|
seed: int | NotGiven = NOT_GIVEN,
|
|
153
|
-
stop: Union[str,
|
|
153
|
+
stop: Union[str, SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
|
|
154
154
|
stream_options: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
155
155
|
suffix: str | NotGiven = NOT_GIVEN,
|
|
156
156
|
temperature: float | NotGiven = NOT_GIVEN,
|
|
@@ -228,7 +228,7 @@ class CompletionsResource(SyncAPIResource):
|
|
|
228
228
|
self,
|
|
229
229
|
*,
|
|
230
230
|
model: str,
|
|
231
|
-
prompt: Union[str,
|
|
231
|
+
prompt: Union[str, SequenceNotStr[str]],
|
|
232
232
|
stream: bool,
|
|
233
233
|
best_of: int | NotGiven = NOT_GIVEN,
|
|
234
234
|
echo: bool | NotGiven = NOT_GIVEN,
|
|
@@ -239,7 +239,7 @@ class CompletionsResource(SyncAPIResource):
|
|
|
239
239
|
n: int | NotGiven = NOT_GIVEN,
|
|
240
240
|
presence_penalty: float | NotGiven = NOT_GIVEN,
|
|
241
241
|
seed: int | NotGiven = NOT_GIVEN,
|
|
242
|
-
stop: Union[str,
|
|
242
|
+
stop: Union[str, SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
|
|
243
243
|
stream_options: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
244
244
|
suffix: str | NotGiven = NOT_GIVEN,
|
|
245
245
|
temperature: float | NotGiven = NOT_GIVEN,
|
|
@@ -317,7 +317,7 @@ class CompletionsResource(SyncAPIResource):
|
|
|
317
317
|
self,
|
|
318
318
|
*,
|
|
319
319
|
model: str,
|
|
320
|
-
prompt: Union[str,
|
|
320
|
+
prompt: Union[str, SequenceNotStr[str]],
|
|
321
321
|
best_of: int | NotGiven = NOT_GIVEN,
|
|
322
322
|
echo: bool | NotGiven = NOT_GIVEN,
|
|
323
323
|
frequency_penalty: float | NotGiven = NOT_GIVEN,
|
|
@@ -327,7 +327,7 @@ class CompletionsResource(SyncAPIResource):
|
|
|
327
327
|
n: int | NotGiven = NOT_GIVEN,
|
|
328
328
|
presence_penalty: float | NotGiven = NOT_GIVEN,
|
|
329
329
|
seed: int | NotGiven = NOT_GIVEN,
|
|
330
|
-
stop: Union[str,
|
|
330
|
+
stop: Union[str, SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
|
|
331
331
|
stream: Literal[False] | Literal[True] | NotGiven = NOT_GIVEN,
|
|
332
332
|
stream_options: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
333
333
|
suffix: str | NotGiven = NOT_GIVEN,
|
|
@@ -402,7 +402,7 @@ class AsyncCompletionsResource(AsyncAPIResource):
|
|
|
402
402
|
self,
|
|
403
403
|
*,
|
|
404
404
|
model: str,
|
|
405
|
-
prompt: Union[str,
|
|
405
|
+
prompt: Union[str, SequenceNotStr[str]],
|
|
406
406
|
best_of: int | NotGiven = NOT_GIVEN,
|
|
407
407
|
echo: bool | NotGiven = NOT_GIVEN,
|
|
408
408
|
frequency_penalty: float | NotGiven = NOT_GIVEN,
|
|
@@ -412,7 +412,7 @@ class AsyncCompletionsResource(AsyncAPIResource):
|
|
|
412
412
|
n: int | NotGiven = NOT_GIVEN,
|
|
413
413
|
presence_penalty: float | NotGiven = NOT_GIVEN,
|
|
414
414
|
seed: int | NotGiven = NOT_GIVEN,
|
|
415
|
-
stop: Union[str,
|
|
415
|
+
stop: Union[str, SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
|
|
416
416
|
stream: Literal[False] | NotGiven = NOT_GIVEN,
|
|
417
417
|
stream_options: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
418
418
|
suffix: str | NotGiven = NOT_GIVEN,
|
|
@@ -491,7 +491,7 @@ class AsyncCompletionsResource(AsyncAPIResource):
|
|
|
491
491
|
self,
|
|
492
492
|
*,
|
|
493
493
|
model: str,
|
|
494
|
-
prompt: Union[str,
|
|
494
|
+
prompt: Union[str, SequenceNotStr[str]],
|
|
495
495
|
stream: Literal[True],
|
|
496
496
|
best_of: int | NotGiven = NOT_GIVEN,
|
|
497
497
|
echo: bool | NotGiven = NOT_GIVEN,
|
|
@@ -502,7 +502,7 @@ class AsyncCompletionsResource(AsyncAPIResource):
|
|
|
502
502
|
n: int | NotGiven = NOT_GIVEN,
|
|
503
503
|
presence_penalty: float | NotGiven = NOT_GIVEN,
|
|
504
504
|
seed: int | NotGiven = NOT_GIVEN,
|
|
505
|
-
stop: Union[str,
|
|
505
|
+
stop: Union[str, SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
|
|
506
506
|
stream_options: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
507
507
|
suffix: str | NotGiven = NOT_GIVEN,
|
|
508
508
|
temperature: float | NotGiven = NOT_GIVEN,
|
|
@@ -580,7 +580,7 @@ class AsyncCompletionsResource(AsyncAPIResource):
|
|
|
580
580
|
self,
|
|
581
581
|
*,
|
|
582
582
|
model: str,
|
|
583
|
-
prompt: Union[str,
|
|
583
|
+
prompt: Union[str, SequenceNotStr[str]],
|
|
584
584
|
stream: bool,
|
|
585
585
|
best_of: int | NotGiven = NOT_GIVEN,
|
|
586
586
|
echo: bool | NotGiven = NOT_GIVEN,
|
|
@@ -591,7 +591,7 @@ class AsyncCompletionsResource(AsyncAPIResource):
|
|
|
591
591
|
n: int | NotGiven = NOT_GIVEN,
|
|
592
592
|
presence_penalty: float | NotGiven = NOT_GIVEN,
|
|
593
593
|
seed: int | NotGiven = NOT_GIVEN,
|
|
594
|
-
stop: Union[str,
|
|
594
|
+
stop: Union[str, SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
|
|
595
595
|
stream_options: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
596
596
|
suffix: str | NotGiven = NOT_GIVEN,
|
|
597
597
|
temperature: float | NotGiven = NOT_GIVEN,
|
|
@@ -669,7 +669,7 @@ class AsyncCompletionsResource(AsyncAPIResource):
|
|
|
669
669
|
self,
|
|
670
670
|
*,
|
|
671
671
|
model: str,
|
|
672
|
-
prompt: Union[str,
|
|
672
|
+
prompt: Union[str, SequenceNotStr[str]],
|
|
673
673
|
best_of: int | NotGiven = NOT_GIVEN,
|
|
674
674
|
echo: bool | NotGiven = NOT_GIVEN,
|
|
675
675
|
frequency_penalty: float | NotGiven = NOT_GIVEN,
|
|
@@ -679,7 +679,7 @@ class AsyncCompletionsResource(AsyncAPIResource):
|
|
|
679
679
|
n: int | NotGiven = NOT_GIVEN,
|
|
680
680
|
presence_penalty: float | NotGiven = NOT_GIVEN,
|
|
681
681
|
seed: int | NotGiven = NOT_GIVEN,
|
|
682
|
-
stop: Union[str,
|
|
682
|
+
stop: Union[str, SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
|
|
683
683
|
stream: Literal[False] | Literal[True] | NotGiven = NOT_GIVEN,
|
|
684
684
|
stream_options: Dict[str, object] | NotGiven = NOT_GIVEN,
|
|
685
685
|
suffix: str | NotGiven = NOT_GIVEN,
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing import Dict,
|
|
5
|
+
from typing import Dict, Iterable
|
|
6
6
|
from typing_extensions import Literal
|
|
7
7
|
|
|
8
8
|
import httpx
|
|
9
9
|
|
|
10
10
|
from ..types import dataset_list_params, dataset_create_params, dataset_update_params, dataset_retrieve_params
|
|
11
|
-
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
|
11
|
+
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr
|
|
12
12
|
from .._utils import maybe_transform, async_maybe_transform
|
|
13
13
|
from .._compat import cached_property
|
|
14
14
|
from .._resource import SyncAPIResource, AsyncAPIResource
|
|
@@ -52,7 +52,7 @@ class DatasetsResource(SyncAPIResource):
|
|
|
52
52
|
data: Iterable[Dict[str, object]],
|
|
53
53
|
name: str,
|
|
54
54
|
description: str | NotGiven = NOT_GIVEN,
|
|
55
|
-
tags:
|
|
55
|
+
tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
|
|
56
56
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
57
57
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
58
58
|
extra_headers: Headers | None = None,
|
|
@@ -139,7 +139,7 @@ class DatasetsResource(SyncAPIResource):
|
|
|
139
139
|
*,
|
|
140
140
|
description: str | NotGiven = NOT_GIVEN,
|
|
141
141
|
name: str | NotGiven = NOT_GIVEN,
|
|
142
|
-
tags:
|
|
142
|
+
tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
|
|
143
143
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
144
144
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
145
145
|
extra_headers: Headers | None = None,
|
|
@@ -188,7 +188,7 @@ class DatasetsResource(SyncAPIResource):
|
|
|
188
188
|
name: str | NotGiven = NOT_GIVEN,
|
|
189
189
|
sort_order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
|
|
190
190
|
starting_after: str | NotGiven = NOT_GIVEN,
|
|
191
|
-
tags:
|
|
191
|
+
tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
|
|
192
192
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
193
193
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
194
194
|
extra_headers: Headers | None = None,
|
|
@@ -292,7 +292,7 @@ class AsyncDatasetsResource(AsyncAPIResource):
|
|
|
292
292
|
data: Iterable[Dict[str, object]],
|
|
293
293
|
name: str,
|
|
294
294
|
description: str | NotGiven = NOT_GIVEN,
|
|
295
|
-
tags:
|
|
295
|
+
tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
|
|
296
296
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
297
297
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
298
298
|
extra_headers: Headers | None = None,
|
|
@@ -379,7 +379,7 @@ class AsyncDatasetsResource(AsyncAPIResource):
|
|
|
379
379
|
*,
|
|
380
380
|
description: str | NotGiven = NOT_GIVEN,
|
|
381
381
|
name: str | NotGiven = NOT_GIVEN,
|
|
382
|
-
tags:
|
|
382
|
+
tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
|
|
383
383
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
384
384
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
385
385
|
extra_headers: Headers | None = None,
|
|
@@ -428,7 +428,7 @@ class AsyncDatasetsResource(AsyncAPIResource):
|
|
|
428
428
|
name: str | NotGiven = NOT_GIVEN,
|
|
429
429
|
sort_order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
|
|
430
430
|
starting_after: str | NotGiven = NOT_GIVEN,
|
|
431
|
-
tags:
|
|
431
|
+
tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
|
|
432
432
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
433
433
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
434
434
|
extra_headers: Headers | None = None,
|