anthropic 0.63.0__py3-none-any.whl → 0.65.0__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/_models.py +1 -1
- anthropic/_types.py +35 -1
- anthropic/_utils/__init__.py +1 -0
- anthropic/_utils/_transform.py +6 -0
- anthropic/_utils/_typing.py +5 -0
- anthropic/_version.py +1 -1
- anthropic/lib/streaming/_beta_messages.py +0 -1
- anthropic/resources/beta/messages/messages.py +19 -203
- anthropic/resources/completions.py +9 -9
- anthropic/resources/messages/messages.py +22 -204
- anthropic/types/__init__.py +1 -0
- anthropic/types/beta/__init__.py +53 -0
- anthropic/types/beta/beta_bash_code_execution_output_block.py +13 -0
- anthropic/types/beta/beta_bash_code_execution_output_block_param.py +13 -0
- anthropic/types/beta/beta_bash_code_execution_result_block.py +21 -0
- anthropic/types/beta/beta_bash_code_execution_result_block_param.py +22 -0
- anthropic/types/beta/beta_bash_code_execution_tool_result_block.py +20 -0
- anthropic/types/beta/beta_bash_code_execution_tool_result_block_param.py +25 -0
- anthropic/types/beta/beta_bash_code_execution_tool_result_error.py +15 -0
- anthropic/types/beta/beta_bash_code_execution_tool_result_error_param.py +17 -0
- anthropic/types/beta/beta_code_execution_tool_20250825_param.py +23 -0
- anthropic/types/beta/beta_content_block.py +4 -0
- anthropic/types/beta/beta_content_block_param.py +4 -0
- anthropic/types/beta/beta_raw_content_block_start_event.py +4 -0
- anthropic/types/beta/beta_request_mcp_server_tool_configuration_param.py +4 -2
- anthropic/types/beta/beta_server_tool_use_block.py +1 -1
- anthropic/types/beta/beta_server_tool_use_block_param.py +1 -1
- anthropic/types/beta/beta_text_editor_code_execution_create_result_block.py +13 -0
- anthropic/types/beta/beta_text_editor_code_execution_create_result_block_param.py +13 -0
- anthropic/types/beta/beta_text_editor_code_execution_str_replace_result_block.py +22 -0
- anthropic/types/beta/beta_text_editor_code_execution_str_replace_result_block_param.py +24 -0
- anthropic/types/beta/beta_text_editor_code_execution_tool_result_block.py +27 -0
- anthropic/types/beta/beta_text_editor_code_execution_tool_result_block_param.py +34 -0
- anthropic/types/beta/beta_text_editor_code_execution_tool_result_error.py +18 -0
- anthropic/types/beta/beta_text_editor_code_execution_tool_result_error_param.py +18 -0
- anthropic/types/beta/beta_text_editor_code_execution_view_result_block.py +22 -0
- anthropic/types/beta/beta_text_editor_code_execution_view_result_block_param.py +22 -0
- anthropic/types/beta/beta_tool_param.py +3 -2
- anthropic/types/beta/beta_tool_union_param.py +2 -0
- anthropic/types/beta/beta_web_search_tool_20250305_param.py +4 -3
- anthropic/types/beta/message_count_tokens_params.py +3 -24
- anthropic/types/beta/message_create_params.py +3 -25
- anthropic/types/beta_error_response.py +3 -0
- anthropic/types/cache_control_ephemeral_param.py +11 -0
- anthropic/types/cache_creation.py +13 -0
- anthropic/types/completion_create_params.py +2 -1
- anthropic/types/message_count_tokens_params.py +1 -24
- anthropic/types/message_create_params.py +4 -26
- anthropic/types/shared/error_response.py +3 -0
- anthropic/types/tool_param.py +3 -2
- anthropic/types/usage.py +4 -0
- anthropic/types/web_search_tool_20250305_param.py +4 -3
- {anthropic-0.63.0.dist-info → anthropic-0.65.0.dist-info}/METADATA +1 -1
- {anthropic-0.63.0.dist-info → anthropic-0.65.0.dist-info}/RECORD +56 -36
- {anthropic-0.63.0.dist-info → anthropic-0.65.0.dist-info}/WHEEL +0 -0
- {anthropic-0.63.0.dist-info → anthropic-0.65.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import warnings
|
|
6
|
-
from typing import
|
|
6
|
+
from typing import Union, Iterable, Optional
|
|
7
7
|
from functools import partial
|
|
8
8
|
from typing_extensions import Literal, overload
|
|
9
9
|
|
|
@@ -23,7 +23,7 @@ from .batches import (
|
|
|
23
23
|
BatchesWithStreamingResponse,
|
|
24
24
|
AsyncBatchesWithStreamingResponse,
|
|
25
25
|
)
|
|
26
|
-
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
|
26
|
+
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr
|
|
27
27
|
from ..._utils import is_given, required_args, maybe_transform, async_maybe_transform
|
|
28
28
|
from ..._compat import cached_property
|
|
29
29
|
from ..._resource import SyncAPIResource, AsyncAPIResource
|
|
@@ -57,6 +57,8 @@ DEPRECATED_MODELS = {
|
|
|
57
57
|
"claude-3-opus-20240229": "January 5th, 2026",
|
|
58
58
|
"claude-2.1": "July 21st, 2025",
|
|
59
59
|
"claude-2.0": "July 21st, 2025",
|
|
60
|
+
"claude-3-5-sonnet-20241022": "October 22, 2025",
|
|
61
|
+
"claude-3-5-sonnet-20240620": "October 22, 2025",
|
|
60
62
|
}
|
|
61
63
|
|
|
62
64
|
|
|
@@ -93,7 +95,7 @@ class Messages(SyncAPIResource):
|
|
|
93
95
|
model: ModelParam,
|
|
94
96
|
metadata: MetadataParam | NotGiven = NOT_GIVEN,
|
|
95
97
|
service_tier: Literal["auto", "standard_only"] | NotGiven = NOT_GIVEN,
|
|
96
|
-
stop_sequences:
|
|
98
|
+
stop_sequences: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
|
|
97
99
|
stream: Literal[False] | NotGiven = NOT_GIVEN,
|
|
98
100
|
system: Union[str, Iterable[TextBlockParam]] | NotGiven = NOT_GIVEN,
|
|
99
101
|
temperature: float | NotGiven = NOT_GIVEN,
|
|
@@ -184,30 +186,7 @@ class Messages(SyncAPIResource):
|
|
|
184
186
|
{ "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
|
|
185
187
|
```
|
|
186
188
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
```json
|
|
190
|
-
{
|
|
191
|
-
"role": "user",
|
|
192
|
-
"content": [
|
|
193
|
-
{
|
|
194
|
-
"type": "image",
|
|
195
|
-
"source": {
|
|
196
|
-
"type": "base64",
|
|
197
|
-
"media_type": "image/jpeg",
|
|
198
|
-
"data": "/9j/4AAQSkZJRg..."
|
|
199
|
-
}
|
|
200
|
-
},
|
|
201
|
-
{ "type": "text", "text": "What is in this image?" }
|
|
202
|
-
]
|
|
203
|
-
}
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
We currently support the `base64` source type for images, and the `image/jpeg`,
|
|
207
|
-
`image/png`, `image/gif`, and `image/webp` media types.
|
|
208
|
-
|
|
209
|
-
See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
|
|
210
|
-
more input examples.
|
|
189
|
+
See [input examples](https://docs.anthropic.com/en/api/messages-examples).
|
|
211
190
|
|
|
212
191
|
Note that if you want to include a
|
|
213
192
|
[system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
|
|
@@ -385,7 +364,7 @@ class Messages(SyncAPIResource):
|
|
|
385
364
|
stream: Literal[True],
|
|
386
365
|
metadata: MetadataParam | NotGiven = NOT_GIVEN,
|
|
387
366
|
service_tier: Literal["auto", "standard_only"] | NotGiven = NOT_GIVEN,
|
|
388
|
-
stop_sequences:
|
|
367
|
+
stop_sequences: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
|
|
389
368
|
system: Union[str, Iterable[TextBlockParam]] | NotGiven = NOT_GIVEN,
|
|
390
369
|
temperature: float | NotGiven = NOT_GIVEN,
|
|
391
370
|
thinking: ThinkingConfigParam | NotGiven = NOT_GIVEN,
|
|
@@ -475,30 +454,7 @@ class Messages(SyncAPIResource):
|
|
|
475
454
|
{ "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
|
|
476
455
|
```
|
|
477
456
|
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
```json
|
|
481
|
-
{
|
|
482
|
-
"role": "user",
|
|
483
|
-
"content": [
|
|
484
|
-
{
|
|
485
|
-
"type": "image",
|
|
486
|
-
"source": {
|
|
487
|
-
"type": "base64",
|
|
488
|
-
"media_type": "image/jpeg",
|
|
489
|
-
"data": "/9j/4AAQSkZJRg..."
|
|
490
|
-
}
|
|
491
|
-
},
|
|
492
|
-
{ "type": "text", "text": "What is in this image?" }
|
|
493
|
-
]
|
|
494
|
-
}
|
|
495
|
-
```
|
|
496
|
-
|
|
497
|
-
We currently support the `base64` source type for images, and the `image/jpeg`,
|
|
498
|
-
`image/png`, `image/gif`, and `image/webp` media types.
|
|
499
|
-
|
|
500
|
-
See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
|
|
501
|
-
more input examples.
|
|
457
|
+
See [input examples](https://docs.anthropic.com/en/api/messages-examples).
|
|
502
458
|
|
|
503
459
|
Note that if you want to include a
|
|
504
460
|
[system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
|
|
@@ -676,7 +632,7 @@ class Messages(SyncAPIResource):
|
|
|
676
632
|
stream: bool,
|
|
677
633
|
metadata: MetadataParam | NotGiven = NOT_GIVEN,
|
|
678
634
|
service_tier: Literal["auto", "standard_only"] | NotGiven = NOT_GIVEN,
|
|
679
|
-
stop_sequences:
|
|
635
|
+
stop_sequences: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
|
|
680
636
|
system: Union[str, Iterable[TextBlockParam]] | NotGiven = NOT_GIVEN,
|
|
681
637
|
temperature: float | NotGiven = NOT_GIVEN,
|
|
682
638
|
thinking: ThinkingConfigParam | NotGiven = NOT_GIVEN,
|
|
@@ -766,30 +722,7 @@ class Messages(SyncAPIResource):
|
|
|
766
722
|
{ "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
|
|
767
723
|
```
|
|
768
724
|
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
```json
|
|
772
|
-
{
|
|
773
|
-
"role": "user",
|
|
774
|
-
"content": [
|
|
775
|
-
{
|
|
776
|
-
"type": "image",
|
|
777
|
-
"source": {
|
|
778
|
-
"type": "base64",
|
|
779
|
-
"media_type": "image/jpeg",
|
|
780
|
-
"data": "/9j/4AAQSkZJRg..."
|
|
781
|
-
}
|
|
782
|
-
},
|
|
783
|
-
{ "type": "text", "text": "What is in this image?" }
|
|
784
|
-
]
|
|
785
|
-
}
|
|
786
|
-
```
|
|
787
|
-
|
|
788
|
-
We currently support the `base64` source type for images, and the `image/jpeg`,
|
|
789
|
-
`image/png`, `image/gif`, and `image/webp` media types.
|
|
790
|
-
|
|
791
|
-
See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
|
|
792
|
-
more input examples.
|
|
725
|
+
See [input examples](https://docs.anthropic.com/en/api/messages-examples).
|
|
793
726
|
|
|
794
727
|
Note that if you want to include a
|
|
795
728
|
[system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
|
|
@@ -966,7 +899,7 @@ class Messages(SyncAPIResource):
|
|
|
966
899
|
model: ModelParam,
|
|
967
900
|
metadata: MetadataParam | NotGiven = NOT_GIVEN,
|
|
968
901
|
service_tier: Literal["auto", "standard_only"] | NotGiven = NOT_GIVEN,
|
|
969
|
-
stop_sequences:
|
|
902
|
+
stop_sequences: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
|
|
970
903
|
stream: Literal[False] | Literal[True] | NotGiven = NOT_GIVEN,
|
|
971
904
|
system: Union[str, Iterable[TextBlockParam]] | NotGiven = NOT_GIVEN,
|
|
972
905
|
temperature: float | NotGiven = NOT_GIVEN,
|
|
@@ -1034,7 +967,7 @@ class Messages(SyncAPIResource):
|
|
|
1034
967
|
metadata: MetadataParam | NotGiven = NOT_GIVEN,
|
|
1035
968
|
container: Optional[str] | NotGiven = NOT_GIVEN,
|
|
1036
969
|
service_tier: Literal["auto", "standard_only"] | NotGiven = NOT_GIVEN,
|
|
1037
|
-
stop_sequences:
|
|
970
|
+
stop_sequences: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
|
|
1038
971
|
system: Union[str, Iterable[TextBlockParam]] | NotGiven = NOT_GIVEN,
|
|
1039
972
|
temperature: float | NotGiven = NOT_GIVEN,
|
|
1040
973
|
top_k: int | NotGiven = NOT_GIVEN,
|
|
@@ -1176,30 +1109,7 @@ class Messages(SyncAPIResource):
|
|
|
1176
1109
|
{ "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
|
|
1177
1110
|
```
|
|
1178
1111
|
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
```json
|
|
1182
|
-
{
|
|
1183
|
-
"role": "user",
|
|
1184
|
-
"content": [
|
|
1185
|
-
{
|
|
1186
|
-
"type": "image",
|
|
1187
|
-
"source": {
|
|
1188
|
-
"type": "base64",
|
|
1189
|
-
"media_type": "image/jpeg",
|
|
1190
|
-
"data": "/9j/4AAQSkZJRg..."
|
|
1191
|
-
}
|
|
1192
|
-
},
|
|
1193
|
-
{ "type": "text", "text": "What is in this image?" }
|
|
1194
|
-
]
|
|
1195
|
-
}
|
|
1196
|
-
```
|
|
1197
|
-
|
|
1198
|
-
We currently support the `base64` source type for images, and the `image/jpeg`,
|
|
1199
|
-
`image/png`, `image/gif`, and `image/webp` media types.
|
|
1200
|
-
|
|
1201
|
-
See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
|
|
1202
|
-
more input examples.
|
|
1112
|
+
See [input examples](https://docs.anthropic.com/en/api/messages-examples).
|
|
1203
1113
|
|
|
1204
1114
|
Note that if you want to include a
|
|
1205
1115
|
[system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
|
|
@@ -1368,7 +1278,7 @@ class AsyncMessages(AsyncAPIResource):
|
|
|
1368
1278
|
model: ModelParam,
|
|
1369
1279
|
metadata: MetadataParam | NotGiven = NOT_GIVEN,
|
|
1370
1280
|
service_tier: Literal["auto", "standard_only"] | NotGiven = NOT_GIVEN,
|
|
1371
|
-
stop_sequences:
|
|
1281
|
+
stop_sequences: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
|
|
1372
1282
|
stream: Literal[False] | NotGiven = NOT_GIVEN,
|
|
1373
1283
|
system: Union[str, Iterable[TextBlockParam]] | NotGiven = NOT_GIVEN,
|
|
1374
1284
|
temperature: float | NotGiven = NOT_GIVEN,
|
|
@@ -1459,30 +1369,7 @@ class AsyncMessages(AsyncAPIResource):
|
|
|
1459
1369
|
{ "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
|
|
1460
1370
|
```
|
|
1461
1371
|
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
```json
|
|
1465
|
-
{
|
|
1466
|
-
"role": "user",
|
|
1467
|
-
"content": [
|
|
1468
|
-
{
|
|
1469
|
-
"type": "image",
|
|
1470
|
-
"source": {
|
|
1471
|
-
"type": "base64",
|
|
1472
|
-
"media_type": "image/jpeg",
|
|
1473
|
-
"data": "/9j/4AAQSkZJRg..."
|
|
1474
|
-
}
|
|
1475
|
-
},
|
|
1476
|
-
{ "type": "text", "text": "What is in this image?" }
|
|
1477
|
-
]
|
|
1478
|
-
}
|
|
1479
|
-
```
|
|
1480
|
-
|
|
1481
|
-
We currently support the `base64` source type for images, and the `image/jpeg`,
|
|
1482
|
-
`image/png`, `image/gif`, and `image/webp` media types.
|
|
1483
|
-
|
|
1484
|
-
See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
|
|
1485
|
-
more input examples.
|
|
1372
|
+
See [input examples](https://docs.anthropic.com/en/api/messages-examples).
|
|
1486
1373
|
|
|
1487
1374
|
Note that if you want to include a
|
|
1488
1375
|
[system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
|
|
@@ -1660,7 +1547,7 @@ class AsyncMessages(AsyncAPIResource):
|
|
|
1660
1547
|
stream: Literal[True],
|
|
1661
1548
|
metadata: MetadataParam | NotGiven = NOT_GIVEN,
|
|
1662
1549
|
service_tier: Literal["auto", "standard_only"] | NotGiven = NOT_GIVEN,
|
|
1663
|
-
stop_sequences:
|
|
1550
|
+
stop_sequences: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
|
|
1664
1551
|
system: Union[str, Iterable[TextBlockParam]] | NotGiven = NOT_GIVEN,
|
|
1665
1552
|
temperature: float | NotGiven = NOT_GIVEN,
|
|
1666
1553
|
thinking: ThinkingConfigParam | NotGiven = NOT_GIVEN,
|
|
@@ -1750,30 +1637,7 @@ class AsyncMessages(AsyncAPIResource):
|
|
|
1750
1637
|
{ "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
|
|
1751
1638
|
```
|
|
1752
1639
|
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
```json
|
|
1756
|
-
{
|
|
1757
|
-
"role": "user",
|
|
1758
|
-
"content": [
|
|
1759
|
-
{
|
|
1760
|
-
"type": "image",
|
|
1761
|
-
"source": {
|
|
1762
|
-
"type": "base64",
|
|
1763
|
-
"media_type": "image/jpeg",
|
|
1764
|
-
"data": "/9j/4AAQSkZJRg..."
|
|
1765
|
-
}
|
|
1766
|
-
},
|
|
1767
|
-
{ "type": "text", "text": "What is in this image?" }
|
|
1768
|
-
]
|
|
1769
|
-
}
|
|
1770
|
-
```
|
|
1771
|
-
|
|
1772
|
-
We currently support the `base64` source type for images, and the `image/jpeg`,
|
|
1773
|
-
`image/png`, `image/gif`, and `image/webp` media types.
|
|
1774
|
-
|
|
1775
|
-
See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
|
|
1776
|
-
more input examples.
|
|
1640
|
+
See [input examples](https://docs.anthropic.com/en/api/messages-examples).
|
|
1777
1641
|
|
|
1778
1642
|
Note that if you want to include a
|
|
1779
1643
|
[system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
|
|
@@ -1951,7 +1815,7 @@ class AsyncMessages(AsyncAPIResource):
|
|
|
1951
1815
|
stream: bool,
|
|
1952
1816
|
metadata: MetadataParam | NotGiven = NOT_GIVEN,
|
|
1953
1817
|
service_tier: Literal["auto", "standard_only"] | NotGiven = NOT_GIVEN,
|
|
1954
|
-
stop_sequences:
|
|
1818
|
+
stop_sequences: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
|
|
1955
1819
|
system: Union[str, Iterable[TextBlockParam]] | NotGiven = NOT_GIVEN,
|
|
1956
1820
|
temperature: float | NotGiven = NOT_GIVEN,
|
|
1957
1821
|
thinking: ThinkingConfigParam | NotGiven = NOT_GIVEN,
|
|
@@ -2041,30 +1905,7 @@ class AsyncMessages(AsyncAPIResource):
|
|
|
2041
1905
|
{ "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
|
|
2042
1906
|
```
|
|
2043
1907
|
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
```json
|
|
2047
|
-
{
|
|
2048
|
-
"role": "user",
|
|
2049
|
-
"content": [
|
|
2050
|
-
{
|
|
2051
|
-
"type": "image",
|
|
2052
|
-
"source": {
|
|
2053
|
-
"type": "base64",
|
|
2054
|
-
"media_type": "image/jpeg",
|
|
2055
|
-
"data": "/9j/4AAQSkZJRg..."
|
|
2056
|
-
}
|
|
2057
|
-
},
|
|
2058
|
-
{ "type": "text", "text": "What is in this image?" }
|
|
2059
|
-
]
|
|
2060
|
-
}
|
|
2061
|
-
```
|
|
2062
|
-
|
|
2063
|
-
We currently support the `base64` source type for images, and the `image/jpeg`,
|
|
2064
|
-
`image/png`, `image/gif`, and `image/webp` media types.
|
|
2065
|
-
|
|
2066
|
-
See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
|
|
2067
|
-
more input examples.
|
|
1908
|
+
See [input examples](https://docs.anthropic.com/en/api/messages-examples).
|
|
2068
1909
|
|
|
2069
1910
|
Note that if you want to include a
|
|
2070
1911
|
[system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
|
|
@@ -2241,7 +2082,7 @@ class AsyncMessages(AsyncAPIResource):
|
|
|
2241
2082
|
model: ModelParam,
|
|
2242
2083
|
metadata: MetadataParam | NotGiven = NOT_GIVEN,
|
|
2243
2084
|
service_tier: Literal["auto", "standard_only"] | NotGiven = NOT_GIVEN,
|
|
2244
|
-
stop_sequences:
|
|
2085
|
+
stop_sequences: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
|
|
2245
2086
|
stream: Literal[False] | Literal[True] | NotGiven = NOT_GIVEN,
|
|
2246
2087
|
system: Union[str, Iterable[TextBlockParam]] | NotGiven = NOT_GIVEN,
|
|
2247
2088
|
temperature: float | NotGiven = NOT_GIVEN,
|
|
@@ -2309,7 +2150,7 @@ class AsyncMessages(AsyncAPIResource):
|
|
|
2309
2150
|
metadata: MetadataParam | NotGiven = NOT_GIVEN,
|
|
2310
2151
|
container: Optional[str] | NotGiven = NOT_GIVEN,
|
|
2311
2152
|
service_tier: Literal["auto", "standard_only"] | NotGiven = NOT_GIVEN,
|
|
2312
|
-
stop_sequences:
|
|
2153
|
+
stop_sequences: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
|
|
2313
2154
|
system: Union[str, Iterable[TextBlockParam]] | NotGiven = NOT_GIVEN,
|
|
2314
2155
|
temperature: float | NotGiven = NOT_GIVEN,
|
|
2315
2156
|
top_k: int | NotGiven = NOT_GIVEN,
|
|
@@ -2450,30 +2291,7 @@ class AsyncMessages(AsyncAPIResource):
|
|
|
2450
2291
|
{ "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
|
|
2451
2292
|
```
|
|
2452
2293
|
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
```json
|
|
2456
|
-
{
|
|
2457
|
-
"role": "user",
|
|
2458
|
-
"content": [
|
|
2459
|
-
{
|
|
2460
|
-
"type": "image",
|
|
2461
|
-
"source": {
|
|
2462
|
-
"type": "base64",
|
|
2463
|
-
"media_type": "image/jpeg",
|
|
2464
|
-
"data": "/9j/4AAQSkZJRg..."
|
|
2465
|
-
}
|
|
2466
|
-
},
|
|
2467
|
-
{ "type": "text", "text": "What is in this image?" }
|
|
2468
|
-
]
|
|
2469
|
-
}
|
|
2470
|
-
```
|
|
2471
|
-
|
|
2472
|
-
We currently support the `base64` source type for images, and the `image/jpeg`,
|
|
2473
|
-
`image/png`, `image/gif`, and `image/webp` media types.
|
|
2474
|
-
|
|
2475
|
-
See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
|
|
2476
|
-
more input examples.
|
|
2294
|
+
See [input examples](https://docs.anthropic.com/en/api/messages-examples).
|
|
2477
2295
|
|
|
2478
2296
|
Note that if you want to include a
|
|
2479
2297
|
[system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
|
anthropic/types/__init__.py
CHANGED
|
@@ -30,6 +30,7 @@ from .content_block import ContentBlock as ContentBlock
|
|
|
30
30
|
from .message_param import MessageParam as MessageParam
|
|
31
31
|
from .text_citation import TextCitation as TextCitation
|
|
32
32
|
from .beta_api_error import BetaAPIError as BetaAPIError
|
|
33
|
+
from .cache_creation import CacheCreation as CacheCreation
|
|
33
34
|
from .metadata_param import MetadataParam as MetadataParam
|
|
34
35
|
from .thinking_block import ThinkingBlock as ThinkingBlock
|
|
35
36
|
from .thinking_delta import ThinkingDelta as ThinkingDelta
|
anthropic/types/beta/__init__.py
CHANGED
|
@@ -96,6 +96,8 @@ from .beta_tool_text_editor_20241022_param import BetaToolTextEditor20241022Para
|
|
|
96
96
|
from .beta_tool_text_editor_20250124_param import BetaToolTextEditor20250124Param as BetaToolTextEditor20250124Param
|
|
97
97
|
from .beta_tool_text_editor_20250429_param import BetaToolTextEditor20250429Param as BetaToolTextEditor20250429Param
|
|
98
98
|
from .beta_tool_text_editor_20250728_param import BetaToolTextEditor20250728Param as BetaToolTextEditor20250728Param
|
|
99
|
+
from .beta_bash_code_execution_output_block import BetaBashCodeExecutionOutputBlock as BetaBashCodeExecutionOutputBlock
|
|
100
|
+
from .beta_bash_code_execution_result_block import BetaBashCodeExecutionResultBlock as BetaBashCodeExecutionResultBlock
|
|
99
101
|
from .beta_code_execution_tool_result_block import BetaCodeExecutionToolResultBlock as BetaCodeExecutionToolResultBlock
|
|
100
102
|
from .beta_code_execution_tool_result_error import BetaCodeExecutionToolResultError as BetaCodeExecutionToolResultError
|
|
101
103
|
from .beta_tool_computer_use_20241022_param import BetaToolComputerUse20241022Param as BetaToolComputerUse20241022Param
|
|
@@ -110,6 +112,9 @@ from .beta_web_search_tool_result_error_code import BetaWebSearchToolResultError
|
|
|
110
112
|
from .beta_code_execution_tool_20250522_param import (
|
|
111
113
|
BetaCodeExecutionTool20250522Param as BetaCodeExecutionTool20250522Param,
|
|
112
114
|
)
|
|
115
|
+
from .beta_code_execution_tool_20250825_param import (
|
|
116
|
+
BetaCodeExecutionTool20250825Param as BetaCodeExecutionTool20250825Param,
|
|
117
|
+
)
|
|
113
118
|
from .beta_content_block_source_content_param import (
|
|
114
119
|
BetaContentBlockSourceContentParam as BetaContentBlockSourceContentParam,
|
|
115
120
|
)
|
|
@@ -128,6 +133,12 @@ from .beta_citations_web_search_result_location import (
|
|
|
128
133
|
from .beta_web_search_tool_result_block_content import (
|
|
129
134
|
BetaWebSearchToolResultBlockContent as BetaWebSearchToolResultBlockContent,
|
|
130
135
|
)
|
|
136
|
+
from .beta_bash_code_execution_tool_result_block import (
|
|
137
|
+
BetaBashCodeExecutionToolResultBlock as BetaBashCodeExecutionToolResultBlock,
|
|
138
|
+
)
|
|
139
|
+
from .beta_bash_code_execution_tool_result_error import (
|
|
140
|
+
BetaBashCodeExecutionToolResultError as BetaBashCodeExecutionToolResultError,
|
|
141
|
+
)
|
|
131
142
|
from .beta_citation_content_block_location_param import (
|
|
132
143
|
BetaCitationContentBlockLocationParam as BetaCitationContentBlockLocationParam,
|
|
133
144
|
)
|
|
@@ -137,6 +148,12 @@ from .beta_citation_search_result_location_param import (
|
|
|
137
148
|
from .beta_code_execution_tool_result_error_code import (
|
|
138
149
|
BetaCodeExecutionToolResultErrorCode as BetaCodeExecutionToolResultErrorCode,
|
|
139
150
|
)
|
|
151
|
+
from .beta_bash_code_execution_output_block_param import (
|
|
152
|
+
BetaBashCodeExecutionOutputBlockParam as BetaBashCodeExecutionOutputBlockParam,
|
|
153
|
+
)
|
|
154
|
+
from .beta_bash_code_execution_result_block_param import (
|
|
155
|
+
BetaBashCodeExecutionResultBlockParam as BetaBashCodeExecutionResultBlockParam,
|
|
156
|
+
)
|
|
140
157
|
from .beta_code_execution_tool_result_block_param import (
|
|
141
158
|
BetaCodeExecutionToolResultBlockParam as BetaCodeExecutionToolResultBlockParam,
|
|
142
159
|
)
|
|
@@ -152,12 +169,48 @@ from .beta_code_execution_tool_result_block_content import (
|
|
|
152
169
|
from .beta_citation_web_search_result_location_param import (
|
|
153
170
|
BetaCitationWebSearchResultLocationParam as BetaCitationWebSearchResultLocationParam,
|
|
154
171
|
)
|
|
172
|
+
from .beta_bash_code_execution_tool_result_block_param import (
|
|
173
|
+
BetaBashCodeExecutionToolResultBlockParam as BetaBashCodeExecutionToolResultBlockParam,
|
|
174
|
+
)
|
|
175
|
+
from .beta_bash_code_execution_tool_result_error_param import (
|
|
176
|
+
BetaBashCodeExecutionToolResultErrorParam as BetaBashCodeExecutionToolResultErrorParam,
|
|
177
|
+
)
|
|
155
178
|
from .beta_request_mcp_server_tool_configuration_param import (
|
|
156
179
|
BetaRequestMCPServerToolConfigurationParam as BetaRequestMCPServerToolConfigurationParam,
|
|
157
180
|
)
|
|
181
|
+
from .beta_text_editor_code_execution_tool_result_block import (
|
|
182
|
+
BetaTextEditorCodeExecutionToolResultBlock as BetaTextEditorCodeExecutionToolResultBlock,
|
|
183
|
+
)
|
|
184
|
+
from .beta_text_editor_code_execution_tool_result_error import (
|
|
185
|
+
BetaTextEditorCodeExecutionToolResultError as BetaTextEditorCodeExecutionToolResultError,
|
|
186
|
+
)
|
|
187
|
+
from .beta_text_editor_code_execution_view_result_block import (
|
|
188
|
+
BetaTextEditorCodeExecutionViewResultBlock as BetaTextEditorCodeExecutionViewResultBlock,
|
|
189
|
+
)
|
|
190
|
+
from .beta_text_editor_code_execution_create_result_block import (
|
|
191
|
+
BetaTextEditorCodeExecutionCreateResultBlock as BetaTextEditorCodeExecutionCreateResultBlock,
|
|
192
|
+
)
|
|
158
193
|
from .beta_web_search_tool_result_block_param_content_param import (
|
|
159
194
|
BetaWebSearchToolResultBlockParamContentParam as BetaWebSearchToolResultBlockParamContentParam,
|
|
160
195
|
)
|
|
196
|
+
from .beta_text_editor_code_execution_tool_result_block_param import (
|
|
197
|
+
BetaTextEditorCodeExecutionToolResultBlockParam as BetaTextEditorCodeExecutionToolResultBlockParam,
|
|
198
|
+
)
|
|
199
|
+
from .beta_text_editor_code_execution_tool_result_error_param import (
|
|
200
|
+
BetaTextEditorCodeExecutionToolResultErrorParam as BetaTextEditorCodeExecutionToolResultErrorParam,
|
|
201
|
+
)
|
|
202
|
+
from .beta_text_editor_code_execution_view_result_block_param import (
|
|
203
|
+
BetaTextEditorCodeExecutionViewResultBlockParam as BetaTextEditorCodeExecutionViewResultBlockParam,
|
|
204
|
+
)
|
|
205
|
+
from .beta_text_editor_code_execution_str_replace_result_block import (
|
|
206
|
+
BetaTextEditorCodeExecutionStrReplaceResultBlock as BetaTextEditorCodeExecutionStrReplaceResultBlock,
|
|
207
|
+
)
|
|
161
208
|
from .beta_code_execution_tool_result_block_param_content_param import (
|
|
162
209
|
BetaCodeExecutionToolResultBlockParamContentParam as BetaCodeExecutionToolResultBlockParamContentParam,
|
|
163
210
|
)
|
|
211
|
+
from .beta_text_editor_code_execution_create_result_block_param import (
|
|
212
|
+
BetaTextEditorCodeExecutionCreateResultBlockParam as BetaTextEditorCodeExecutionCreateResultBlockParam,
|
|
213
|
+
)
|
|
214
|
+
from .beta_text_editor_code_execution_str_replace_result_block_param import (
|
|
215
|
+
BetaTextEditorCodeExecutionStrReplaceResultBlockParam as BetaTextEditorCodeExecutionStrReplaceResultBlockParam,
|
|
216
|
+
)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing_extensions import Literal
|
|
4
|
+
|
|
5
|
+
from ..._models import BaseModel
|
|
6
|
+
|
|
7
|
+
__all__ = ["BetaBashCodeExecutionOutputBlock"]
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class BetaBashCodeExecutionOutputBlock(BaseModel):
|
|
11
|
+
file_id: str
|
|
12
|
+
|
|
13
|
+
type: Literal["bash_code_execution_output"]
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing_extensions import Literal, Required, TypedDict
|
|
6
|
+
|
|
7
|
+
__all__ = ["BetaBashCodeExecutionOutputBlockParam"]
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class BetaBashCodeExecutionOutputBlockParam(TypedDict, total=False):
|
|
11
|
+
file_id: Required[str]
|
|
12
|
+
|
|
13
|
+
type: Required[Literal["bash_code_execution_output"]]
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import List
|
|
4
|
+
from typing_extensions import Literal
|
|
5
|
+
|
|
6
|
+
from ..._models import BaseModel
|
|
7
|
+
from .beta_bash_code_execution_output_block import BetaBashCodeExecutionOutputBlock
|
|
8
|
+
|
|
9
|
+
__all__ = ["BetaBashCodeExecutionResultBlock"]
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class BetaBashCodeExecutionResultBlock(BaseModel):
|
|
13
|
+
content: List[BetaBashCodeExecutionOutputBlock]
|
|
14
|
+
|
|
15
|
+
return_code: int
|
|
16
|
+
|
|
17
|
+
stderr: str
|
|
18
|
+
|
|
19
|
+
stdout: str
|
|
20
|
+
|
|
21
|
+
type: Literal["bash_code_execution_result"]
|
|
@@ -0,0 +1,22 @@
|
|
|
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 Iterable
|
|
6
|
+
from typing_extensions import Literal, Required, TypedDict
|
|
7
|
+
|
|
8
|
+
from .beta_bash_code_execution_output_block_param import BetaBashCodeExecutionOutputBlockParam
|
|
9
|
+
|
|
10
|
+
__all__ = ["BetaBashCodeExecutionResultBlockParam"]
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class BetaBashCodeExecutionResultBlockParam(TypedDict, total=False):
|
|
14
|
+
content: Required[Iterable[BetaBashCodeExecutionOutputBlockParam]]
|
|
15
|
+
|
|
16
|
+
return_code: Required[int]
|
|
17
|
+
|
|
18
|
+
stderr: Required[str]
|
|
19
|
+
|
|
20
|
+
stdout: Required[str]
|
|
21
|
+
|
|
22
|
+
type: Required[Literal["bash_code_execution_result"]]
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import Union
|
|
4
|
+
from typing_extensions import Literal, TypeAlias
|
|
5
|
+
|
|
6
|
+
from ..._models import BaseModel
|
|
7
|
+
from .beta_bash_code_execution_result_block import BetaBashCodeExecutionResultBlock
|
|
8
|
+
from .beta_bash_code_execution_tool_result_error import BetaBashCodeExecutionToolResultError
|
|
9
|
+
|
|
10
|
+
__all__ = ["BetaBashCodeExecutionToolResultBlock", "Content"]
|
|
11
|
+
|
|
12
|
+
Content: TypeAlias = Union[BetaBashCodeExecutionToolResultError, BetaBashCodeExecutionResultBlock]
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class BetaBashCodeExecutionToolResultBlock(BaseModel):
|
|
16
|
+
content: Content
|
|
17
|
+
|
|
18
|
+
tool_use_id: str
|
|
19
|
+
|
|
20
|
+
type: Literal["bash_code_execution_tool_result"]
|
|
@@ -0,0 +1,25 @@
|
|
|
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 Union, Optional
|
|
6
|
+
from typing_extensions import Literal, Required, TypeAlias, TypedDict
|
|
7
|
+
|
|
8
|
+
from .beta_cache_control_ephemeral_param import BetaCacheControlEphemeralParam
|
|
9
|
+
from .beta_bash_code_execution_result_block_param import BetaBashCodeExecutionResultBlockParam
|
|
10
|
+
from .beta_bash_code_execution_tool_result_error_param import BetaBashCodeExecutionToolResultErrorParam
|
|
11
|
+
|
|
12
|
+
__all__ = ["BetaBashCodeExecutionToolResultBlockParam", "Content"]
|
|
13
|
+
|
|
14
|
+
Content: TypeAlias = Union[BetaBashCodeExecutionToolResultErrorParam, BetaBashCodeExecutionResultBlockParam]
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class BetaBashCodeExecutionToolResultBlockParam(TypedDict, total=False):
|
|
18
|
+
content: Required[Content]
|
|
19
|
+
|
|
20
|
+
tool_use_id: Required[str]
|
|
21
|
+
|
|
22
|
+
type: Required[Literal["bash_code_execution_tool_result"]]
|
|
23
|
+
|
|
24
|
+
cache_control: Optional[BetaCacheControlEphemeralParam]
|
|
25
|
+
"""Create a cache control breakpoint at this content block."""
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing_extensions import Literal
|
|
4
|
+
|
|
5
|
+
from ..._models import BaseModel
|
|
6
|
+
|
|
7
|
+
__all__ = ["BetaBashCodeExecutionToolResultError"]
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class BetaBashCodeExecutionToolResultError(BaseModel):
|
|
11
|
+
error_code: Literal[
|
|
12
|
+
"invalid_tool_input", "unavailable", "too_many_requests", "execution_time_exceeded", "output_file_too_large"
|
|
13
|
+
]
|
|
14
|
+
|
|
15
|
+
type: Literal["bash_code_execution_tool_result_error"]
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing_extensions import Literal, Required, TypedDict
|
|
6
|
+
|
|
7
|
+
__all__ = ["BetaBashCodeExecutionToolResultErrorParam"]
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class BetaBashCodeExecutionToolResultErrorParam(TypedDict, total=False):
|
|
11
|
+
error_code: Required[
|
|
12
|
+
Literal[
|
|
13
|
+
"invalid_tool_input", "unavailable", "too_many_requests", "execution_time_exceeded", "output_file_too_large"
|
|
14
|
+
]
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
type: Required[Literal["bash_code_execution_tool_result_error"]]
|
|
@@ -0,0 +1,23 @@
|
|
|
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 Optional
|
|
6
|
+
from typing_extensions import Literal, Required, TypedDict
|
|
7
|
+
|
|
8
|
+
from .beta_cache_control_ephemeral_param import BetaCacheControlEphemeralParam
|
|
9
|
+
|
|
10
|
+
__all__ = ["BetaCodeExecutionTool20250825Param"]
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class BetaCodeExecutionTool20250825Param(TypedDict, total=False):
|
|
14
|
+
name: Required[Literal["code_execution"]]
|
|
15
|
+
"""Name of the tool.
|
|
16
|
+
|
|
17
|
+
This is how the tool will be called by the model and in `tool_use` blocks.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
type: Required[Literal["code_execution_20250825"]]
|
|
21
|
+
|
|
22
|
+
cache_control: Optional[BetaCacheControlEphemeralParam]
|
|
23
|
+
"""Create a cache control breakpoint at this content block."""
|
|
@@ -14,6 +14,8 @@ from .beta_container_upload_block import BetaContainerUploadBlock
|
|
|
14
14
|
from .beta_redacted_thinking_block import BetaRedactedThinkingBlock
|
|
15
15
|
from .beta_web_search_tool_result_block import BetaWebSearchToolResultBlock
|
|
16
16
|
from .beta_code_execution_tool_result_block import BetaCodeExecutionToolResultBlock
|
|
17
|
+
from .beta_bash_code_execution_tool_result_block import BetaBashCodeExecutionToolResultBlock
|
|
18
|
+
from .beta_text_editor_code_execution_tool_result_block import BetaTextEditorCodeExecutionToolResultBlock
|
|
17
19
|
|
|
18
20
|
__all__ = ["BetaContentBlock"]
|
|
19
21
|
|
|
@@ -26,6 +28,8 @@ BetaContentBlock: TypeAlias = Annotated[
|
|
|
26
28
|
BetaServerToolUseBlock,
|
|
27
29
|
BetaWebSearchToolResultBlock,
|
|
28
30
|
BetaCodeExecutionToolResultBlock,
|
|
31
|
+
BetaBashCodeExecutionToolResultBlock,
|
|
32
|
+
BetaTextEditorCodeExecutionToolResultBlock,
|
|
29
33
|
BetaMCPToolUseBlock,
|
|
30
34
|
BetaMCPToolResultBlock,
|
|
31
35
|
BetaContainerUploadBlock,
|