anthropic 0.74.1__py3-none-any.whl → 0.76.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 (84) hide show
  1. anthropic/_base_client.py +140 -11
  2. anthropic/_client.py +4 -12
  3. anthropic/_models.py +16 -1
  4. anthropic/_streaming.py +78 -76
  5. anthropic/_types.py +12 -2
  6. anthropic/_version.py +1 -1
  7. anthropic/lib/streaming/_beta_messages.py +1 -1
  8. anthropic/lib/tools/_beta_compaction_control.py +48 -0
  9. anthropic/lib/tools/_beta_functions.py +30 -8
  10. anthropic/lib/tools/_beta_runner.py +233 -34
  11. anthropic/resources/beta/messages/messages.py +134 -27
  12. anthropic/resources/messages/messages.py +4 -0
  13. anthropic/types/anthropic_beta_param.py +1 -0
  14. anthropic/types/beta/__init__.py +31 -0
  15. anthropic/types/beta/beta_code_execution_tool_20250522_param.py +9 -1
  16. anthropic/types/beta/beta_code_execution_tool_20250825_param.py +9 -1
  17. anthropic/types/beta/beta_container.py +4 -0
  18. anthropic/types/beta/beta_container_params.py +2 -0
  19. anthropic/types/beta/beta_container_upload_block.py +2 -0
  20. anthropic/types/beta/beta_container_upload_block_param.py +5 -0
  21. anthropic/types/beta/beta_content_block.py +2 -0
  22. anthropic/types/beta/beta_content_block_param.py +2 -0
  23. anthropic/types/beta/beta_direct_caller.py +13 -0
  24. anthropic/types/beta/beta_direct_caller_param.py +13 -0
  25. anthropic/types/beta/beta_mcp_tool_config_param.py +15 -0
  26. anthropic/types/beta/beta_mcp_tool_default_config_param.py +15 -0
  27. anthropic/types/beta/beta_mcp_toolset_param.py +34 -0
  28. anthropic/types/beta/beta_memory_tool_20250818_param.py +11 -1
  29. anthropic/types/beta/beta_output_config_param.py +13 -0
  30. anthropic/types/beta/beta_raw_content_block_start_event.py +2 -0
  31. anthropic/types/beta/beta_server_tool_caller.py +15 -0
  32. anthropic/types/beta/beta_server_tool_caller_param.py +15 -0
  33. anthropic/types/beta/beta_server_tool_use_block.py +20 -4
  34. anthropic/types/beta/beta_server_tool_use_block_param.py +19 -4
  35. anthropic/types/beta/beta_skill.py +2 -0
  36. anthropic/types/beta/beta_skill_params.py +2 -0
  37. anthropic/types/beta/beta_tool_bash_20241022_param.py +11 -1
  38. anthropic/types/beta/beta_tool_bash_20250124_param.py +11 -1
  39. anthropic/types/beta/beta_tool_choice_any_param.py +2 -0
  40. anthropic/types/beta/beta_tool_choice_auto_param.py +2 -0
  41. anthropic/types/beta/beta_tool_choice_none_param.py +2 -0
  42. anthropic/types/beta/beta_tool_choice_tool_param.py +2 -0
  43. anthropic/types/beta/beta_tool_computer_use_20241022_param.py +11 -1
  44. anthropic/types/beta/beta_tool_computer_use_20250124_param.py +11 -1
  45. anthropic/types/beta/beta_tool_computer_use_20251124_param.py +47 -0
  46. anthropic/types/beta/beta_tool_param.py +16 -1
  47. anthropic/types/beta/beta_tool_reference_block.py +13 -0
  48. anthropic/types/beta/beta_tool_reference_block_param.py +21 -0
  49. anthropic/types/beta/beta_tool_result_block_param.py +6 -1
  50. anthropic/types/beta/beta_tool_search_tool_bm25_20251119_param.py +33 -0
  51. anthropic/types/beta/beta_tool_search_tool_regex_20251119_param.py +33 -0
  52. anthropic/types/beta/beta_tool_search_tool_result_block.py +20 -0
  53. anthropic/types/beta/beta_tool_search_tool_result_block_param.py +25 -0
  54. anthropic/types/beta/beta_tool_search_tool_result_error.py +16 -0
  55. anthropic/types/beta/beta_tool_search_tool_result_error_param.py +13 -0
  56. anthropic/types/beta/beta_tool_search_tool_search_result_block.py +15 -0
  57. anthropic/types/beta/beta_tool_search_tool_search_result_block_param.py +16 -0
  58. anthropic/types/beta/beta_tool_text_editor_20241022_param.py +11 -1
  59. anthropic/types/beta/beta_tool_text_editor_20250124_param.py +11 -1
  60. anthropic/types/beta/beta_tool_text_editor_20250429_param.py +11 -1
  61. anthropic/types/beta/beta_tool_text_editor_20250728_param.py +11 -1
  62. anthropic/types/beta/beta_tool_union_param.py +8 -0
  63. anthropic/types/beta/beta_tool_use_block.py +11 -3
  64. anthropic/types/beta/beta_tool_use_block_param.py +10 -3
  65. anthropic/types/beta/beta_web_fetch_tool_20250910_param.py +9 -1
  66. anthropic/types/beta/beta_web_search_tool_20250305_param.py +14 -1
  67. anthropic/types/beta/message_count_tokens_params.py +15 -0
  68. anthropic/types/beta/message_create_params.py +7 -0
  69. anthropic/types/beta/messages/batch_create_params.py +4 -4
  70. anthropic/types/beta/messages/beta_message_batch_individual_response.py +4 -0
  71. anthropic/types/messages/batch_create_params.py +2 -2
  72. anthropic/types/messages/message_batch_individual_response.py +4 -0
  73. anthropic/types/model.py +2 -0
  74. anthropic/types/model_param.py +2 -0
  75. anthropic/types/tool_choice_any_param.py +2 -0
  76. anthropic/types/tool_choice_auto_param.py +2 -0
  77. anthropic/types/tool_choice_none_param.py +2 -0
  78. anthropic/types/tool_choice_tool_param.py +2 -0
  79. anthropic/types/tool_param.py +5 -0
  80. anthropic/types/web_search_tool_20250305_param.py +5 -0
  81. {anthropic-0.74.1.dist-info → anthropic-0.76.0.dist-info}/METADATA +4 -2
  82. {anthropic-0.74.1.dist-info → anthropic-0.76.0.dist-info}/RECORD +84 -64
  83. {anthropic-0.74.1.dist-info → anthropic-0.76.0.dist-info}/WHEEL +0 -0
  84. {anthropic-0.74.1.dist-info → anthropic-0.76.0.dist-info}/licenses/LICENSE +0 -0
