anthropic 0.68.0__py3-none-any.whl → 0.68.1__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.
- anthropic/__init__.py +3 -1
- anthropic/_base_client.py +9 -9
- anthropic/_client.py +8 -8
- anthropic/_qs.py +7 -7
- anthropic/_types.py +18 -11
- anthropic/_utils/_transform.py +2 -2
- anthropic/_utils/_utils.py +4 -4
- anthropic/_version.py +1 -1
- anthropic/lib/tools/_beta_runner.py +0 -1
- anthropic/resources/beta/files.py +37 -37
- anthropic/resources/beta/messages/batches.py +43 -43
- anthropic/resources/beta/messages/messages.py +271 -271
- anthropic/resources/beta/models.py +19 -19
- anthropic/resources/completions.py +63 -63
- anthropic/resources/messages/batches.py +19 -19
- anthropic/resources/messages/messages.py +125 -125
- anthropic/resources/models.py +19 -19
- {anthropic-0.68.0.dist-info → anthropic-0.68.1.dist-info}/METADATA +1 -1
- {anthropic-0.68.0.dist-info → anthropic-0.68.1.dist-info}/RECORD +21 -21
- {anthropic-0.68.0.dist-info → anthropic-0.68.1.dist-info}/WHEEL +0 -0
- {anthropic-0.68.0.dist-info → anthropic-0.68.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -7,7 +7,7 @@ from typing import List
|
|
|
7
7
|
import httpx
|
|
8
8
|
|
|
9
9
|
from ... import _legacy_response
|
|
10
|
-
from ..._types import
|
|
10
|
+
from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
|
|
11
11
|
from ..._utils import is_given, maybe_transform, strip_not_given
|
|
12
12
|
from ..._compat import cached_property
|
|
13
13
|
from ..._resource import SyncAPIResource, AsyncAPIResource
|
|
@@ -45,13 +45,13 @@ class Models(SyncAPIResource):
|
|
|
45
45
|
self,
|
|
46
46
|
model_id: str,
|
|
47
47
|
*,
|
|
48
|
-
betas: List[AnthropicBetaParam] |
|
|
48
|
+
betas: List[AnthropicBetaParam] | Omit = omit,
|
|
49
49
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
50
50
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
51
51
|
extra_headers: Headers | None = None,
|
|
52
52
|
extra_query: Query | None = None,
|
|
53
53
|
extra_body: Body | None = None,
|
|
54
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
54
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
55
55
|
) -> BetaModelInfo:
|
|
56
56
|
"""
|
|
57
57
|
Get a specific model.
|
|
@@ -75,7 +75,7 @@ class Models(SyncAPIResource):
|
|
|
75
75
|
if not model_id:
|
|
76
76
|
raise ValueError(f"Expected a non-empty value for `model_id` but received {model_id!r}")
|
|
77
77
|
extra_headers = {
|
|
78
|
-
**strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else
|
|
78
|
+
**strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else omit}),
|
|
79
79
|
**(extra_headers or {}),
|
|
80
80
|
}
|
|
81
81
|
return self._get(
|
|
@@ -89,16 +89,16 @@ class Models(SyncAPIResource):
|
|
|
89
89
|
def list(
|
|
90
90
|
self,
|
|
91
91
|
*,
|
|
92
|
-
after_id: str |
|
|
93
|
-
before_id: str |
|
|
94
|
-
limit: int |
|
|
95
|
-
betas: List[AnthropicBetaParam] |
|
|
92
|
+
after_id: str | Omit = omit,
|
|
93
|
+
before_id: str | Omit = omit,
|
|
94
|
+
limit: int | Omit = omit,
|
|
95
|
+
betas: List[AnthropicBetaParam] | Omit = omit,
|
|
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.
|
|
98
98
|
extra_headers: Headers | None = None,
|
|
99
99
|
extra_query: Query | None = None,
|
|
100
100
|
extra_body: Body | None = None,
|
|
101
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
101
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
102
102
|
) -> SyncPage[BetaModelInfo]:
|
|
103
103
|
"""
|
|
104
104
|
List available models.
|
|
@@ -128,7 +128,7 @@ class Models(SyncAPIResource):
|
|
|
128
128
|
timeout: Override the client-level default timeout for this request, in seconds
|
|
129
129
|
"""
|
|
130
130
|
extra_headers = {
|
|
131
|
-
**strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else
|
|
131
|
+
**strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else omit}),
|
|
132
132
|
**(extra_headers or {}),
|
|
133
133
|
}
|
|
134
134
|
return self._get_api_list(
|
|
@@ -176,13 +176,13 @@ class AsyncModels(AsyncAPIResource):
|
|
|
176
176
|
self,
|
|
177
177
|
model_id: str,
|
|
178
178
|
*,
|
|
179
|
-
betas: List[AnthropicBetaParam] |
|
|
179
|
+
betas: List[AnthropicBetaParam] | Omit = omit,
|
|
180
180
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
181
181
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
182
182
|
extra_headers: Headers | None = None,
|
|
183
183
|
extra_query: Query | None = None,
|
|
184
184
|
extra_body: Body | None = None,
|
|
185
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
185
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
186
186
|
) -> BetaModelInfo:
|
|
187
187
|
"""
|
|
188
188
|
Get a specific model.
|
|
@@ -206,7 +206,7 @@ class AsyncModels(AsyncAPIResource):
|
|
|
206
206
|
if not model_id:
|
|
207
207
|
raise ValueError(f"Expected a non-empty value for `model_id` but received {model_id!r}")
|
|
208
208
|
extra_headers = {
|
|
209
|
-
**strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else
|
|
209
|
+
**strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else omit}),
|
|
210
210
|
**(extra_headers or {}),
|
|
211
211
|
}
|
|
212
212
|
return await self._get(
|
|
@@ -220,16 +220,16 @@ class AsyncModels(AsyncAPIResource):
|
|
|
220
220
|
def list(
|
|
221
221
|
self,
|
|
222
222
|
*,
|
|
223
|
-
after_id: str |
|
|
224
|
-
before_id: str |
|
|
225
|
-
limit: int |
|
|
226
|
-
betas: List[AnthropicBetaParam] |
|
|
223
|
+
after_id: str | Omit = omit,
|
|
224
|
+
before_id: str | Omit = omit,
|
|
225
|
+
limit: int | Omit = omit,
|
|
226
|
+
betas: List[AnthropicBetaParam] | Omit = omit,
|
|
227
227
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
228
228
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
229
229
|
extra_headers: Headers | None = None,
|
|
230
230
|
extra_query: Query | None = None,
|
|
231
231
|
extra_body: Body | None = None,
|
|
232
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
232
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
233
233
|
) -> AsyncPaginator[BetaModelInfo, AsyncPage[BetaModelInfo]]:
|
|
234
234
|
"""
|
|
235
235
|
List available models.
|
|
@@ -259,7 +259,7 @@ class AsyncModels(AsyncAPIResource):
|
|
|
259
259
|
timeout: Override the client-level default timeout for this request, in seconds
|
|
260
260
|
"""
|
|
261
261
|
extra_headers = {
|
|
262
|
-
**strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else
|
|
262
|
+
**strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else omit}),
|
|
263
263
|
**(extra_headers or {}),
|
|
264
264
|
}
|
|
265
265
|
return self._get_api_list(
|
|
@@ -9,7 +9,7 @@ import httpx
|
|
|
9
9
|
|
|
10
10
|
from .. import _legacy_response
|
|
11
11
|
from ..types import completion_create_params
|
|
12
|
-
from .._types import
|
|
12
|
+
from .._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
|
|
13
13
|
from .._utils import is_given, required_args, maybe_transform, strip_not_given, async_maybe_transform
|
|
14
14
|
from .._compat import cached_property
|
|
15
15
|
from .._resource import SyncAPIResource, AsyncAPIResource
|
|
@@ -52,19 +52,19 @@ class Completions(SyncAPIResource):
|
|
|
52
52
|
max_tokens_to_sample: int,
|
|
53
53
|
model: ModelParam,
|
|
54
54
|
prompt: str,
|
|
55
|
-
metadata: MetadataParam |
|
|
56
|
-
stop_sequences: SequenceNotStr[str] |
|
|
57
|
-
stream: Literal[False] |
|
|
58
|
-
temperature: float |
|
|
59
|
-
top_k: int |
|
|
60
|
-
top_p: float |
|
|
61
|
-
betas: List[AnthropicBetaParam] |
|
|
55
|
+
metadata: MetadataParam | Omit = omit,
|
|
56
|
+
stop_sequences: SequenceNotStr[str] | Omit = omit,
|
|
57
|
+
stream: Literal[False] | Omit = omit,
|
|
58
|
+
temperature: float | Omit = omit,
|
|
59
|
+
top_k: int | Omit = omit,
|
|
60
|
+
top_p: float | Omit = omit,
|
|
61
|
+
betas: List[AnthropicBetaParam] | Omit = omit,
|
|
62
62
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
63
63
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
64
64
|
extra_headers: Headers | None = None,
|
|
65
65
|
extra_query: Query | None = None,
|
|
66
66
|
extra_body: Body | None = None,
|
|
67
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
67
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
68
68
|
) -> Completion:
|
|
69
69
|
"""[Legacy] Create a Text Completion.
|
|
70
70
|
|
|
@@ -160,18 +160,18 @@ class Completions(SyncAPIResource):
|
|
|
160
160
|
model: ModelParam,
|
|
161
161
|
prompt: str,
|
|
162
162
|
stream: Literal[True],
|
|
163
|
-
metadata: MetadataParam |
|
|
164
|
-
stop_sequences: SequenceNotStr[str] |
|
|
165
|
-
temperature: float |
|
|
166
|
-
top_k: int |
|
|
167
|
-
top_p: float |
|
|
168
|
-
betas: List[AnthropicBetaParam] |
|
|
163
|
+
metadata: MetadataParam | Omit = omit,
|
|
164
|
+
stop_sequences: SequenceNotStr[str] | Omit = omit,
|
|
165
|
+
temperature: float | Omit = omit,
|
|
166
|
+
top_k: int | Omit = omit,
|
|
167
|
+
top_p: float | Omit = omit,
|
|
168
|
+
betas: List[AnthropicBetaParam] | Omit = omit,
|
|
169
169
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
170
170
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
171
171
|
extra_headers: Headers | None = None,
|
|
172
172
|
extra_query: Query | None = None,
|
|
173
173
|
extra_body: Body | None = None,
|
|
174
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
174
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
175
175
|
) -> Stream[Completion]:
|
|
176
176
|
"""[Legacy] Create a Text Completion.
|
|
177
177
|
|
|
@@ -267,18 +267,18 @@ class Completions(SyncAPIResource):
|
|
|
267
267
|
model: ModelParam,
|
|
268
268
|
prompt: str,
|
|
269
269
|
stream: bool,
|
|
270
|
-
metadata: MetadataParam |
|
|
271
|
-
stop_sequences: SequenceNotStr[str] |
|
|
272
|
-
temperature: float |
|
|
273
|
-
top_k: int |
|
|
274
|
-
top_p: float |
|
|
275
|
-
betas: List[AnthropicBetaParam] |
|
|
270
|
+
metadata: MetadataParam | Omit = omit,
|
|
271
|
+
stop_sequences: SequenceNotStr[str] | Omit = omit,
|
|
272
|
+
temperature: float | Omit = omit,
|
|
273
|
+
top_k: int | Omit = omit,
|
|
274
|
+
top_p: float | Omit = omit,
|
|
275
|
+
betas: List[AnthropicBetaParam] | Omit = omit,
|
|
276
276
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
277
277
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
278
278
|
extra_headers: Headers | None = None,
|
|
279
279
|
extra_query: Query | None = None,
|
|
280
280
|
extra_body: Body | None = None,
|
|
281
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
281
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
282
282
|
) -> Completion | Stream[Completion]:
|
|
283
283
|
"""[Legacy] Create a Text Completion.
|
|
284
284
|
|
|
@@ -373,24 +373,24 @@ class Completions(SyncAPIResource):
|
|
|
373
373
|
max_tokens_to_sample: int,
|
|
374
374
|
model: ModelParam,
|
|
375
375
|
prompt: str,
|
|
376
|
-
metadata: MetadataParam |
|
|
377
|
-
stop_sequences: SequenceNotStr[str] |
|
|
378
|
-
stream: Literal[False] | Literal[True] |
|
|
379
|
-
temperature: float |
|
|
380
|
-
top_k: int |
|
|
381
|
-
top_p: float |
|
|
382
|
-
betas: List[AnthropicBetaParam] |
|
|
376
|
+
metadata: MetadataParam | Omit = omit,
|
|
377
|
+
stop_sequences: SequenceNotStr[str] | Omit = omit,
|
|
378
|
+
stream: Literal[False] | Literal[True] | Omit = omit,
|
|
379
|
+
temperature: float | Omit = omit,
|
|
380
|
+
top_k: int | Omit = omit,
|
|
381
|
+
top_p: float | Omit = omit,
|
|
382
|
+
betas: List[AnthropicBetaParam] | Omit = omit,
|
|
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,
|
|
386
386
|
extra_query: Query | None = None,
|
|
387
387
|
extra_body: Body | None = None,
|
|
388
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
388
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
389
389
|
) -> Completion | Stream[Completion]:
|
|
390
390
|
if not is_given(timeout) and self._client.timeout == DEFAULT_TIMEOUT:
|
|
391
391
|
timeout = 600
|
|
392
392
|
extra_headers = {
|
|
393
|
-
**strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else
|
|
393
|
+
**strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else omit}),
|
|
394
394
|
**(extra_headers or {}),
|
|
395
395
|
}
|
|
396
396
|
return self._post(
|
|
@@ -447,19 +447,19 @@ class AsyncCompletions(AsyncAPIResource):
|
|
|
447
447
|
max_tokens_to_sample: int,
|
|
448
448
|
model: ModelParam,
|
|
449
449
|
prompt: str,
|
|
450
|
-
metadata: MetadataParam |
|
|
451
|
-
stop_sequences: SequenceNotStr[str] |
|
|
452
|
-
stream: Literal[False] |
|
|
453
|
-
temperature: float |
|
|
454
|
-
top_k: int |
|
|
455
|
-
top_p: float |
|
|
456
|
-
betas: List[AnthropicBetaParam] |
|
|
450
|
+
metadata: MetadataParam | Omit = omit,
|
|
451
|
+
stop_sequences: SequenceNotStr[str] | Omit = omit,
|
|
452
|
+
stream: Literal[False] | Omit = omit,
|
|
453
|
+
temperature: float | Omit = omit,
|
|
454
|
+
top_k: int | Omit = omit,
|
|
455
|
+
top_p: float | Omit = omit,
|
|
456
|
+
betas: List[AnthropicBetaParam] | Omit = omit,
|
|
457
457
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
458
458
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
459
459
|
extra_headers: Headers | None = None,
|
|
460
460
|
extra_query: Query | None = None,
|
|
461
461
|
extra_body: Body | None = None,
|
|
462
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
462
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
463
463
|
) -> Completion:
|
|
464
464
|
"""[Legacy] Create a Text Completion.
|
|
465
465
|
|
|
@@ -555,18 +555,18 @@ class AsyncCompletions(AsyncAPIResource):
|
|
|
555
555
|
model: ModelParam,
|
|
556
556
|
prompt: str,
|
|
557
557
|
stream: Literal[True],
|
|
558
|
-
metadata: MetadataParam |
|
|
559
|
-
stop_sequences: SequenceNotStr[str] |
|
|
560
|
-
temperature: float |
|
|
561
|
-
top_k: int |
|
|
562
|
-
top_p: float |
|
|
563
|
-
betas: List[AnthropicBetaParam] |
|
|
558
|
+
metadata: MetadataParam | Omit = omit,
|
|
559
|
+
stop_sequences: SequenceNotStr[str] | Omit = omit,
|
|
560
|
+
temperature: float | Omit = omit,
|
|
561
|
+
top_k: int | Omit = omit,
|
|
562
|
+
top_p: float | Omit = omit,
|
|
563
|
+
betas: List[AnthropicBetaParam] | Omit = omit,
|
|
564
564
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
565
565
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
566
566
|
extra_headers: Headers | None = None,
|
|
567
567
|
extra_query: Query | None = None,
|
|
568
568
|
extra_body: Body | None = None,
|
|
569
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
569
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
570
570
|
) -> AsyncStream[Completion]:
|
|
571
571
|
"""[Legacy] Create a Text Completion.
|
|
572
572
|
|
|
@@ -662,18 +662,18 @@ class AsyncCompletions(AsyncAPIResource):
|
|
|
662
662
|
model: ModelParam,
|
|
663
663
|
prompt: str,
|
|
664
664
|
stream: bool,
|
|
665
|
-
metadata: MetadataParam |
|
|
666
|
-
stop_sequences: SequenceNotStr[str] |
|
|
667
|
-
temperature: float |
|
|
668
|
-
top_k: int |
|
|
669
|
-
top_p: float |
|
|
670
|
-
betas: List[AnthropicBetaParam] |
|
|
665
|
+
metadata: MetadataParam | Omit = omit,
|
|
666
|
+
stop_sequences: SequenceNotStr[str] | Omit = omit,
|
|
667
|
+
temperature: float | Omit = omit,
|
|
668
|
+
top_k: int | Omit = omit,
|
|
669
|
+
top_p: float | Omit = omit,
|
|
670
|
+
betas: List[AnthropicBetaParam] | Omit = omit,
|
|
671
671
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
672
672
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
673
673
|
extra_headers: Headers | None = None,
|
|
674
674
|
extra_query: Query | None = None,
|
|
675
675
|
extra_body: Body | None = None,
|
|
676
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
676
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
677
677
|
) -> Completion | AsyncStream[Completion]:
|
|
678
678
|
"""[Legacy] Create a Text Completion.
|
|
679
679
|
|
|
@@ -768,24 +768,24 @@ class AsyncCompletions(AsyncAPIResource):
|
|
|
768
768
|
max_tokens_to_sample: int,
|
|
769
769
|
model: ModelParam,
|
|
770
770
|
prompt: str,
|
|
771
|
-
metadata: MetadataParam |
|
|
772
|
-
stop_sequences: SequenceNotStr[str] |
|
|
773
|
-
stream: Literal[False] | Literal[True] |
|
|
774
|
-
temperature: float |
|
|
775
|
-
top_k: int |
|
|
776
|
-
top_p: float |
|
|
777
|
-
betas: List[AnthropicBetaParam] |
|
|
771
|
+
metadata: MetadataParam | Omit = omit,
|
|
772
|
+
stop_sequences: SequenceNotStr[str] | Omit = omit,
|
|
773
|
+
stream: Literal[False] | Literal[True] | Omit = omit,
|
|
774
|
+
temperature: float | Omit = omit,
|
|
775
|
+
top_k: int | Omit = omit,
|
|
776
|
+
top_p: float | Omit = omit,
|
|
777
|
+
betas: List[AnthropicBetaParam] | Omit = omit,
|
|
778
778
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
779
779
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
780
780
|
extra_headers: Headers | None = None,
|
|
781
781
|
extra_query: Query | None = None,
|
|
782
782
|
extra_body: Body | None = None,
|
|
783
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
783
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
784
784
|
) -> Completion | AsyncStream[Completion]:
|
|
785
785
|
if not is_given(timeout) and self._client.timeout == DEFAULT_TIMEOUT:
|
|
786
786
|
timeout = 600
|
|
787
787
|
extra_headers = {
|
|
788
|
-
**strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else
|
|
788
|
+
**strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else omit}),
|
|
789
789
|
**(extra_headers or {}),
|
|
790
790
|
}
|
|
791
791
|
return await self._post(
|
|
@@ -7,7 +7,7 @@ from typing import Iterable
|
|
|
7
7
|
import httpx
|
|
8
8
|
|
|
9
9
|
from ... import _legacy_response
|
|
10
|
-
from ..._types import
|
|
10
|
+
from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
|
|
11
11
|
from ..._utils import maybe_transform, async_maybe_transform
|
|
12
12
|
from ..._compat import cached_property
|
|
13
13
|
from ..._resource import SyncAPIResource, AsyncAPIResource
|
|
@@ -53,7 +53,7 @@ class Batches(SyncAPIResource):
|
|
|
53
53
|
extra_headers: Headers | None = None,
|
|
54
54
|
extra_query: Query | None = None,
|
|
55
55
|
extra_body: Body | None = None,
|
|
56
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
56
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
57
57
|
) -> MessageBatch:
|
|
58
58
|
"""
|
|
59
59
|
Send a batch of Message creation requests.
|
|
@@ -95,7 +95,7 @@ class Batches(SyncAPIResource):
|
|
|
95
95
|
extra_headers: Headers | None = None,
|
|
96
96
|
extra_query: Query | None = None,
|
|
97
97
|
extra_body: Body | None = None,
|
|
98
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
98
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
99
99
|
) -> MessageBatch:
|
|
100
100
|
"""This endpoint is idempotent and can be used to poll for Message Batch
|
|
101
101
|
completion.
|
|
@@ -130,15 +130,15 @@ class Batches(SyncAPIResource):
|
|
|
130
130
|
def list(
|
|
131
131
|
self,
|
|
132
132
|
*,
|
|
133
|
-
after_id: str |
|
|
134
|
-
before_id: str |
|
|
135
|
-
limit: int |
|
|
133
|
+
after_id: str | Omit = omit,
|
|
134
|
+
before_id: str | Omit = omit,
|
|
135
|
+
limit: int | Omit = omit,
|
|
136
136
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
137
137
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
138
138
|
extra_headers: Headers | None = None,
|
|
139
139
|
extra_query: Query | None = None,
|
|
140
140
|
extra_body: Body | None = None,
|
|
141
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
141
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
142
142
|
) -> SyncPage[MessageBatch]:
|
|
143
143
|
"""List all Message Batches within a Workspace.
|
|
144
144
|
|
|
@@ -196,7 +196,7 @@ class Batches(SyncAPIResource):
|
|
|
196
196
|
extra_headers: Headers | None = None,
|
|
197
197
|
extra_query: Query | None = None,
|
|
198
198
|
extra_body: Body | None = None,
|
|
199
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
199
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
200
200
|
) -> DeletedMessageBatch:
|
|
201
201
|
"""
|
|
202
202
|
Delete a Message Batch.
|
|
@@ -237,7 +237,7 @@ class Batches(SyncAPIResource):
|
|
|
237
237
|
extra_headers: Headers | None = None,
|
|
238
238
|
extra_query: Query | None = None,
|
|
239
239
|
extra_body: Body | None = None,
|
|
240
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
240
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
241
241
|
) -> MessageBatch:
|
|
242
242
|
"""Batches may be canceled any time before processing ends.
|
|
243
243
|
|
|
@@ -284,7 +284,7 @@ class Batches(SyncAPIResource):
|
|
|
284
284
|
extra_headers: Headers | None = None,
|
|
285
285
|
extra_query: Query | None = None,
|
|
286
286
|
extra_body: Body | None = None,
|
|
287
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
287
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
288
288
|
) -> JSONLDecoder[MessageBatchIndividualResponse]:
|
|
289
289
|
"""
|
|
290
290
|
Streams the results of a Message Batch as a `.jsonl` file.
|
|
@@ -356,7 +356,7 @@ class AsyncBatches(AsyncAPIResource):
|
|
|
356
356
|
extra_headers: Headers | None = None,
|
|
357
357
|
extra_query: Query | None = None,
|
|
358
358
|
extra_body: Body | None = None,
|
|
359
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
359
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
360
360
|
) -> MessageBatch:
|
|
361
361
|
"""
|
|
362
362
|
Send a batch of Message creation requests.
|
|
@@ -398,7 +398,7 @@ class AsyncBatches(AsyncAPIResource):
|
|
|
398
398
|
extra_headers: Headers | None = None,
|
|
399
399
|
extra_query: Query | None = None,
|
|
400
400
|
extra_body: Body | None = None,
|
|
401
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
401
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
402
402
|
) -> MessageBatch:
|
|
403
403
|
"""This endpoint is idempotent and can be used to poll for Message Batch
|
|
404
404
|
completion.
|
|
@@ -433,15 +433,15 @@ class AsyncBatches(AsyncAPIResource):
|
|
|
433
433
|
def list(
|
|
434
434
|
self,
|
|
435
435
|
*,
|
|
436
|
-
after_id: str |
|
|
437
|
-
before_id: str |
|
|
438
|
-
limit: int |
|
|
436
|
+
after_id: str | Omit = omit,
|
|
437
|
+
before_id: str | Omit = omit,
|
|
438
|
+
limit: int | Omit = omit,
|
|
439
439
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
440
440
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
441
441
|
extra_headers: Headers | None = None,
|
|
442
442
|
extra_query: Query | None = None,
|
|
443
443
|
extra_body: Body | None = None,
|
|
444
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
444
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
445
445
|
) -> AsyncPaginator[MessageBatch, AsyncPage[MessageBatch]]:
|
|
446
446
|
"""List all Message Batches within a Workspace.
|
|
447
447
|
|
|
@@ -499,7 +499,7 @@ class AsyncBatches(AsyncAPIResource):
|
|
|
499
499
|
extra_headers: Headers | None = None,
|
|
500
500
|
extra_query: Query | None = None,
|
|
501
501
|
extra_body: Body | None = None,
|
|
502
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
502
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
503
503
|
) -> DeletedMessageBatch:
|
|
504
504
|
"""
|
|
505
505
|
Delete a Message Batch.
|
|
@@ -540,7 +540,7 @@ class AsyncBatches(AsyncAPIResource):
|
|
|
540
540
|
extra_headers: Headers | None = None,
|
|
541
541
|
extra_query: Query | None = None,
|
|
542
542
|
extra_body: Body | None = None,
|
|
543
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
543
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
544
544
|
) -> MessageBatch:
|
|
545
545
|
"""Batches may be canceled any time before processing ends.
|
|
546
546
|
|
|
@@ -587,7 +587,7 @@ class AsyncBatches(AsyncAPIResource):
|
|
|
587
587
|
extra_headers: Headers | None = None,
|
|
588
588
|
extra_query: Query | None = None,
|
|
589
589
|
extra_body: Body | None = None,
|
|
590
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
590
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
591
591
|
) -> AsyncJSONLDecoder[MessageBatchIndividualResponse]:
|
|
592
592
|
"""
|
|
593
593
|
Streams the results of a Message Batch as a `.jsonl` file.
|