anthropic 0.64.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.
Files changed (52) hide show
  1. anthropic/_models.py +1 -1
  2. anthropic/_types.py +35 -1
  3. anthropic/_utils/__init__.py +1 -0
  4. anthropic/_utils/_transform.py +6 -0
  5. anthropic/_utils/_typing.py +5 -0
  6. anthropic/_version.py +1 -1
  7. anthropic/lib/streaming/_beta_messages.py +0 -1
  8. anthropic/resources/beta/messages/messages.py +19 -203
  9. anthropic/resources/completions.py +9 -9
  10. anthropic/resources/messages/messages.py +20 -204
  11. anthropic/types/beta/__init__.py +53 -0
  12. anthropic/types/beta/beta_bash_code_execution_output_block.py +13 -0
  13. anthropic/types/beta/beta_bash_code_execution_output_block_param.py +13 -0
  14. anthropic/types/beta/beta_bash_code_execution_result_block.py +21 -0
  15. anthropic/types/beta/beta_bash_code_execution_result_block_param.py +22 -0
  16. anthropic/types/beta/beta_bash_code_execution_tool_result_block.py +20 -0
  17. anthropic/types/beta/beta_bash_code_execution_tool_result_block_param.py +25 -0
  18. anthropic/types/beta/beta_bash_code_execution_tool_result_error.py +15 -0
  19. anthropic/types/beta/beta_bash_code_execution_tool_result_error_param.py +17 -0
  20. anthropic/types/beta/beta_code_execution_tool_20250825_param.py +23 -0
  21. anthropic/types/beta/beta_content_block.py +4 -0
  22. anthropic/types/beta/beta_content_block_param.py +4 -0
  23. anthropic/types/beta/beta_raw_content_block_start_event.py +4 -0
  24. anthropic/types/beta/beta_request_mcp_server_tool_configuration_param.py +4 -2
  25. anthropic/types/beta/beta_server_tool_use_block.py +1 -1
  26. anthropic/types/beta/beta_server_tool_use_block_param.py +1 -1
  27. anthropic/types/beta/beta_text_editor_code_execution_create_result_block.py +13 -0
  28. anthropic/types/beta/beta_text_editor_code_execution_create_result_block_param.py +13 -0
  29. anthropic/types/beta/beta_text_editor_code_execution_str_replace_result_block.py +22 -0
  30. anthropic/types/beta/beta_text_editor_code_execution_str_replace_result_block_param.py +24 -0
  31. anthropic/types/beta/beta_text_editor_code_execution_tool_result_block.py +27 -0
  32. anthropic/types/beta/beta_text_editor_code_execution_tool_result_block_param.py +34 -0
  33. anthropic/types/beta/beta_text_editor_code_execution_tool_result_error.py +18 -0
  34. anthropic/types/beta/beta_text_editor_code_execution_tool_result_error_param.py +18 -0
  35. anthropic/types/beta/beta_text_editor_code_execution_view_result_block.py +22 -0
  36. anthropic/types/beta/beta_text_editor_code_execution_view_result_block_param.py +22 -0
  37. anthropic/types/beta/beta_tool_param.py +3 -2
  38. anthropic/types/beta/beta_tool_union_param.py +2 -0
  39. anthropic/types/beta/beta_web_search_tool_20250305_param.py +4 -3
  40. anthropic/types/beta/message_count_tokens_params.py +3 -24
  41. anthropic/types/beta/message_create_params.py +3 -25
  42. anthropic/types/beta_error_response.py +3 -0
  43. anthropic/types/completion_create_params.py +2 -1
  44. anthropic/types/message_count_tokens_params.py +1 -24
  45. anthropic/types/message_create_params.py +4 -26
  46. anthropic/types/shared/error_response.py +3 -0
  47. anthropic/types/tool_param.py +3 -2
  48. anthropic/types/web_search_tool_20250305_param.py +4 -3
  49. {anthropic-0.64.0.dist-info → anthropic-0.65.0.dist-info}/METADATA +1 -1
  50. {anthropic-0.64.0.dist-info → anthropic-0.65.0.dist-info}/RECORD +52 -33
  51. {anthropic-0.64.0.dist-info → anthropic-0.65.0.dist-info}/WHEEL +0 -0
  52. {anthropic-0.64.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 List, Union, Iterable, Optional
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
@@ -95,7 +95,7 @@ class Messages(SyncAPIResource):
95
95
  model: ModelParam,
96
96
  metadata: MetadataParam | NotGiven = NOT_GIVEN,
97
97
  service_tier: Literal["auto", "standard_only"] | NotGiven = NOT_GIVEN,
98
- stop_sequences: List[str] | NotGiven = NOT_GIVEN,
98
+ stop_sequences: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
99
99
  stream: Literal[False] | NotGiven = NOT_GIVEN,
100
100
  system: Union[str, Iterable[TextBlockParam]] | NotGiven = NOT_GIVEN,
101
101
  temperature: float | NotGiven = NOT_GIVEN,
@@ -186,30 +186,7 @@ class Messages(SyncAPIResource):
186
186
  { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
187
187
  ```
188
188
 
189
- Starting with Claude 3 models, you can also send image content blocks:
190
-
191
- ```json
192
- {
193
- "role": "user",
194
- "content": [
195
- {
196
- "type": "image",
197
- "source": {
198
- "type": "base64",
199
- "media_type": "image/jpeg",
200
- "data": "/9j/4AAQSkZJRg..."
201
- }
202
- },
203
- { "type": "text", "text": "What is in this image?" }
204
- ]
205
- }
206
- ```
207
-
208
- We currently support the `base64` source type for images, and the `image/jpeg`,
209
- `image/png`, `image/gif`, and `image/webp` media types.
210
-
211
- See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
212
- more input examples.
189
+ See [input examples](https://docs.anthropic.com/en/api/messages-examples).
213
190
 
214
191
  Note that if you want to include a
215
192
  [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
@@ -387,7 +364,7 @@ class Messages(SyncAPIResource):
387
364
  stream: Literal[True],
388
365
  metadata: MetadataParam | NotGiven = NOT_GIVEN,
389
366
  service_tier: Literal["auto", "standard_only"] | NotGiven = NOT_GIVEN,
390
- stop_sequences: List[str] | NotGiven = NOT_GIVEN,
367
+ stop_sequences: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
391
368
  system: Union[str, Iterable[TextBlockParam]] | NotGiven = NOT_GIVEN,
392
369
  temperature: float | NotGiven = NOT_GIVEN,
393
370
  thinking: ThinkingConfigParam | NotGiven = NOT_GIVEN,
@@ -477,30 +454,7 @@ class Messages(SyncAPIResource):
477
454
  { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
478
455
  ```
479
456
 
480
- Starting with Claude 3 models, you can also send image content blocks:
481
-
482
- ```json
483
- {
484
- "role": "user",
485
- "content": [
486
- {
487
- "type": "image",
488
- "source": {
489
- "type": "base64",
490
- "media_type": "image/jpeg",
491
- "data": "/9j/4AAQSkZJRg..."
492
- }
493
- },
494
- { "type": "text", "text": "What is in this image?" }
495
- ]
496
- }
497
- ```
498
-
499
- We currently support the `base64` source type for images, and the `image/jpeg`,
500
- `image/png`, `image/gif`, and `image/webp` media types.
501
-
502
- See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
503
- more input examples.
457
+ See [input examples](https://docs.anthropic.com/en/api/messages-examples).
504
458
 
505
459
  Note that if you want to include a
506
460
  [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
@@ -678,7 +632,7 @@ class Messages(SyncAPIResource):
678
632
  stream: bool,
679
633
  metadata: MetadataParam | NotGiven = NOT_GIVEN,
680
634
  service_tier: Literal["auto", "standard_only"] | NotGiven = NOT_GIVEN,
681
- stop_sequences: List[str] | NotGiven = NOT_GIVEN,
635
+ stop_sequences: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
682
636
  system: Union[str, Iterable[TextBlockParam]] | NotGiven = NOT_GIVEN,
683
637
  temperature: float | NotGiven = NOT_GIVEN,
684
638
  thinking: ThinkingConfigParam | NotGiven = NOT_GIVEN,
@@ -768,30 +722,7 @@ class Messages(SyncAPIResource):
768
722
  { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
769
723
  ```
770
724
 
771
- Starting with Claude 3 models, you can also send image content blocks:
772
-
773
- ```json
774
- {
775
- "role": "user",
776
- "content": [
777
- {
778
- "type": "image",
779
- "source": {
780
- "type": "base64",
781
- "media_type": "image/jpeg",
782
- "data": "/9j/4AAQSkZJRg..."
783
- }
784
- },
785
- { "type": "text", "text": "What is in this image?" }
786
- ]
787
- }
788
- ```
789
-
790
- We currently support the `base64` source type for images, and the `image/jpeg`,
791
- `image/png`, `image/gif`, and `image/webp` media types.
792
-
793
- See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
794
- more input examples.
725
+ See [input examples](https://docs.anthropic.com/en/api/messages-examples).
795
726
 
796
727
  Note that if you want to include a
797
728
  [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
@@ -968,7 +899,7 @@ class Messages(SyncAPIResource):
968
899
  model: ModelParam,
969
900
  metadata: MetadataParam | NotGiven = NOT_GIVEN,
970
901
  service_tier: Literal["auto", "standard_only"] | NotGiven = NOT_GIVEN,
971
- stop_sequences: List[str] | NotGiven = NOT_GIVEN,
902
+ stop_sequences: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
972
903
  stream: Literal[False] | Literal[True] | NotGiven = NOT_GIVEN,
973
904
  system: Union[str, Iterable[TextBlockParam]] | NotGiven = NOT_GIVEN,
974
905
  temperature: float | NotGiven = NOT_GIVEN,
@@ -1036,7 +967,7 @@ class Messages(SyncAPIResource):
1036
967
  metadata: MetadataParam | NotGiven = NOT_GIVEN,
1037
968
  container: Optional[str] | NotGiven = NOT_GIVEN,
1038
969
  service_tier: Literal["auto", "standard_only"] | NotGiven = NOT_GIVEN,
1039
- stop_sequences: List[str] | NotGiven = NOT_GIVEN,
970
+ stop_sequences: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
1040
971
  system: Union[str, Iterable[TextBlockParam]] | NotGiven = NOT_GIVEN,
1041
972
  temperature: float | NotGiven = NOT_GIVEN,
1042
973
  top_k: int | NotGiven = NOT_GIVEN,
@@ -1178,30 +1109,7 @@ class Messages(SyncAPIResource):
1178
1109
  { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
1179
1110
  ```
1180
1111
 
1181
- Starting with Claude 3 models, you can also send image content blocks:
1182
-
1183
- ```json
1184
- {
1185
- "role": "user",
1186
- "content": [
1187
- {
1188
- "type": "image",
1189
- "source": {
1190
- "type": "base64",
1191
- "media_type": "image/jpeg",
1192
- "data": "/9j/4AAQSkZJRg..."
1193
- }
1194
- },
1195
- { "type": "text", "text": "What is in this image?" }
1196
- ]
1197
- }
1198
- ```
1199
-
1200
- We currently support the `base64` source type for images, and the `image/jpeg`,
1201
- `image/png`, `image/gif`, and `image/webp` media types.
1202
-
1203
- See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
1204
- more input examples.
1112
+ See [input examples](https://docs.anthropic.com/en/api/messages-examples).
1205
1113
 
1206
1114
  Note that if you want to include a
1207
1115
  [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
@@ -1370,7 +1278,7 @@ class AsyncMessages(AsyncAPIResource):
1370
1278
  model: ModelParam,
1371
1279
  metadata: MetadataParam | NotGiven = NOT_GIVEN,
1372
1280
  service_tier: Literal["auto", "standard_only"] | NotGiven = NOT_GIVEN,
1373
- stop_sequences: List[str] | NotGiven = NOT_GIVEN,
1281
+ stop_sequences: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
1374
1282
  stream: Literal[False] | NotGiven = NOT_GIVEN,
1375
1283
  system: Union[str, Iterable[TextBlockParam]] | NotGiven = NOT_GIVEN,
1376
1284
  temperature: float | NotGiven = NOT_GIVEN,
@@ -1461,30 +1369,7 @@ class AsyncMessages(AsyncAPIResource):
1461
1369
  { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
1462
1370
  ```
1463
1371
 
1464
- Starting with Claude 3 models, you can also send image content blocks:
1465
-
1466
- ```json
1467
- {
1468
- "role": "user",
1469
- "content": [
1470
- {
1471
- "type": "image",
1472
- "source": {
1473
- "type": "base64",
1474
- "media_type": "image/jpeg",
1475
- "data": "/9j/4AAQSkZJRg..."
1476
- }
1477
- },
1478
- { "type": "text", "text": "What is in this image?" }
1479
- ]
1480
- }
1481
- ```
1482
-
1483
- We currently support the `base64` source type for images, and the `image/jpeg`,
1484
- `image/png`, `image/gif`, and `image/webp` media types.
1485
-
1486
- See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
1487
- more input examples.
1372
+ See [input examples](https://docs.anthropic.com/en/api/messages-examples).
1488
1373
 
1489
1374
  Note that if you want to include a
1490
1375
  [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
@@ -1662,7 +1547,7 @@ class AsyncMessages(AsyncAPIResource):
1662
1547
  stream: Literal[True],
1663
1548
  metadata: MetadataParam | NotGiven = NOT_GIVEN,
1664
1549
  service_tier: Literal["auto", "standard_only"] | NotGiven = NOT_GIVEN,
1665
- stop_sequences: List[str] | NotGiven = NOT_GIVEN,
1550
+ stop_sequences: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
1666
1551
  system: Union[str, Iterable[TextBlockParam]] | NotGiven = NOT_GIVEN,
1667
1552
  temperature: float | NotGiven = NOT_GIVEN,
1668
1553
  thinking: ThinkingConfigParam | NotGiven = NOT_GIVEN,
@@ -1752,30 +1637,7 @@ class AsyncMessages(AsyncAPIResource):
1752
1637
  { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
1753
1638
  ```
1754
1639
 
1755
- Starting with Claude 3 models, you can also send image content blocks:
1756
-
1757
- ```json
1758
- {
1759
- "role": "user",
1760
- "content": [
1761
- {
1762
- "type": "image",
1763
- "source": {
1764
- "type": "base64",
1765
- "media_type": "image/jpeg",
1766
- "data": "/9j/4AAQSkZJRg..."
1767
- }
1768
- },
1769
- { "type": "text", "text": "What is in this image?" }
1770
- ]
1771
- }
1772
- ```
1773
-
1774
- We currently support the `base64` source type for images, and the `image/jpeg`,
1775
- `image/png`, `image/gif`, and `image/webp` media types.
1776
-
1777
- See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
1778
- more input examples.
1640
+ See [input examples](https://docs.anthropic.com/en/api/messages-examples).
1779
1641
 
1780
1642
  Note that if you want to include a
1781
1643
  [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
@@ -1953,7 +1815,7 @@ class AsyncMessages(AsyncAPIResource):
1953
1815
  stream: bool,
1954
1816
  metadata: MetadataParam | NotGiven = NOT_GIVEN,
1955
1817
  service_tier: Literal["auto", "standard_only"] | NotGiven = NOT_GIVEN,
1956
- stop_sequences: List[str] | NotGiven = NOT_GIVEN,
1818
+ stop_sequences: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
1957
1819
  system: Union[str, Iterable[TextBlockParam]] | NotGiven = NOT_GIVEN,
1958
1820
  temperature: float | NotGiven = NOT_GIVEN,
1959
1821
  thinking: ThinkingConfigParam | NotGiven = NOT_GIVEN,
@@ -2043,30 +1905,7 @@ class AsyncMessages(AsyncAPIResource):
2043
1905
  { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
2044
1906
  ```
2045
1907
 
2046
- Starting with Claude 3 models, you can also send image content blocks:
2047
-
2048
- ```json
2049
- {
2050
- "role": "user",
2051
- "content": [
2052
- {
2053
- "type": "image",
2054
- "source": {
2055
- "type": "base64",
2056
- "media_type": "image/jpeg",
2057
- "data": "/9j/4AAQSkZJRg..."
2058
- }
2059
- },
2060
- { "type": "text", "text": "What is in this image?" }
2061
- ]
2062
- }
2063
- ```
2064
-
2065
- We currently support the `base64` source type for images, and the `image/jpeg`,
2066
- `image/png`, `image/gif`, and `image/webp` media types.
2067
-
2068
- See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
2069
- more input examples.
1908
+ See [input examples](https://docs.anthropic.com/en/api/messages-examples).
2070
1909
 
2071
1910
  Note that if you want to include a
2072
1911
  [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
@@ -2243,7 +2082,7 @@ class AsyncMessages(AsyncAPIResource):
2243
2082
  model: ModelParam,
2244
2083
  metadata: MetadataParam | NotGiven = NOT_GIVEN,
2245
2084
  service_tier: Literal["auto", "standard_only"] | NotGiven = NOT_GIVEN,
2246
- stop_sequences: List[str] | NotGiven = NOT_GIVEN,
2085
+ stop_sequences: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
2247
2086
  stream: Literal[False] | Literal[True] | NotGiven = NOT_GIVEN,
2248
2087
  system: Union[str, Iterable[TextBlockParam]] | NotGiven = NOT_GIVEN,
2249
2088
  temperature: float | NotGiven = NOT_GIVEN,
@@ -2311,7 +2150,7 @@ class AsyncMessages(AsyncAPIResource):
2311
2150
  metadata: MetadataParam | NotGiven = NOT_GIVEN,
2312
2151
  container: Optional[str] | NotGiven = NOT_GIVEN,
2313
2152
  service_tier: Literal["auto", "standard_only"] | NotGiven = NOT_GIVEN,
2314
- stop_sequences: List[str] | NotGiven = NOT_GIVEN,
2153
+ stop_sequences: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
2315
2154
  system: Union[str, Iterable[TextBlockParam]] | NotGiven = NOT_GIVEN,
2316
2155
  temperature: float | NotGiven = NOT_GIVEN,
2317
2156
  top_k: int | NotGiven = NOT_GIVEN,
@@ -2452,30 +2291,7 @@ class AsyncMessages(AsyncAPIResource):
2452
2291
  { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
2453
2292
  ```
2454
2293
 
2455
- Starting with Claude 3 models, you can also send image content blocks:
2456
-
2457
- ```json
2458
- {
2459
- "role": "user",
2460
- "content": [
2461
- {
2462
- "type": "image",
2463
- "source": {
2464
- "type": "base64",
2465
- "media_type": "image/jpeg",
2466
- "data": "/9j/4AAQSkZJRg..."
2467
- }
2468
- },
2469
- { "type": "text", "text": "What is in this image?" }
2470
- ]
2471
- }
2472
- ```
2473
-
2474
- We currently support the `base64` source type for images, and the `image/jpeg`,
2475
- `image/png`, `image/gif`, and `image/webp` media types.
2476
-
2477
- See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
2478
- more input examples.
2294
+ See [input examples](https://docs.anthropic.com/en/api/messages-examples).
2479
2295
 
2480
2296
  Note that if you want to include a
2481
2297
  [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
@@ -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,