@@ -2,7 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import Optional
5
+ from typing import Dict, List, Iterable, Optional
6
6
  from typing_extensions import Literal, Required, TypedDict
7
7
 
8
8
  from .beta_cache_control_ephemeral_param import BetaCacheControlEphemeralParam
@@ -25,10 +25,20 @@ class BetaToolComputerUse20241022Param(TypedDict, total=False):
25
25
 
26
26
  type: Required[Literal["computer_20241022"]]
27
27
 
28
+ allowed_callers: List[Literal["direct", "code_execution_20250825"]]
29
+
28
30
  cache_control: Optional[BetaCacheControlEphemeralParam]
29
31
  """Create a cache control breakpoint at this content block."""
30
32
 
33
+ defer_loading: bool
34
+ """If true, tool will not be included in initial system prompt.
35
+
36
+ Only loaded when returned via tool_reference from tool search.
37
+ """
38
+
31
39
  display_number: Optional[int]
32
40
  """The X11 display number (e.g. 0, 1) for the display."""
33
41
 
42
+ input_examples: Iterable[Dict[str, object]]
43
+
34
44
  strict: bool
@@ -2,7 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import Optional
5
+ from typing import Dict, List, Iterable, Optional
6
6
  from typing_extensions import Literal, Required, TypedDict
