anthropic 0.70.0__py3-none-any.whl → 0.71.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/_base_client.py +6 -2
- anthropic/_version.py +1 -1
- anthropic/lib/__init__.py +1 -0
- anthropic/lib/_files.py +42 -0
- anthropic/pagination.py +117 -1
- anthropic/resources/beta/__init__.py +14 -0
- anthropic/resources/beta/beta.py +32 -0
- anthropic/resources/beta/messages/messages.py +140 -122
- anthropic/resources/beta/skills/__init__.py +33 -0
- anthropic/resources/beta/skills/skills.py +680 -0
- anthropic/resources/beta/skills/versions.py +658 -0
- anthropic/resources/completions.py +36 -42
- anthropic/resources/messages/messages.py +92 -98
- anthropic/types/anthropic_beta_param.py +1 -0
- anthropic/types/beta/__init__.py +9 -0
- anthropic/types/beta/beta_container.py +5 -0
- anthropic/types/beta/beta_container_params.py +18 -0
- anthropic/types/beta/beta_message.py +4 -1
- anthropic/types/beta/beta_raw_message_delta_event.py +1 -1
- anthropic/types/beta/beta_skill.py +18 -0
- anthropic/types/beta/beta_skill_params.py +18 -0
- anthropic/types/beta/beta_thinking_config_enabled_param.py +1 -1
- anthropic/types/beta/message_count_tokens_params.py +14 -10
- anthropic/types/beta/message_create_params.py +25 -19
- anthropic/types/beta/messages/batch_create_params.py +1 -0
- anthropic/types/beta/skill_create_params.py +31 -0
- anthropic/types/beta/skill_create_response.py +49 -0
- anthropic/types/beta/skill_delete_response.py +19 -0
- anthropic/types/beta/skill_list_params.py +38 -0
- anthropic/types/beta/skill_list_response.py +49 -0
- anthropic/types/beta/skill_retrieve_response.py +49 -0
- anthropic/types/beta/skills/__init__.py +10 -0
- anthropic/types/beta/skills/version_create_params.py +24 -0
- anthropic/types/beta/skills/version_create_response.py +49 -0
- anthropic/types/beta/skills/version_delete_response.py +19 -0
- anthropic/types/beta/skills/version_list_params.py +25 -0
- anthropic/types/beta/skills/version_list_response.py +49 -0
- anthropic/types/beta/skills/version_retrieve_response.py +49 -0
- anthropic/types/completion_create_params.py +5 -6
- anthropic/types/message_count_tokens_params.py +9 -9
- anthropic/types/message_create_params.py +13 -15
- anthropic/types/messages/batch_create_params.py +1 -0
- anthropic/types/model.py +0 -3
- anthropic/types/model_param.py +0 -3
- anthropic/types/stop_reason.py +1 -3
- anthropic/types/thinking_config_enabled_param.py +1 -1
- {anthropic-0.70.0.dist-info → anthropic-0.71.1.dist-info}/METADATA +2 -2
- {anthropic-0.70.0.dist-info → anthropic-0.71.1.dist-info}/RECORD +50 -30
- {anthropic-0.70.0.dist-info → anthropic-0.71.1.dist-info}/WHEEL +0 -0
- {anthropic-0.70.0.dist-info → anthropic-0.71.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,658 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import List, Mapping, Optional, cast
|
|
6
|
+
from itertools import chain
|
|
7
|
+
|
|
8
|
+
import httpx
|
|
9
|
+
|
|
10
|
+
from .... import _legacy_response
|
|
11
|
+
from ...._types import (
|
|
12
|
+
Body,
|
|
13
|
+
Omit,
|
|
14
|
+
Query,
|
|
15
|
+
Headers,
|
|
16
|
+
NotGiven,
|
|
17
|
+
FileTypes,
|
|
18
|
+
SequenceNotStr,
|
|
19
|
+
omit,
|
|
20
|
+
not_given,
|
|
21
|
+
)
|
|
22
|
+
from ...._utils import (
|
|
23
|
+
is_given,
|
|
24
|
+
extract_files,
|
|
25
|
+
maybe_transform,
|
|
26
|
+
strip_not_given,
|
|
27
|
+
deepcopy_minimal,
|
|
28
|
+
async_maybe_transform,
|
|
29
|
+
)
|
|
30
|
+
from ...._compat import cached_property
|
|
31
|
+
from ...._resource import SyncAPIResource, AsyncAPIResource
|
|
32
|
+
from ...._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper
|
|
33
|
+
from ....pagination import SyncPageCursor, AsyncPageCursor
|
|
34
|
+
from ...._base_client import AsyncPaginator, make_request_options
|
|
35
|
+
from ....types.beta.skills import version_list_params, version_create_params
|
|
36
|
+
from ....types.anthropic_beta_param import AnthropicBetaParam
|
|
37
|
+
from ....types.beta.skills.version_list_response import VersionListResponse
|
|
38
|
+
from ....types.beta.skills.version_create_response import VersionCreateResponse
|
|
39
|
+
from ....types.beta.skills.version_delete_response import VersionDeleteResponse
|
|
40
|
+
from ....types.beta.skills.version_retrieve_response import VersionRetrieveResponse
|
|
41
|
+
|
|
42
|
+
__all__ = ["Versions", "AsyncVersions"]
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class Versions(SyncAPIResource):
|
|
46
|
+
@cached_property
|
|
47
|
+
def with_raw_response(self) -> VersionsWithRawResponse:
|
|
48
|
+
"""
|
|
49
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
50
|
+
the raw response object instead of the parsed content.
|
|
51
|
+
|
|
52
|
+
For more information, see https://www.github.com/anthropics/anthropic-sdk-python#accessing-raw-response-data-eg-headers
|
|
53
|
+
"""
|
|
54
|
+
return VersionsWithRawResponse(self)
|
|
55
|
+
|
|
56
|
+
@cached_property
|
|
57
|
+
def with_streaming_response(self) -> VersionsWithStreamingResponse:
|
|
58
|
+
"""
|
|
59
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
60
|
+
|
|
61
|
+
For more information, see https://www.github.com/anthropics/anthropic-sdk-python#with_streaming_response
|
|
62
|
+
"""
|
|
63
|
+
return VersionsWithStreamingResponse(self)
|
|
64
|
+
|
|
65
|
+
def create(
|
|
66
|
+
self,
|
|
67
|
+
skill_id: str,
|
|
68
|
+
*,
|
|
69
|
+
files: Optional[SequenceNotStr[FileTypes]] | Omit = omit,
|
|
70
|
+
betas: List[AnthropicBetaParam] | Omit = omit,
|
|
71
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
72
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
73
|
+
extra_headers: Headers | None = None,
|
|
74
|
+
extra_query: Query | None = None,
|
|
75
|
+
extra_body: Body | None = None,
|
|
76
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
77
|
+
) -> VersionCreateResponse:
|
|
78
|
+
"""
|
|
79
|
+
Create Skill Version
|
|
80
|
+
|
|
81
|
+
Args:
|
|
82
|
+
skill_id: Unique identifier for the skill.
|
|
83
|
+
|
|
84
|
+
The format and length of IDs may change over time.
|
|
85
|
+
|
|
86
|
+
files: Files to upload for the skill.
|
|
87
|
+
|
|
88
|
+
All files must be in the same top-level directory and must include a SKILL.md
|
|
89
|
+
file at the root of that directory.
|
|
90
|
+
|
|
91
|
+
betas: Optional header to specify the beta version(s) you want to use.
|
|
92
|
+
|
|
93
|
+
extra_headers: Send extra headers
|
|
94
|
+
|
|
95
|
+
extra_query: Add additional query parameters to the request
|
|
96
|
+
|
|
97
|
+
extra_body: Add additional JSON properties to the request
|
|
98
|
+
|
|
99
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
100
|
+
"""
|
|
101
|
+
if not skill_id:
|
|
102
|
+
raise ValueError(f"Expected a non-empty value for `skill_id` but received {skill_id!r}")
|
|
103
|
+
extra_headers = {
|
|
104
|
+
**strip_not_given(
|
|
105
|
+
{
|
|
106
|
+
"anthropic-beta": ",".join(chain((str(e) for e in betas), ["skills-2025-10-02"]))
|
|
107
|
+
if is_given(betas)
|
|
108
|
+
else not_given
|
|
109
|
+
}
|
|
110
|
+
),
|
|
111
|
+
**(extra_headers or {}),
|
|
112
|
+
}
|
|
113
|
+
extra_headers = {"anthropic-beta": "skills-2025-10-02", **(extra_headers or {})}
|
|
114
|
+
body = deepcopy_minimal({"files": files})
|
|
115
|
+
extracted_files = extract_files(cast(Mapping[str, object], body), paths=[["files", "<array>"]])
|
|
116
|
+
# It should be noted that the actual Content-Type header that will be
|
|
117
|
+
# sent to the server will contain a `boundary` parameter, e.g.
|
|
118
|
+
# multipart/form-data; boundary=---abc--
|
|
119
|
+
extra_headers["Content-Type"] = "multipart/form-data"
|
|
120
|
+
return self._post(
|
|
121
|
+
f"/v1/skills/{skill_id}/versions?beta=true",
|
|
122
|
+
body=maybe_transform(body, version_create_params.VersionCreateParams),
|
|
123
|
+
files=extracted_files,
|
|
124
|
+
options=make_request_options(
|
|
125
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
126
|
+
),
|
|
127
|
+
cast_to=VersionCreateResponse,
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
def retrieve(
|
|
131
|
+
self,
|
|
132
|
+
version: str,
|
|
133
|
+
*,
|
|
134
|
+
skill_id: str,
|
|
135
|
+
betas: List[AnthropicBetaParam] | Omit = omit,
|
|
136
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
137
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
138
|
+
extra_headers: Headers | None = None,
|
|
139
|
+
extra_query: Query | None = None,
|
|
140
|
+
extra_body: Body | None = None,
|
|
141
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
142
|
+
) -> VersionRetrieveResponse:
|
|
143
|
+
"""
|
|
144
|
+
Get Skill Version
|
|
145
|
+
|
|
146
|
+
Args:
|
|
147
|
+
skill_id: Unique identifier for the skill.
|
|
148
|
+
|
|
149
|
+
The format and length of IDs may change over time.
|
|
150
|
+
|
|
151
|
+
version: Version identifier for the skill.
|
|
152
|
+
|
|
153
|
+
Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129").
|
|
154
|
+
|
|
155
|
+
betas: Optional header to specify the beta version(s) you want to use.
|
|
156
|
+
|
|
157
|
+
extra_headers: Send extra headers
|
|
158
|
+
|
|
159
|
+
extra_query: Add additional query parameters to the request
|
|
160
|
+
|
|
161
|
+
extra_body: Add additional JSON properties to the request
|
|
162
|
+
|
|
163
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
164
|
+
"""
|
|
165
|
+
if not skill_id:
|
|
166
|
+
raise ValueError(f"Expected a non-empty value for `skill_id` but received {skill_id!r}")
|
|
167
|
+
if not version:
|
|
168
|
+
raise ValueError(f"Expected a non-empty value for `version` but received {version!r}")
|
|
169
|
+
extra_headers = {
|
|
170
|
+
**strip_not_given(
|
|
171
|
+
{
|
|
172
|
+
"anthropic-beta": ",".join(chain((str(e) for e in betas), ["skills-2025-10-02"]))
|
|
173
|
+
if is_given(betas)
|
|
174
|
+
else not_given
|
|
175
|
+
}
|
|
176
|
+
),
|
|
177
|
+
**(extra_headers or {}),
|
|
178
|
+
}
|
|
179
|
+
extra_headers = {"anthropic-beta": "skills-2025-10-02", **(extra_headers or {})}
|
|
180
|
+
return self._get(
|
|
181
|
+
f"/v1/skills/{skill_id}/versions/{version}?beta=true",
|
|
182
|
+
options=make_request_options(
|
|
183
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
184
|
+
),
|
|
185
|
+
cast_to=VersionRetrieveResponse,
|
|
186
|
+
)
|
|
187
|
+
|
|
188
|
+
def list(
|
|
189
|
+
self,
|
|
190
|
+
skill_id: str,
|
|
191
|
+
*,
|
|
192
|
+
limit: Optional[int] | Omit = omit,
|
|
193
|
+
page: Optional[str] | Omit = omit,
|
|
194
|
+
betas: List[AnthropicBetaParam] | Omit = omit,
|
|
195
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
196
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
197
|
+
extra_headers: Headers | None = None,
|
|
198
|
+
extra_query: Query | None = None,
|
|
199
|
+
extra_body: Body | None = None,
|
|
200
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
201
|
+
) -> SyncPageCursor[VersionListResponse]:
|
|
202
|
+
"""
|
|
203
|
+
List Skill Versions
|
|
204
|
+
|
|
205
|
+
Args:
|
|
206
|
+
skill_id: Unique identifier for the skill.
|
|
207
|
+
|
|
208
|
+
The format and length of IDs may change over time.
|
|
209
|
+
|
|
210
|
+
limit: Number of items to return per page.
|
|
211
|
+
|
|
212
|
+
Defaults to `20`. Ranges from `1` to `1000`.
|
|
213
|
+
|
|
214
|
+
page: Optionally set to the `next_page` token from the previous response.
|
|
215
|
+
|
|
216
|
+
betas: Optional header to specify the beta version(s) you want to use.
|
|
217
|
+
|
|
218
|
+
extra_headers: Send extra headers
|
|
219
|
+
|
|
220
|
+
extra_query: Add additional query parameters to the request
|
|
221
|
+
|
|
222
|
+
extra_body: Add additional JSON properties to the request
|
|
223
|
+
|
|
224
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
225
|
+
"""
|
|
226
|
+
if not skill_id:
|
|
227
|
+
raise ValueError(f"Expected a non-empty value for `skill_id` but received {skill_id!r}")
|
|
228
|
+
extra_headers = {
|
|
229
|
+
**strip_not_given(
|
|
230
|
+
{
|
|
231
|
+
"anthropic-beta": ",".join(chain((str(e) for e in betas), ["skills-2025-10-02"]))
|
|
232
|
+
if is_given(betas)
|
|
233
|
+
else not_given
|
|
234
|
+
}
|
|
235
|
+
),
|
|
236
|
+
**(extra_headers or {}),
|
|
237
|
+
}
|
|
238
|
+
extra_headers = {"anthropic-beta": "skills-2025-10-02", **(extra_headers or {})}
|
|
239
|
+
return self._get_api_list(
|
|
240
|
+
f"/v1/skills/{skill_id}/versions?beta=true",
|
|
241
|
+
page=SyncPageCursor[VersionListResponse],
|
|
242
|
+
options=make_request_options(
|
|
243
|
+
extra_headers=extra_headers,
|
|
244
|
+
extra_query=extra_query,
|
|
245
|
+
extra_body=extra_body,
|
|
246
|
+
timeout=timeout,
|
|
247
|
+
query=maybe_transform(
|
|
248
|
+
{
|
|
249
|
+
"limit": limit,
|
|
250
|
+
"page": page,
|
|
251
|
+
},
|
|
252
|
+
version_list_params.VersionListParams,
|
|
253
|
+
),
|
|
254
|
+
),
|
|
255
|
+
model=VersionListResponse,
|
|
256
|
+
)
|
|
257
|
+
|
|
258
|
+
def delete(
|
|
259
|
+
self,
|
|
260
|
+
version: str,
|
|
261
|
+
*,
|
|
262
|
+
skill_id: str,
|
|
263
|
+
betas: List[AnthropicBetaParam] | Omit = omit,
|
|
264
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
265
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
266
|
+
extra_headers: Headers | None = None,
|
|
267
|
+
extra_query: Query | None = None,
|
|
268
|
+
extra_body: Body | None = None,
|
|
269
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
270
|
+
) -> VersionDeleteResponse:
|
|
271
|
+
"""
|
|
272
|
+
Delete Skill Version
|
|
273
|
+
|
|
274
|
+
Args:
|
|
275
|
+
skill_id: Unique identifier for the skill.
|
|
276
|
+
|
|
277
|
+
The format and length of IDs may change over time.
|
|
278
|
+
|
|
279
|
+
version: Version identifier for the skill.
|
|
280
|
+
|
|
281
|
+
Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129").
|
|
282
|
+
|
|
283
|
+
betas: Optional header to specify the beta version(s) you want to use.
|
|
284
|
+
|
|
285
|
+
extra_headers: Send extra headers
|
|
286
|
+
|
|
287
|
+
extra_query: Add additional query parameters to the request
|
|
288
|
+
|
|
289
|
+
extra_body: Add additional JSON properties to the request
|
|
290
|
+
|
|
291
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
292
|
+
"""
|
|
293
|
+
if not skill_id:
|
|
294
|
+
raise ValueError(f"Expected a non-empty value for `skill_id` but received {skill_id!r}")
|
|
295
|
+
if not version:
|
|
296
|
+
raise ValueError(f"Expected a non-empty value for `version` but received {version!r}")
|
|
297
|
+
extra_headers = {
|
|
298
|
+
**strip_not_given(
|
|
299
|
+
{
|
|
300
|
+
"anthropic-beta": ",".join(chain((str(e) for e in betas), ["skills-2025-10-02"]))
|
|
301
|
+
if is_given(betas)
|
|
302
|
+
else not_given
|
|
303
|
+
}
|
|
304
|
+
),
|
|
305
|
+
**(extra_headers or {}),
|
|
306
|
+
}
|
|
307
|
+
extra_headers = {"anthropic-beta": "skills-2025-10-02", **(extra_headers or {})}
|
|
308
|
+
return self._delete(
|
|
309
|
+
f"/v1/skills/{skill_id}/versions/{version}?beta=true",
|
|
310
|
+
options=make_request_options(
|
|
311
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
312
|
+
),
|
|
313
|
+
cast_to=VersionDeleteResponse,
|
|
314
|
+
)
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
class AsyncVersions(AsyncAPIResource):
|
|
318
|
+
@cached_property
|
|
319
|
+
def with_raw_response(self) -> AsyncVersionsWithRawResponse:
|
|
320
|
+
"""
|
|
321
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
322
|
+
the raw response object instead of the parsed content.
|
|
323
|
+
|
|
324
|
+
For more information, see https://www.github.com/anthropics/anthropic-sdk-python#accessing-raw-response-data-eg-headers
|
|
325
|
+
"""
|
|
326
|
+
return AsyncVersionsWithRawResponse(self)
|
|
327
|
+
|
|
328
|
+
@cached_property
|
|
329
|
+
def with_streaming_response(self) -> AsyncVersionsWithStreamingResponse:
|
|
330
|
+
"""
|
|
331
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
332
|
+
|
|
333
|
+
For more information, see https://www.github.com/anthropics/anthropic-sdk-python#with_streaming_response
|
|
334
|
+
"""
|
|
335
|
+
return AsyncVersionsWithStreamingResponse(self)
|
|
336
|
+
|
|
337
|
+
async def create(
|
|
338
|
+
self,
|
|
339
|
+
skill_id: str,
|
|
340
|
+
*,
|
|
341
|
+
files: Optional[SequenceNotStr[FileTypes]] | Omit = omit,
|
|
342
|
+
betas: List[AnthropicBetaParam] | Omit = omit,
|
|
343
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
344
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
345
|
+
extra_headers: Headers | None = None,
|
|
346
|
+
extra_query: Query | None = None,
|
|
347
|
+
extra_body: Body | None = None,
|
|
348
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
349
|
+
) -> VersionCreateResponse:
|
|
350
|
+
"""
|
|
351
|
+
Create Skill Version
|
|
352
|
+
|
|
353
|
+
Args:
|
|
354
|
+
skill_id: Unique identifier for the skill.
|
|
355
|
+
|
|
356
|
+
The format and length of IDs may change over time.
|
|
357
|
+
|
|
358
|
+
files: Files to upload for the skill.
|
|
359
|
+
|
|
360
|
+
All files must be in the same top-level directory and must include a SKILL.md
|
|
361
|
+
file at the root of that directory.
|
|
362
|
+
|
|
363
|
+
betas: Optional header to specify the beta version(s) you want to use.
|
|
364
|
+
|
|
365
|
+
extra_headers: Send extra headers
|
|
366
|
+
|
|
367
|
+
extra_query: Add additional query parameters to the request
|
|
368
|
+
|
|
369
|
+
extra_body: Add additional JSON properties to the request
|
|
370
|
+
|
|
371
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
372
|
+
"""
|
|
373
|
+
if not skill_id:
|
|
374
|
+
raise ValueError(f"Expected a non-empty value for `skill_id` but received {skill_id!r}")
|
|
375
|
+
extra_headers = {
|
|
376
|
+
**strip_not_given(
|
|
377
|
+
{
|
|
378
|
+
"anthropic-beta": ",".join(chain((str(e) for e in betas), ["skills-2025-10-02"]))
|
|
379
|
+
if is_given(betas)
|
|
380
|
+
else not_given
|
|
381
|
+
}
|
|
382
|
+
),
|
|
383
|
+
**(extra_headers or {}),
|
|
384
|
+
}
|
|
385
|
+
extra_headers = {"anthropic-beta": "skills-2025-10-02", **(extra_headers or {})}
|
|
386
|
+
body = deepcopy_minimal({"files": files})
|
|
387
|
+
extracted_files = extract_files(cast(Mapping[str, object], body), paths=[["files", "<array>"]])
|
|
388
|
+
# It should be noted that the actual Content-Type header that will be
|
|
389
|
+
# sent to the server will contain a `boundary` parameter, e.g.
|
|
390
|
+
# multipart/form-data; boundary=---abc--
|
|
391
|
+
extra_headers["Content-Type"] = "multipart/form-data"
|
|
392
|
+
return await self._post(
|
|
393
|
+
f"/v1/skills/{skill_id}/versions?beta=true",
|
|
394
|
+
body=await async_maybe_transform(body, version_create_params.VersionCreateParams),
|
|
395
|
+
files=extracted_files,
|
|
396
|
+
options=make_request_options(
|
|
397
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
398
|
+
),
|
|
399
|
+
cast_to=VersionCreateResponse,
|
|
400
|
+
)
|
|
401
|
+
|
|
402
|
+
async def retrieve(
|
|
403
|
+
self,
|
|
404
|
+
version: str,
|
|
405
|
+
*,
|
|
406
|
+
skill_id: str,
|
|
407
|
+
betas: List[AnthropicBetaParam] | Omit = omit,
|
|
408
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
409
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
410
|
+
extra_headers: Headers | None = None,
|
|
411
|
+
extra_query: Query | None = None,
|
|
412
|
+
extra_body: Body | None = None,
|
|
413
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
414
|
+
) -> VersionRetrieveResponse:
|
|
415
|
+
"""
|
|
416
|
+
Get Skill Version
|
|
417
|
+
|
|
418
|
+
Args:
|
|
419
|
+
skill_id: Unique identifier for the skill.
|
|
420
|
+
|
|
421
|
+
The format and length of IDs may change over time.
|
|
422
|
+
|
|
423
|
+
version: Version identifier for the skill.
|
|
424
|
+
|
|
425
|
+
Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129").
|
|
426
|
+
|
|
427
|
+
betas: Optional header to specify the beta version(s) you want to use.
|
|
428
|
+
|
|
429
|
+
extra_headers: Send extra headers
|
|
430
|
+
|
|
431
|
+
extra_query: Add additional query parameters to the request
|
|
432
|
+
|
|
433
|
+
extra_body: Add additional JSON properties to the request
|
|
434
|
+
|
|
435
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
436
|
+
"""
|
|
437
|
+
if not skill_id:
|
|
438
|
+
raise ValueError(f"Expected a non-empty value for `skill_id` but received {skill_id!r}")
|
|
439
|
+
if not version:
|
|
440
|
+
raise ValueError(f"Expected a non-empty value for `version` but received {version!r}")
|
|
441
|
+
extra_headers = {
|
|
442
|
+
**strip_not_given(
|
|
443
|
+
{
|
|
444
|
+
"anthropic-beta": ",".join(chain((str(e) for e in betas), ["skills-2025-10-02"]))
|
|
445
|
+
if is_given(betas)
|
|
446
|
+
else not_given
|
|
447
|
+
}
|
|
448
|
+
),
|
|
449
|
+
**(extra_headers or {}),
|
|
450
|
+
}
|
|
451
|
+
extra_headers = {"anthropic-beta": "skills-2025-10-02", **(extra_headers or {})}
|
|
452
|
+
return await self._get(
|
|
453
|
+
f"/v1/skills/{skill_id}/versions/{version}?beta=true",
|
|
454
|
+
options=make_request_options(
|
|
455
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
456
|
+
),
|
|
457
|
+
cast_to=VersionRetrieveResponse,
|
|
458
|
+
)
|
|
459
|
+
|
|
460
|
+
def list(
|
|
461
|
+
self,
|
|
462
|
+
skill_id: str,
|
|
463
|
+
*,
|
|
464
|
+
limit: Optional[int] | Omit = omit,
|
|
465
|
+
page: Optional[str] | Omit = omit,
|
|
466
|
+
betas: List[AnthropicBetaParam] | Omit = omit,
|
|
467
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
468
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
469
|
+
extra_headers: Headers | None = None,
|
|
470
|
+
extra_query: Query | None = None,
|
|
471
|
+
extra_body: Body | None = None,
|
|
472
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
473
|
+
) -> AsyncPaginator[VersionListResponse, AsyncPageCursor[VersionListResponse]]:
|
|
474
|
+
"""
|
|
475
|
+
List Skill Versions
|
|
476
|
+
|
|
477
|
+
Args:
|
|
478
|
+
skill_id: Unique identifier for the skill.
|
|
479
|
+
|
|
480
|
+
The format and length of IDs may change over time.
|
|
481
|
+
|
|
482
|
+
limit: Number of items to return per page.
|
|
483
|
+
|
|
484
|
+
Defaults to `20`. Ranges from `1` to `1000`.
|
|
485
|
+
|
|
486
|
+
page: Optionally set to the `next_page` token from the previous response.
|
|
487
|
+
|
|
488
|
+
betas: Optional header to specify the beta version(s) you want to use.
|
|
489
|
+
|
|
490
|
+
extra_headers: Send extra headers
|
|
491
|
+
|
|
492
|
+
extra_query: Add additional query parameters to the request
|
|
493
|
+
|
|
494
|
+
extra_body: Add additional JSON properties to the request
|
|
495
|
+
|
|
496
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
497
|
+
"""
|
|
498
|
+
if not skill_id:
|
|
499
|
+
raise ValueError(f"Expected a non-empty value for `skill_id` but received {skill_id!r}")
|
|
500
|
+
extra_headers = {
|
|
501
|
+
**strip_not_given(
|
|
502
|
+
{
|
|
503
|
+
"anthropic-beta": ",".join(chain((str(e) for e in betas), ["skills-2025-10-02"]))
|
|
504
|
+
if is_given(betas)
|
|
505
|
+
else not_given
|
|
506
|
+
}
|
|
507
|
+
),
|
|
508
|
+
**(extra_headers or {}),
|
|
509
|
+
}
|
|
510
|
+
extra_headers = {"anthropic-beta": "skills-2025-10-02", **(extra_headers or {})}
|
|
511
|
+
return self._get_api_list(
|
|
512
|
+
f"/v1/skills/{skill_id}/versions?beta=true",
|
|
513
|
+
page=AsyncPageCursor[VersionListResponse],
|
|
514
|
+
options=make_request_options(
|
|
515
|
+
extra_headers=extra_headers,
|
|
516
|
+
extra_query=extra_query,
|
|
517
|
+
extra_body=extra_body,
|
|
518
|
+
timeout=timeout,
|
|
519
|
+
query=maybe_transform(
|
|
520
|
+
{
|
|
521
|
+
"limit": limit,
|
|
522
|
+
"page": page,
|
|
523
|
+
},
|
|
524
|
+
version_list_params.VersionListParams,
|
|
525
|
+
),
|
|
526
|
+
),
|
|
527
|
+
model=VersionListResponse,
|
|
528
|
+
)
|
|
529
|
+
|
|
530
|
+
async def delete(
|
|
531
|
+
self,
|
|
532
|
+
version: str,
|
|
533
|
+
*,
|
|
534
|
+
skill_id: str,
|
|
535
|
+
betas: List[AnthropicBetaParam] | Omit = omit,
|
|
536
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
537
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
538
|
+
extra_headers: Headers | None = None,
|
|
539
|
+
extra_query: Query | None = None,
|
|
540
|
+
extra_body: Body | None = None,
|
|
541
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
542
|
+
) -> VersionDeleteResponse:
|
|
543
|
+
"""
|
|
544
|
+
Delete Skill Version
|
|
545
|
+
|
|
546
|
+
Args:
|
|
547
|
+
skill_id: Unique identifier for the skill.
|
|
548
|
+
|
|
549
|
+
The format and length of IDs may change over time.
|
|
550
|
+
|
|
551
|
+
version: Version identifier for the skill.
|
|
552
|
+
|
|
553
|
+
Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129").
|
|
554
|
+
|
|
555
|
+
betas: Optional header to specify the beta version(s) you want to use.
|
|
556
|
+
|
|
557
|
+
extra_headers: Send extra headers
|
|
558
|
+
|
|
559
|
+
extra_query: Add additional query parameters to the request
|
|
560
|
+
|
|
561
|
+
extra_body: Add additional JSON properties to the request
|
|
562
|
+
|
|
563
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
564
|
+
"""
|
|
565
|
+
if not skill_id:
|
|
566
|
+
raise ValueError(f"Expected a non-empty value for `skill_id` but received {skill_id!r}")
|
|
567
|
+
if not version:
|
|
568
|
+
raise ValueError(f"Expected a non-empty value for `version` but received {version!r}")
|
|
569
|
+
extra_headers = {
|
|
570
|
+
**strip_not_given(
|
|
571
|
+
{
|
|
572
|
+
"anthropic-beta": ",".join(chain((str(e) for e in betas), ["skills-2025-10-02"]))
|
|
573
|
+
if is_given(betas)
|
|
574
|
+
else not_given
|
|
575
|
+
}
|
|
576
|
+
),
|
|
577
|
+
**(extra_headers or {}),
|
|
578
|
+
}
|
|
579
|
+
extra_headers = {"anthropic-beta": "skills-2025-10-02", **(extra_headers or {})}
|
|
580
|
+
return await self._delete(
|
|
581
|
+
f"/v1/skills/{skill_id}/versions/{version}?beta=true",
|
|
582
|
+
options=make_request_options(
|
|
583
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
584
|
+
),
|
|
585
|
+
cast_to=VersionDeleteResponse,
|
|
586
|
+
)
|
|
587
|
+
|
|
588
|
+
|
|
589
|
+
class VersionsWithRawResponse:
|
|
590
|
+
def __init__(self, versions: Versions) -> None:
|
|
591
|
+
self._versions = versions
|
|
592
|
+
|
|
593
|
+
self.create = _legacy_response.to_raw_response_wrapper(
|
|
594
|
+
versions.create,
|
|
595
|
+
)
|
|
596
|
+
self.retrieve = _legacy_response.to_raw_response_wrapper(
|
|
597
|
+
versions.retrieve,
|
|
598
|
+
)
|
|
599
|
+
self.list = _legacy_response.to_raw_response_wrapper(
|
|
600
|
+
versions.list,
|
|
601
|
+
)
|
|
602
|
+
self.delete = _legacy_response.to_raw_response_wrapper(
|
|
603
|
+
versions.delete,
|
|
604
|
+
)
|
|
605
|
+
|
|
606
|
+
|
|
607
|
+
class AsyncVersionsWithRawResponse:
|
|
608
|
+
def __init__(self, versions: AsyncVersions) -> None:
|
|
609
|
+
self._versions = versions
|
|
610
|
+
|
|
611
|
+
self.create = _legacy_response.async_to_raw_response_wrapper(
|
|
612
|
+
versions.create,
|
|
613
|
+
)
|
|
614
|
+
self.retrieve = _legacy_response.async_to_raw_response_wrapper(
|
|
615
|
+
versions.retrieve,
|
|
616
|
+
)
|
|
617
|
+
self.list = _legacy_response.async_to_raw_response_wrapper(
|
|
618
|
+
versions.list,
|
|
619
|
+
)
|
|
620
|
+
self.delete = _legacy_response.async_to_raw_response_wrapper(
|
|
621
|
+
versions.delete,
|
|
622
|
+
)
|
|
623
|
+
|
|
624
|
+
|
|
625
|
+
class VersionsWithStreamingResponse:
|
|
626
|
+
def __init__(self, versions: Versions) -> None:
|
|
627
|
+
self._versions = versions
|
|
628
|
+
|
|
629
|
+
self.create = to_streamed_response_wrapper(
|
|
630
|
+
versions.create,
|
|
631
|
+
)
|
|
632
|
+
self.retrieve = to_streamed_response_wrapper(
|
|
633
|
+
versions.retrieve,
|
|
634
|
+
)
|
|
635
|
+
self.list = to_streamed_response_wrapper(
|
|
636
|
+
versions.list,
|
|
637
|
+
)
|
|
638
|
+
self.delete = to_streamed_response_wrapper(
|
|
639
|
+
versions.delete,
|
|
640
|
+
)
|
|
641
|
+
|
|
642
|
+
|
|
643
|
+
class AsyncVersionsWithStreamingResponse:
|
|
644
|
+
def __init__(self, versions: AsyncVersions) -> None:
|
|
645
|
+
self._versions = versions
|
|
646
|
+
|
|
647
|
+
self.create = async_to_streamed_response_wrapper(
|
|
648
|
+
versions.create,
|
|
649
|
+
)
|
|
650
|
+
self.retrieve = async_to_streamed_response_wrapper(
|
|
651
|
+
versions.retrieve,
|
|
652
|
+
)
|
|
653
|
+
self.list = async_to_streamed_response_wrapper(
|
|
654
|
+
versions.list,
|
|
655
|
+
)
|
|
656
|
+
self.delete = async_to_streamed_response_wrapper(
|
|
657
|
+
versions.delete,
|
|
658
|
+
)
|