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