7
7
 
8
8
  from .beta_cache_control_ephemeral_param import BetaCacheControlEphemeralParam
@@ -25,10 +25,20 @@ class BetaToolComputerUse20250124Param(TypedDict, total=False):
25
25
 
26
26
  type: Required[Literal["computer_20250124"]]
27
27
 
28
+ allowed_callers: List[Literal["direct", "code_execution_20250825"]]
29
+
28
30
  cache_control: Optional[BetaCacheControlEphemeralParam]
29
31
  """Create a cache control breakpoint at this content block."""
30
32
 
33
+ defer_loading: bool
34
+ """If true, tool will not be included in initial system prompt.
35
+
36
+ Only loaded when returned via tool_reference from tool search.
37
+ """
38
+
31
39
  display_number: Optional[int]
32
40
  """The X11 display number (e.g. 0, 1) for the display."""
33
41
 
42
+ input_examples: Iterable[Dict[str, object]]
43
+
34
44
  strict: bool
@@ -0,0 +1,47 @@
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 Dict, List, Iterable, Optional
6
+ from typing_extensions import Literal, Required, TypedDict
7
+
8
+ from .beta_cache_control_ephemeral_param import BetaCacheControlEphemeralParam
9
+
10
+ __all__ = ["BetaToolComputerUse20251124Param"]
11
+
12
+
13
+ class BetaToolComputerUse20251124Param(TypedDict, total=False):
14
+ display_height_px: Required[int]
15
+ """The height of the display in pixels."""
16
+
17
+ display_width_px: Required[int]
18
+ """The width of the display in pixels."""
19
+
20
+ name: Required[Literal["computer"]]
21
+ """Name of the tool.
22
+
23
+ This is how the tool will be called by the model and in `tool_use` blocks.
24
+ """
25
+
26
+ type: Required[Literal["computer_20251124"]]
27
+
28
+ allowed_callers: List[Literal["direct", "code_execution_20250825"]]
29
+
30
+ cache_control: Optional[BetaCacheControlEphemeralParam]
31
+ """Create a cache control breakpoint at this content block."""
32
+
33
+ defer_loading: bool
34
+ """If true, tool will not be included in initial system prompt.
35
+
36
+ Only loaded when returned via tool_reference from tool search.
37
+ """
38
+
39
+ display_number: Optional[int]
40
+ """The X11 display number (e.g. 0, 1) for the display."""
41
+
42
+ enable_zoom: bool
43
+ """Whether to enable an action to take a zoomed-in screenshot of the screen."""
44
+
45
+ input_examples: Iterable[Dict[str, object]]
46
+
47
+ strict: bool
@@ -2,7 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import Dict, Union, Optional
5
+ from typing import Dict, List, Union, Iterable, Optional
6
6
  from typing_extensions import Literal, Required, TypeAlias, TypedDict
7
7
 
8
8
  from ..._types import SequenceNotStr
@@ -12,6 +12,11 @@ __all__ = ["BetaToolParam", "InputSchema"]
12
12
 
13
13
 
14
14
  class InputSchemaTyped(TypedDict, total=False):
15
+ """[JSON schema](https://json-schema.org/draft/2020-12) for this tool's input.
16
+
17
+ This defines the shape of the `input` that your tool accepts and that the model will produce.
18
+ """
19
+
15
20
  type: Required[Literal["object"]]
16
21
 
17
22
  properties: Optional[Dict[str, object]]
@@ -36,9 +41,17 @@ class BetaToolParam(TypedDict, total=False):
36
41
  This is how the tool will be called by the model and in `tool_use` blocks.
37
42
  """
38
43
 
44
+ allowed_callers: List[Literal["direct", "code_execution_20250825"]]
45
+
39
46
  cache_control: Optional[BetaCacheControlEphemeralParam]
40
47
  """Create a cache control breakpoint at this content block."""
41
48
 
49
+ defer_loading: bool
50
+ """If true, tool will not be included in initial system prompt.
51
+
52
+ Only loaded when returned via tool_reference from tool search.
53
+ """
54
+
42
55
  description: str
43
56
  """Description of what this tool does.
44
57
 
@@ -48,6 +61,8 @@ class BetaToolParam(TypedDict, total=False):
48
61
  aspects of the tool input JSON schema.
49
62
  """
50
63
 
64
+ input_examples: Iterable[Dict[str, object]]
65
+
51
66
  strict: bool
52
67
 
53
68
  type: Optional[Literal["custom"]]
@@ -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__ = ["BetaToolReferenceBlock"]
8
+
9
+
10
+ class BetaToolReferenceBlock(BaseModel):
11
+ tool_name: str
12
+
13
+ type: Literal["tool_reference"]
@@ -0,0 +1,21 @@
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__ = ["BetaToolReferenceBlockParam"]
11
+
12
+
13
+ class BetaToolReferenceBlockParam(TypedDict, total=False):
14
+ """Tool reference block that can be included in tool_result content."""
15
+
16
+ tool_name: Required[str]
17
+
18
+ type: Required[Literal["tool_reference"]]
19
+
20
+ cache_control: Optional[BetaCacheControlEphemeralParam]
21
+ """Create a cache control breakpoint at this content block."""
@@ -8,13 +8,18 @@ from typing_extensions import Literal, Required, TypeAlias, TypedDict
8
8
  from .beta_text_block_param import BetaTextBlockParam
9
9
  from .beta_image_block_param import BetaImageBlockParam
10
10
  from .beta_search_result_block_param import BetaSearchResultBlockParam
11
+ from .beta_tool_reference_block_param import BetaToolReferenceBlockParam
11
12
  from .beta_request_document_block_param import BetaRequestDocumentBlockParam
12
13
  from .beta_cache_control_ephemeral_param import BetaCacheControlEphemeralParam
13
14
 
14
15
  __all__ = ["BetaToolResultBlockParam", "Content"]
15
16
 
16
17
  Content: TypeAlias = Union[
17
- BetaTextBlockParam, BetaImageBlockParam, BetaSearchResultBlockParam, BetaRequestDocumentBlockParam
18
+ BetaTextBlockParam,
19
+ BetaImageBlockParam,
20
+ BetaSearchResultBlockParam,
21
+ BetaRequestDocumentBlockParam,
22
+ BetaToolReferenceBlockParam,
18
23
  ]
19
24
 
20
25
 
@@ -0,0 +1,33 @@
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, Optional
6
+ from typing_extensions import Literal, Required, TypedDict
7
+
8
+ from .beta_cache_control_ephemeral_param import BetaCacheControlEphemeralParam
9
+
10
+ __all__ = ["BetaToolSearchToolBm25_20251119Param"]
11
+
12
+
13
+ class BetaToolSearchToolBm25_20251119Param(TypedDict, total=False):
14
+ name: Required[Literal["tool_search_tool_bm25"]]
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["tool_search_tool_bm25_20251119", "tool_search_tool_bm25"]]
21
+
22
+ allowed_callers: List[Literal["direct", "code_execution_20250825"]]
23
+
24
+ cache_control: Optional[BetaCacheControlEphemeralParam]
25
+ """Create a cache control breakpoint at this content block."""
26
+
27
+ defer_loading: bool
28
+ """If true, tool will not be included in initial system prompt.
29
+
30
+ Only loaded when returned via tool_reference from tool search.
31
+ """
32
+
33
+ strict: bool
@@ -0,0 +1,33 @@
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, Optional
6
+ from typing_extensions import Literal, Required, TypedDict
7
+
8
+ from .beta_cache_control_ephemeral_param import BetaCacheControlEphemeralParam
9
+
10
+ __all__ = ["BetaToolSearchToolRegex20251119Param"]
11
+
12
+
13
+ class BetaToolSearchToolRegex20251119Param(TypedDict, total=False):
14
+ name: Required[Literal["tool_search_tool_regex"]]
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["tool_search_tool_regex_20251119", "tool_search_tool_regex"]]
21
+
22
+ allowed_callers: List[Literal["direct", "code_execution_20250825"]]
23
+
24
+ cache_control: Optional[BetaCacheControlEphemeralParam]
25
+ """Create a cache control breakpoint at this content block."""
26
+
27
+ defer_loading: bool
28
+ """If true, tool will not be included in initial system prompt.
29
+
30
+ Only loaded when returned via tool_reference from tool search.
31
+ """
32
+
33
+ strict: bool
@@ -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_tool_search_tool_result_error import BetaToolSearchToolResultError
8
+ from .beta_tool_search_tool_search_result_block import BetaToolSearchToolSearchResultBlock
9
+
10
+ __all__ = ["BetaToolSearchToolResultBlock", "Content"]
11
+
12
+ Content: TypeAlias = Union[BetaToolSearchToolResultError, BetaToolSearchToolSearchResultBlock]
13
+
14
+
15
+ class BetaToolSearchToolResultBlock(BaseModel):
16
+ content: Content
17
+
18
+ tool_use_id: str
19
+
20
+ type: Literal["tool_search_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_tool_search_tool_result_error_param import BetaToolSearchToolResultErrorParam
10
+ from .beta_tool_search_tool_search_result_block_param import BetaToolSearchToolSearchResultBlockParam
11
+
12
+ __all__ = ["BetaToolSearchToolResultBlockParam", "Content"]
13
+
14
+ Content: TypeAlias = Union[BetaToolSearchToolResultErrorParam, BetaToolSearchToolSearchResultBlockParam]
15
+
16
+
17
+ class BetaToolSearchToolResultBlockParam(TypedDict, total=False):
18
+ content: Required[Content]
19
+
20
+ tool_use_id: Required[str]
21
+
22
+ type: Required[Literal["tool_search_tool_result"]]
23
+
24
+ cache_control: Optional[BetaCacheControlEphemeralParam]
25
+ """Create a cache control breakpoint at this content block."""
@@ -0,0 +1,16 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing import Optional
4
+ from typing_extensions import Literal
5
+
6
+ from ..._models import BaseModel
7
+
8
+ __all__ = ["BetaToolSearchToolResultError"]
9
+
10
+
11
+ class BetaToolSearchToolResultError(BaseModel):
12
+ error_code: Literal["invalid_tool_input", "unavailable", "too_many_requests", "execution_time_exceeded"]
13
+
14
+ error_message: Optional[str] = None
15
+
16
+ type: Literal["tool_search_tool_result_error"]
@@ -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__ = ["BetaToolSearchToolResultErrorParam"]
8
+
9
+
10
+ class BetaToolSearchToolResultErrorParam(TypedDict, total=False):
11
+ error_code: Required[Literal["invalid_tool_input", "unavailable", "too_many_requests", "execution_time_exceeded"]]
12
+
13
+ type: Required[Literal["tool_search_tool_result_error"]]
@@ -0,0 +1,15 @@
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_tool_reference_block import BetaToolReferenceBlock
8
+
9
+ __all__ = ["BetaToolSearchToolSearchResultBlock"]
10
+
11
+
12
+ class BetaToolSearchToolSearchResultBlock(BaseModel):
13
+ tool_references: List[BetaToolReferenceBlock]
14
+
15
+ type: Literal["tool_search_tool_search_result"]
@@ -0,0 +1,16 @@
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_tool_reference_block_param import BetaToolReferenceBlockParam
9
+
10
+ __all__ = ["BetaToolSearchToolSearchResultBlockParam"]
11
+
12
+
13
+ class BetaToolSearchToolSearchResultBlockParam(TypedDict, total=False):
14
+ tool_references: Required[Iterable[BetaToolReferenceBlockParam]]
15
+
16
+ type: Required[Literal["tool_search_tool_search_result"]]
@@ -2,7 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import Optional
5
+ from typing import Dict, List, Iterable, Optional
6
6
  from typing_extensions import Literal, Required, TypedDict
7
7
 
8
8
  from .beta_cache_control_ephemeral_param import BetaCacheControlEphemeralParam
@@ -19,7 +19,17 @@ class BetaToolTextEditor20241022Param(TypedDict, total=False):
19
19
 
20
20
  type: Required[Literal["text_editor_20241022"]]
21
21
 
22
+ allowed_callers: List[Literal["direct", "code_execution_20250825"]]
23
+
22
24
  cache_control: Optional[BetaCacheControlEphemeralParam]
23
25
  """Create a cache control breakpoint at this content block."""
24
26
 
27
+ defer_loading: bool
28
+ """If true, tool will not be included in initial system prompt.
29
+
30
+ Only loaded when returned via tool_reference from tool search.
31
+ """
32
+
33
+ input_examples: Iterable[Dict[str, object]]
34
+
25
35
  strict: bool
@@ -2,7 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import Optional
5
+ from typing import Dict, List, Iterable, Optional
6
6
  from typing_extensions import Literal, Required, TypedDict
7
7
 
8
8
  from .beta_cache_control_ephemeral_param import BetaCacheControlEphemeralParam
@@ -19,7 +19,17 @@ class BetaToolTextEditor20250124Param(TypedDict, total=False):
19
19
 
20
20
  type: Required[Literal["text_editor_20250124"]]
21
21
 
22
+ allowed_callers: List[Literal["direct", "code_execution_20250825"]]
23
+
22
24
  cache_control: Optional[BetaCacheControlEphemeralParam]
23
25
  """Create a cache control breakpoint at this content block."""
24
26
 
27
+ defer_loading: bool
28
+ """If true, tool will not be included in initial system prompt.
29
+
30
+ Only loaded when returned via tool_reference from tool search.
31
+ """
32
+
33
+ input_examples: Iterable[Dict[str, object]]
34
+
25
35
  strict: bool
@@ -2,7 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import Optional
5
+ from typing import Dict, List, Iterable, Optional
6
6
  from typing_extensions import Literal, Required, TypedDict
7
7
 
8
8
  from .beta_cache_control_ephemeral_param import BetaCacheControlEphemeralParam
@@ -19,7 +19,17 @@ class BetaToolTextEditor20250429Param(TypedDict, total=False):
19
19
 
20
20
  type: Required[Literal["text_editor_20250429"]]
21
21
 
22
+ allowed_callers: List[Literal["direct", "code_execution_20250825"]]
23
+
22
24
  cache_control: Optional[BetaCacheControlEphemeralParam]
23
25
  """Create a cache control breakpoint at this content block."""
24
26
 
27
+ defer_loading: bool
28
+ """If true, tool will not be included in initial system prompt.
29
+
30
+ Only loaded when returned via tool_reference from tool search.
31
+ """
32
+
33
+ input_examples: Iterable[Dict[str, object]]
34
+
25
35
  strict: bool
@@ -2,7 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import Optional
5
+ from typing import Dict, List, Iterable, Optional
6
6
  from typing_extensions import Literal, Required, TypedDict
7
7
 
8
8
  from .beta_cache_control_ephemeral_param import BetaCacheControlEphemeralParam
@@ -19,9 +19,19 @@ class BetaToolTextEditor20250728Param(TypedDict, total=False):
19
19
 
20
20
  type: Required[Literal["text_editor_20250728"]]
21
21
 
22
+ allowed_callers: List[Literal["direct", "code_execution_20250825"]]
23
+
22
24
  cache_control: Optional[BetaCacheControlEphemeralParam]
23
25
  """Create a cache control breakpoint at this content block."""
24
26
 
27
+ defer_loading: bool
28
+ """If true, tool will not be included in initial system prompt.
29
+
30
+ Only loaded when returned via tool_reference from tool search.
31
+ """
32
+
33
+ input_examples: Iterable[Dict[str, object]]
34
+
25
35
  max_characters: Optional[int]
26
36
  """Maximum number of characters to display when viewing a file.
27
37
 
@@ -6,6 +6,7 @@ from typing import Union
6
6
  from typing_extensions import TypeAlias
7
7
 
8
8
  from .beta_tool_param import BetaToolParam
9
+ from .beta_mcp_toolset_param import BetaMCPToolsetParam
9
10
  from .beta_tool_bash_20241022_param import BetaToolBash20241022Param
10
11
  from .beta_tool_bash_20250124_param import BetaToolBash20250124Param
11
12
  from .beta_memory_tool_20250818_param import BetaMemoryTool20250818Param
@@ -17,8 +18,11 @@ from .beta_tool_text_editor_20250429_param import BetaToolTextEditor20250429Para
17
18
  from .beta_tool_text_editor_20250728_param import BetaToolTextEditor20250728Param
18
19
  from .beta_tool_computer_use_20241022_param import BetaToolComputerUse20241022Param
19
20
  from .beta_tool_computer_use_20250124_param import BetaToolComputerUse20250124Param
21
+ from .beta_tool_computer_use_20251124_param import BetaToolComputerUse20251124Param
20
22
  from .beta_code_execution_tool_20250522_param import BetaCodeExecutionTool20250522Param
21
23
  from .beta_code_execution_tool_20250825_param import BetaCodeExecutionTool20250825Param
24
+ from .beta_tool_search_tool_bm25_20251119_param import BetaToolSearchToolBm25_20251119Param
25
+ from .beta_tool_search_tool_regex_20251119_param import BetaToolSearchToolRegex20251119Param
22
26
 
23
27
  __all__ = ["BetaToolUnionParam"]
24
28
 
@@ -32,9 +36,13 @@ BetaToolUnionParam: TypeAlias = Union[
32
36
  BetaMemoryTool20250818Param,
33
37
  BetaToolComputerUse20250124Param,
34
38
  BetaToolTextEditor20241022Param,
39
+ BetaToolComputerUse20251124Param,
35
40
  BetaToolTextEditor20250124Param,
36
41
  BetaToolTextEditor20250429Param,
37
42
  BetaToolTextEditor20250728Param,
38
43
  BetaWebSearchTool20250305Param,
39
44
  BetaWebFetchTool20250910Param,
45
+ BetaToolSearchToolBm25_20251119Param,
46
+ BetaToolSearchToolRegex20251119Param,
47
+ BetaMCPToolsetParam,
40
48
  ]
@@ -1,11 +1,16 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- from typing import Dict
4
- from typing_extensions import Literal
3
+ from typing import Dict, Union, Optional
4
+ from typing_extensions import Literal, Annotated, TypeAlias
5
5
 
6
+ from ..._utils import PropertyInfo
6
7
  from ..._models import BaseModel
8
+ from .beta_direct_caller import BetaDirectCaller
9
+ from .beta_server_tool_caller import BetaServerToolCaller
7
10
 
8
- __all__ = ["BetaToolUseBlock"]
11
+ __all__ = ["BetaToolUseBlock", "Caller"]
12
+
13
+ Caller: TypeAlias = Annotated[Union[BetaDirectCaller, BetaServerToolCaller], PropertyInfo(discriminator="type")]
9
14
 
10
15
 
11
16
  class BetaToolUseBlock(BaseModel):
@@ -16,3 +21,6 @@ class BetaToolUseBlock(BaseModel):
16
21
  name: str
17
22
 
18
23
  type: Literal["tool_use"]
24
+
25
+ caller: Optional[Caller] = None
26
+ """Tool invocation directly from the model."""
@@ -2,12 +2,16 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import Dict, Optional
6
- from typing_extensions import Literal, Required, TypedDict
5
+ from typing import Dict, Union, Optional
6
+ from typing_extensions import Literal, Required, TypeAlias, TypedDict
7
7
 
8
+ from .beta_direct_caller_param import BetaDirectCallerParam
9
+ from .beta_server_tool_caller_param import BetaServerToolCallerParam
8
10
  from .beta_cache_control_ephemeral_param import BetaCacheControlEphemeralParam
9
11
 
10
- __all__ = ["BetaToolUseBlockParam"]
12
+ __all__ = ["BetaToolUseBlockParam", "Caller"]
13
+
14
+ Caller: TypeAlias = Union[BetaDirectCallerParam, BetaServerToolCallerParam]
11
15
 
12
16
 
13
17
  class BetaToolUseBlockParam(TypedDict, total=False):
@@ -21,3 +25,6 @@ class BetaToolUseBlockParam(TypedDict, total=False):
21
25
 
22
26
  cache_control: Optional[BetaCacheControlEphemeralParam]
23
27
  """Create a cache control breakpoint at this content block."""
28
+
29
+ caller: Caller
30
+ """Tool invocation directly from the model."""
@@ -2,7 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import Optional
5
+ from typing import List, Optional
6
6
  from typing_extensions import Literal, Required, TypedDict
7
7
 
8
8
  from ..._types import SequenceNotStr
@@ -21,6 +21,8 @@ class BetaWebFetchTool20250910Param(TypedDict, total=False):
21
21
 
22
22
  type: Required[Literal["web_fetch_20250910"]]
23
23
 
24
+ allowed_callers: List[Literal["direct", "code_execution_20250825"]]
25
+
24
26
  allowed_domains: Optional[SequenceNotStr[str]]
25
27
  """List of domains to allow fetching from"""
26
28
 
@@ -36,6 +38,12 @@ class BetaWebFetchTool20250910Param(TypedDict, total=False):
36
38
  Citations are disabled by default.
37
39
  """
38
40
 
41
+ defer_loading: bool
42
+ """If true, tool will not be included in initial system prompt.
43
+
44
+ Only loaded when returned via tool_reference from tool search.
45
+ """
46
+
39
47
  max_content_tokens: Optional[int]
40
48
  """Maximum number of tokens used by including web page text content in the context.
41
49
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import Optional
5
+ from typing import List, Optional
6
6
  from typing_extensions import Literal, Required, TypedDict
7
7
 
8
8
  from ..._types import SequenceNotStr
@@ -12,6 +12,11 @@ __all__ = ["BetaWebSearchTool20250305Param", "UserLocation"]
12
12
 
13
13
 
14
14
  class UserLocation(TypedDict, total=False):
15
+ """Parameters for the user's location.
16
+
17
+ Used to provide more relevant search results.
18
+ """
19
+
15
20
  type: Required[Literal["approximate"]]
16
21
 
17
22
  city: Optional[str]
@@ -40,6 +45,8 @@ class BetaWebSearchTool20250305Param(TypedDict, total=False):
40
45
 
41
46
  type: Required[Literal["web_search_20250305"]]
42
47
 
48
+ allowed_callers: List[Literal["direct", "code_execution_20250825"]]
49
+
43
50
  allowed_domains: Optional[SequenceNotStr[str]]
44
51
  """If provided, only these domains will be included in results.
45
52
 
@@ -55,6 +62,12 @@ class BetaWebSearchTool20250305Param(TypedDict, total=False):
55
62
  cache_control: Optional[BetaCacheControlEphemeralParam]
56
63
  """Create a cache control breakpoint at this content block."""
57
64
 
65
+ defer_loading: bool
66
+ """If true, tool will not be included in initial system prompt.
67
+
68
+ Only loaded when returned via tool_reference from tool search.
69
+ """
70
+
58
71
  max_uses: Optional[int]
59
72
  """Maximum number of times the tool can be used in the API request."""
60
73