anthropic 1.15.2 → 1.16.0

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 (153) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +13 -0
  3. data/README.md +10 -10
  4. data/lib/anthropic/helpers/tools/compaction_control.rb +105 -0
  5. data/lib/anthropic/helpers/tools/runner.rb +126 -13
  6. data/lib/anthropic/models/anthropic_beta.rb +3 -0
  7. data/lib/anthropic/models/beta/beta_code_execution_tool_20250522.rb +28 -1
  8. data/lib/anthropic/models/beta/beta_code_execution_tool_20250825.rb +28 -1
  9. data/lib/anthropic/models/beta/beta_content_block.rb +3 -1
  10. data/lib/anthropic/models/beta/beta_content_block_param.rb +3 -1
  11. data/lib/anthropic/models/beta/beta_direct_caller.rb +21 -0
  12. data/lib/anthropic/models/beta/beta_mcp_tool_config.rb +27 -0
  13. data/lib/anthropic/models/beta/beta_mcp_tool_default_config.rb +27 -0
  14. data/lib/anthropic/models/beta/beta_mcp_toolset.rb +58 -0
  15. data/lib/anthropic/models/beta/beta_memory_tool_20250818.rb +36 -1
  16. data/lib/anthropic/models/beta/beta_message.rb +2 -2
  17. data/lib/anthropic/models/beta/beta_message_param.rb +3 -3
  18. data/lib/anthropic/models/beta/beta_output_config.rb +34 -0
  19. data/lib/anthropic/models/beta/beta_raw_content_block_start_event.rb +5 -3
  20. data/lib/anthropic/models/beta/beta_server_tool_caller.rb +27 -0
  21. data/lib/anthropic/models/beta/beta_server_tool_use_block.rb +32 -1
  22. data/lib/anthropic/models/beta/beta_server_tool_use_block_param.rb +33 -1
  23. data/lib/anthropic/models/beta/beta_tool.rb +36 -1
  24. data/lib/anthropic/models/beta/beta_tool_bash_20241022.rb +36 -1
  25. data/lib/anthropic/models/beta/beta_tool_bash_20250124.rb +36 -1
  26. data/lib/anthropic/models/beta/beta_tool_computer_use_20241022.rb +36 -1
  27. data/lib/anthropic/models/beta/beta_tool_computer_use_20250124.rb +36 -1
  28. data/lib/anthropic/models/beta/beta_tool_computer_use_20251124.rb +114 -0
  29. data/lib/anthropic/models/beta/beta_tool_reference_block.rb +25 -0
  30. data/lib/anthropic/models/beta/beta_tool_reference_block_param.rb +36 -0
  31. data/lib/anthropic/models/beta/beta_tool_result_block_param.rb +8 -4
  32. data/lib/anthropic/models/beta/beta_tool_search_tool_bm25_20251119.rb +85 -0
  33. data/lib/anthropic/models/beta/beta_tool_search_tool_regex_20251119.rb +85 -0
  34. data/lib/anthropic/models/beta/beta_tool_search_tool_result_block.rb +43 -0
  35. data/lib/anthropic/models/beta/beta_tool_search_tool_result_block_param.rb +53 -0
  36. data/lib/anthropic/models/beta/beta_tool_search_tool_result_error.rb +44 -0
  37. data/lib/anthropic/models/beta/beta_tool_search_tool_result_error_param.rb +38 -0
  38. data/lib/anthropic/models/beta/beta_tool_search_tool_search_result_block.rb +26 -0
  39. data/lib/anthropic/models/beta/beta_tool_search_tool_search_result_block_param.rb +26 -0
  40. data/lib/anthropic/models/beta/beta_tool_text_editor_20241022.rb +36 -1
  41. data/lib/anthropic/models/beta/beta_tool_text_editor_20250124.rb +36 -1
  42. data/lib/anthropic/models/beta/beta_tool_text_editor_20250429.rb +36 -1
  43. data/lib/anthropic/models/beta/beta_tool_text_editor_20250728.rb +36 -1
  44. data/lib/anthropic/models/beta/beta_tool_union.rb +17 -1
  45. data/lib/anthropic/models/beta/beta_tool_use_block.rb +30 -1
  46. data/lib/anthropic/models/beta/beta_tool_use_block_param.rb +27 -1
  47. data/lib/anthropic/models/beta/beta_web_fetch_tool_20250910.rb +28 -1
  48. data/lib/anthropic/models/beta/beta_web_search_tool_20250305.rb +28 -1
  49. data/lib/anthropic/models/beta/message_count_tokens_params.rb +29 -4
  50. data/lib/anthropic/models/beta/message_create_params.rb +12 -3
  51. data/lib/anthropic/models/beta/messages/batch_create_params.rb +16 -7
  52. data/lib/anthropic/models/messages/batch_create_params.rb +4 -4
  53. data/lib/anthropic/models/model.rb +10 -0
  54. data/lib/anthropic/resources/beta/messages.rb +26 -11
  55. data/lib/anthropic/resources/messages.rb +8 -2
  56. data/lib/anthropic/version.rb +1 -1
  57. data/lib/anthropic.rb +19 -0
  58. data/manifest.yaml +1 -0
  59. data/rbi/anthropic/models/anthropic_beta.rbi +2 -0
  60. data/rbi/anthropic/models/beta/beta_code_execution_tool_20250522.rbi +77 -0
  61. data/rbi/anthropic/models/beta/beta_code_execution_tool_20250825.rbi +77 -0
  62. data/rbi/anthropic/models/beta/beta_content_block.rbi +1 -0
  63. data/rbi/anthropic/models/beta/beta_content_block_param.rbi +1 -0
  64. data/rbi/anthropic/models/beta/beta_direct_caller.rbi +31 -0
  65. data/rbi/anthropic/models/beta/beta_mcp_tool_config.rbi +46 -0
  66. data/rbi/anthropic/models/beta/beta_mcp_tool_default_config.rbi +46 -0
  67. data/rbi/anthropic/models/beta/beta_mcp_toolset.rbi +100 -0
  68. data/rbi/anthropic/models/beta/beta_memory_tool_20250818.rbi +88 -0
  69. data/rbi/anthropic/models/beta/beta_message.rbi +1 -0
  70. data/rbi/anthropic/models/beta/beta_output_config.rbi +82 -0
  71. data/rbi/anthropic/models/beta/beta_raw_content_block_start_event.rbi +2 -0
  72. data/rbi/anthropic/models/beta/beta_server_tool_caller.rbi +34 -0
  73. data/rbi/anthropic/models/beta/beta_server_tool_use_block.rbi +54 -1
  74. data/rbi/anthropic/models/beta/beta_server_tool_use_block_param.rbi +70 -1
  75. data/rbi/anthropic/models/beta/beta_tool.rbi +75 -0
  76. data/rbi/anthropic/models/beta/beta_tool_bash_20241022.rbi +88 -0
  77. data/rbi/anthropic/models/beta/beta_tool_bash_20250124.rbi +88 -0
  78. data/rbi/anthropic/models/beta/beta_tool_computer_use_20241022.rbi +88 -0
  79. data/rbi/anthropic/models/beta/beta_tool_computer_use_20250124.rbi +88 -0
  80. data/rbi/anthropic/models/beta/beta_tool_computer_use_20251124.rbi +204 -0
  81. data/rbi/anthropic/models/beta/beta_tool_reference_block.rbi +35 -0
  82. data/rbi/anthropic/models/beta/beta_tool_reference_block_param.rbi +67 -0
  83. data/rbi/anthropic/models/beta/beta_tool_result_block_param.rbi +3 -1
  84. data/rbi/anthropic/models/beta/beta_tool_search_tool_bm25_20251119.rbi +198 -0
  85. data/rbi/anthropic/models/beta/beta_tool_search_tool_regex_20251119.rbi +198 -0
  86. data/rbi/anthropic/models/beta/beta_tool_search_tool_result_block.rbi +81 -0
  87. data/rbi/anthropic/models/beta/beta_tool_search_tool_result_block_param.rbi +110 -0
  88. data/rbi/anthropic/models/beta/beta_tool_search_tool_result_error.rbi +104 -0
  89. data/rbi/anthropic/models/beta/beta_tool_search_tool_result_error_param.rbi +96 -0
  90. data/rbi/anthropic/models/beta/beta_tool_search_tool_search_result_block.rbi +48 -0
  91. data/rbi/anthropic/models/beta/beta_tool_search_tool_search_result_block_param.rbi +48 -0
  92. data/rbi/anthropic/models/beta/beta_tool_text_editor_20241022.rbi +88 -0
  93. data/rbi/anthropic/models/beta/beta_tool_text_editor_20250124.rbi +88 -0
  94. data/rbi/anthropic/models/beta/beta_tool_text_editor_20250429.rbi +88 -0
  95. data/rbi/anthropic/models/beta/beta_tool_text_editor_20250728.rbi +88 -0
  96. data/rbi/anthropic/models/beta/beta_tool_union.rbi +9 -1
  97. data/rbi/anthropic/models/beta/beta_tool_use_block.rbi +55 -2
  98. data/rbi/anthropic/models/beta/beta_tool_use_block_param.rbi +58 -1
  99. data/rbi/anthropic/models/beta/beta_web_fetch_tool_20250910.rbi +77 -0
  100. data/rbi/anthropic/models/beta/beta_web_search_tool_20250305.rbi +77 -0
  101. data/rbi/anthropic/models/beta/message_count_tokens_params.rbi +44 -5
  102. data/rbi/anthropic/models/beta/message_create_params.rbi +35 -4
  103. data/rbi/anthropic/models/beta/messages/batch_create_params.rbi +43 -10
  104. data/rbi/anthropic/models/messages/batch_create_params.rbi +6 -6
  105. data/rbi/anthropic/models/model.rbi +8 -0
  106. data/rbi/anthropic/resources/beta/messages.rbi +29 -3
  107. data/sig/anthropic/models/anthropic_beta.rbs +2 -0
  108. data/sig/anthropic/models/beta/beta_code_execution_tool_20250522.rbs +27 -0
  109. data/sig/anthropic/models/beta/beta_code_execution_tool_20250825.rbs +27 -0
  110. data/sig/anthropic/models/beta/beta_content_block.rbs +1 -0
  111. data/sig/anthropic/models/beta/beta_content_block_param.rbs +1 -0
  112. data/sig/anthropic/models/beta/beta_direct_caller.rbs +17 -0
  113. data/sig/anthropic/models/beta/beta_mcp_tool_config.rbs +23 -0
  114. data/sig/anthropic/models/beta/beta_mcp_tool_default_config.rbs +23 -0
  115. data/sig/anthropic/models/beta/beta_mcp_toolset.rbs +48 -0
  116. data/sig/anthropic/models/beta/beta_memory_tool_20250818.rbs +36 -0
  117. data/sig/anthropic/models/beta/beta_output_config.rbs +34 -0
  118. data/sig/anthropic/models/beta/beta_raw_content_block_start_event.rbs +1 -0
  119. data/sig/anthropic/models/beta/beta_server_tool_caller.rbs +23 -0
  120. data/sig/anthropic/models/beta/beta_server_tool_use_block.rbs +19 -0
  121. data/sig/anthropic/models/beta/beta_server_tool_use_block_param.rbs +25 -2
  122. data/sig/anthropic/models/beta/beta_tool.rbs +36 -0
  123. data/sig/anthropic/models/beta/beta_tool_bash_20241022.rbs +36 -0
  124. data/sig/anthropic/models/beta/beta_tool_bash_20250124.rbs +36 -0
  125. data/sig/anthropic/models/beta/beta_tool_computer_use_20241022.rbs +36 -0
  126. data/sig/anthropic/models/beta/beta_tool_computer_use_20250124.rbs +36 -0
  127. data/sig/anthropic/models/beta/beta_tool_computer_use_20251124.rbs +99 -0
  128. data/sig/anthropic/models/beta/beta_tool_reference_block.rbs +20 -0
  129. data/sig/anthropic/models/beta/beta_tool_reference_block_param.rbs +34 -0
  130. data/sig/anthropic/models/beta/beta_tool_result_block_param.rbs +1 -0
  131. data/sig/anthropic/models/beta/beta_tool_search_tool_bm25_20251119.rbs +79 -0
  132. data/sig/anthropic/models/beta/beta_tool_search_tool_regex_20251119.rbs +79 -0
  133. data/sig/anthropic/models/beta/beta_tool_search_tool_result_block.rbs +44 -0
  134. data/sig/anthropic/models/beta/beta_tool_search_tool_result_block_param.rbs +49 -0
  135. data/sig/anthropic/models/beta/beta_tool_search_tool_result_error.rbs +51 -0
  136. data/sig/anthropic/models/beta/beta_tool_search_tool_result_error_param.rbs +46 -0
  137. data/sig/anthropic/models/beta/beta_tool_search_tool_search_result_block.rbs +29 -0
  138. data/sig/anthropic/models/beta/beta_tool_search_tool_search_result_block_param.rbs +29 -0
  139. data/sig/anthropic/models/beta/beta_tool_text_editor_20241022.rbs +36 -0
  140. data/sig/anthropic/models/beta/beta_tool_text_editor_20250124.rbs +36 -0
  141. data/sig/anthropic/models/beta/beta_tool_text_editor_20250429.rbs +36 -0
  142. data/sig/anthropic/models/beta/beta_tool_text_editor_20250728.rbs +36 -0
  143. data/sig/anthropic/models/beta/beta_tool_union.rbs +4 -0
  144. data/sig/anthropic/models/beta/beta_tool_use_block.rbs +21 -2
  145. data/sig/anthropic/models/beta/beta_tool_use_block_param.rbs +21 -2
  146. data/sig/anthropic/models/beta/beta_web_fetch_tool_20250910.rbs +27 -0
  147. data/sig/anthropic/models/beta/beta_web_search_tool_20250305.rbs +27 -0
  148. data/sig/anthropic/models/beta/message_count_tokens_params.rbs +13 -0
  149. data/sig/anthropic/models/beta/message_create_params.rbs +9 -0
  150. data/sig/anthropic/models/beta/messages/batch_create_params.rbs +9 -0
  151. data/sig/anthropic/models/model.rbs +9 -1
  152. data/sig/anthropic/resources/beta/messages.rbs +3 -0
  153. metadata +54 -2
@@ -0,0 +1,67 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ BetaToolReferenceBlockParam = Beta::BetaToolReferenceBlockParam
6
+
7
+ module Beta
8
+ class BetaToolReferenceBlockParam < Anthropic::Internal::Type::BaseModel
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(
12
+ Anthropic::Beta::BetaToolReferenceBlockParam,
13
+ Anthropic::Internal::AnyHash
14
+ )
15
+ end
16
+
17
+ sig { returns(String) }
18
+ attr_accessor :tool_name
19
+
20
+ sig { returns(Symbol) }
21
+ attr_accessor :type
22
+
23
+ # Create a cache control breakpoint at this content block.
24
+ sig { returns(T.nilable(Anthropic::Beta::BetaCacheControlEphemeral)) }
25
+ attr_reader :cache_control
26
+
27
+ sig do
28
+ params(
29
+ cache_control:
30
+ T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash)
31
+ ).void
32
+ end
33
+ attr_writer :cache_control
34
+
35
+ # Tool reference block that can be included in tool_result content.
36
+ sig do
37
+ params(
38
+ tool_name: String,
39
+ cache_control:
40
+ T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash),
41
+ type: Symbol
42
+ ).returns(T.attached_class)
43
+ end
44
+ def self.new(
45
+ tool_name:,
46
+ # Create a cache control breakpoint at this content block.
47
+ cache_control: nil,
48
+ type: :tool_reference
49
+ )
50
+ end
51
+
52
+ sig do
53
+ override.returns(
54
+ {
55
+ tool_name: String,
56
+ type: Symbol,
57
+ cache_control:
58
+ T.nilable(Anthropic::Beta::BetaCacheControlEphemeral)
59
+ }
60
+ )
61
+ end
62
+ def to_hash
63
+ end
64
+ end
65
+ end
66
+ end
67
+ end
@@ -105,6 +105,7 @@ module Anthropic
105
105
  )
106
106
  end
107
107
 
108
+ # Tool reference block that can be included in tool_result content.
108
109
  module Content
109
110
  extend Anthropic::Internal::Type::Union
110
111
 
@@ -114,7 +115,8 @@ module Anthropic
114
115
  Anthropic::Beta::BetaTextBlockParam,
115
116
  Anthropic::Beta::BetaImageBlockParam,
116
117
  Anthropic::Beta::BetaSearchResultBlockParam,
117
- Anthropic::Beta::BetaRequestDocumentBlock
118
+ Anthropic::Beta::BetaRequestDocumentBlock,
119
+ Anthropic::Beta::BetaToolReferenceBlockParam
118
120
  )
119
121
  end
120
122
 
@@ -0,0 +1,198 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ BetaToolSearchToolBm25_20251119 = Beta::BetaToolSearchToolBm25_20251119
6
+
7
+ module Beta
8
+ class BetaToolSearchToolBm25_20251119 < Anthropic::Internal::Type::BaseModel
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(
12
+ Anthropic::Beta::BetaToolSearchToolBm25_20251119,
13
+ Anthropic::Internal::AnyHash
14
+ )
15
+ end
16
+
17
+ # Name of the tool.
18
+ #
19
+ # This is how the tool will be called by the model and in `tool_use` blocks.
20
+ sig { returns(Symbol) }
21
+ attr_accessor :name
22
+
23
+ sig do
24
+ returns(
25
+ Anthropic::Beta::BetaToolSearchToolBm25_20251119::Type::OrSymbol
26
+ )
27
+ end
28
+ attr_accessor :type
29
+
30
+ sig do
31
+ returns(
32
+ T.nilable(
33
+ T::Array[
34
+ Anthropic::Beta::BetaToolSearchToolBm25_20251119::AllowedCaller::OrSymbol
35
+ ]
36
+ )
37
+ )
38
+ end
39
+ attr_reader :allowed_callers
40
+
41
+ sig do
42
+ params(
43
+ allowed_callers:
44
+ T::Array[
45
+ Anthropic::Beta::BetaToolSearchToolBm25_20251119::AllowedCaller::OrSymbol
46
+ ]
47
+ ).void
48
+ end
49
+ attr_writer :allowed_callers
50
+
51
+ # Create a cache control breakpoint at this content block.
52
+ sig { returns(T.nilable(Anthropic::Beta::BetaCacheControlEphemeral)) }
53
+ attr_reader :cache_control
54
+
55
+ sig do
56
+ params(
57
+ cache_control:
58
+ T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash)
59
+ ).void
60
+ end
61
+ attr_writer :cache_control
62
+
63
+ # If true, tool will not be included in initial system prompt. Only loaded when
64
+ # returned via tool_reference from tool search.
65
+ sig { returns(T.nilable(T::Boolean)) }
66
+ attr_reader :defer_loading
67
+
68
+ sig { params(defer_loading: T::Boolean).void }
69
+ attr_writer :defer_loading
70
+
71
+ sig { returns(T.nilable(T::Boolean)) }
72
+ attr_reader :strict
73
+
74
+ sig { params(strict: T::Boolean).void }
75
+ attr_writer :strict
76
+
77
+ sig do
78
+ params(
79
+ type:
80
+ Anthropic::Beta::BetaToolSearchToolBm25_20251119::Type::OrSymbol,
81
+ allowed_callers:
82
+ T::Array[
83
+ Anthropic::Beta::BetaToolSearchToolBm25_20251119::AllowedCaller::OrSymbol
84
+ ],
85
+ cache_control:
86
+ T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash),
87
+ defer_loading: T::Boolean,
88
+ strict: T::Boolean,
89
+ name: Symbol
90
+ ).returns(T.attached_class)
91
+ end
92
+ def self.new(
93
+ type:,
94
+ allowed_callers: nil,
95
+ # Create a cache control breakpoint at this content block.
96
+ cache_control: nil,
97
+ # If true, tool will not be included in initial system prompt. Only loaded when
98
+ # returned via tool_reference from tool search.
99
+ defer_loading: nil,
100
+ strict: nil,
101
+ # Name of the tool.
102
+ #
103
+ # This is how the tool will be called by the model and in `tool_use` blocks.
104
+ name: :tool_search_tool_bm25
105
+ )
106
+ end
107
+
108
+ sig do
109
+ override.returns(
110
+ {
111
+ name: Symbol,
112
+ type:
113
+ Anthropic::Beta::BetaToolSearchToolBm25_20251119::Type::OrSymbol,
114
+ allowed_callers:
115
+ T::Array[
116
+ Anthropic::Beta::BetaToolSearchToolBm25_20251119::AllowedCaller::OrSymbol
117
+ ],
118
+ cache_control:
119
+ T.nilable(Anthropic::Beta::BetaCacheControlEphemeral),
120
+ defer_loading: T::Boolean,
121
+ strict: T::Boolean
122
+ }
123
+ )
124
+ end
125
+ def to_hash
126
+ end
127
+
128
+ module Type
129
+ extend Anthropic::Internal::Type::Enum
130
+
131
+ TaggedSymbol =
132
+ T.type_alias do
133
+ T.all(
134
+ Symbol,
135
+ Anthropic::Beta::BetaToolSearchToolBm25_20251119::Type
136
+ )
137
+ end
138
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
139
+
140
+ TOOL_SEARCH_TOOL_BM25_20251119 =
141
+ T.let(
142
+ :tool_search_tool_bm25_20251119,
143
+ Anthropic::Beta::BetaToolSearchToolBm25_20251119::Type::TaggedSymbol
144
+ )
145
+ TOOL_SEARCH_TOOL_BM25 =
146
+ T.let(
147
+ :tool_search_tool_bm25,
148
+ Anthropic::Beta::BetaToolSearchToolBm25_20251119::Type::TaggedSymbol
149
+ )
150
+
151
+ sig do
152
+ override.returns(
153
+ T::Array[
154
+ Anthropic::Beta::BetaToolSearchToolBm25_20251119::Type::TaggedSymbol
155
+ ]
156
+ )
157
+ end
158
+ def self.values
159
+ end
160
+ end
161
+
162
+ module AllowedCaller
163
+ extend Anthropic::Internal::Type::Enum
164
+
165
+ TaggedSymbol =
166
+ T.type_alias do
167
+ T.all(
168
+ Symbol,
169
+ Anthropic::Beta::BetaToolSearchToolBm25_20251119::AllowedCaller
170
+ )
171
+ end
172
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
173
+
174
+ DIRECT =
175
+ T.let(
176
+ :direct,
177
+ Anthropic::Beta::BetaToolSearchToolBm25_20251119::AllowedCaller::TaggedSymbol
178
+ )
179
+ CODE_EXECUTION_20250825 =
180
+ T.let(
181
+ :code_execution_20250825,
182
+ Anthropic::Beta::BetaToolSearchToolBm25_20251119::AllowedCaller::TaggedSymbol
183
+ )
184
+
185
+ sig do
186
+ override.returns(
187
+ T::Array[
188
+ Anthropic::Beta::BetaToolSearchToolBm25_20251119::AllowedCaller::TaggedSymbol
189
+ ]
190
+ )
191
+ end
192
+ def self.values
193
+ end
194
+ end
195
+ end
196
+ end
197
+ end
198
+ end
@@ -0,0 +1,198 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ BetaToolSearchToolRegex20251119 = Beta::BetaToolSearchToolRegex20251119
6
+
7
+ module Beta
8
+ class BetaToolSearchToolRegex20251119 < Anthropic::Internal::Type::BaseModel
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(
12
+ Anthropic::Beta::BetaToolSearchToolRegex20251119,
13
+ Anthropic::Internal::AnyHash
14
+ )
15
+ end
16
+
17
+ # Name of the tool.
18
+ #
19
+ # This is how the tool will be called by the model and in `tool_use` blocks.
20
+ sig { returns(Symbol) }
21
+ attr_accessor :name
22
+
23
+ sig do
24
+ returns(
25
+ Anthropic::Beta::BetaToolSearchToolRegex20251119::Type::OrSymbol
26
+ )
27
+ end
28
+ attr_accessor :type
29
+
30
+ sig do
31
+ returns(
32
+ T.nilable(
33
+ T::Array[
34
+ Anthropic::Beta::BetaToolSearchToolRegex20251119::AllowedCaller::OrSymbol
35
+ ]
36
+ )
37
+ )
38
+ end
39
+ attr_reader :allowed_callers
40
+
41
+ sig do
42
+ params(
43
+ allowed_callers:
44
+ T::Array[
45
+ Anthropic::Beta::BetaToolSearchToolRegex20251119::AllowedCaller::OrSymbol
46
+ ]
47
+ ).void
48
+ end
49
+ attr_writer :allowed_callers
50
+
51
+ # Create a cache control breakpoint at this content block.
52
+ sig { returns(T.nilable(Anthropic::Beta::BetaCacheControlEphemeral)) }
53
+ attr_reader :cache_control
54
+
55
+ sig do
56
+ params(
57
+ cache_control:
58
+ T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash)
59
+ ).void
60
+ end
61
+ attr_writer :cache_control
62
+
63
+ # If true, tool will not be included in initial system prompt. Only loaded when
64
+ # returned via tool_reference from tool search.
65
+ sig { returns(T.nilable(T::Boolean)) }
66
+ attr_reader :defer_loading
67
+
68
+ sig { params(defer_loading: T::Boolean).void }
69
+ attr_writer :defer_loading
70
+
71
+ sig { returns(T.nilable(T::Boolean)) }
72
+ attr_reader :strict
73
+
74
+ sig { params(strict: T::Boolean).void }
75
+ attr_writer :strict
76
+
77
+ sig do
78
+ params(
79
+ type:
80
+ Anthropic::Beta::BetaToolSearchToolRegex20251119::Type::OrSymbol,
81
+ allowed_callers:
82
+ T::Array[
83
+ Anthropic::Beta::BetaToolSearchToolRegex20251119::AllowedCaller::OrSymbol
84
+ ],
85
+ cache_control:
86
+ T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash),
87
+ defer_loading: T::Boolean,
88
+ strict: T::Boolean,
89
+ name: Symbol
90
+ ).returns(T.attached_class)
91
+ end
92
+ def self.new(
93
+ type:,
94
+ allowed_callers: nil,
95
+ # Create a cache control breakpoint at this content block.
96
+ cache_control: nil,
97
+ # If true, tool will not be included in initial system prompt. Only loaded when
98
+ # returned via tool_reference from tool search.
99
+ defer_loading: nil,
100
+ strict: nil,
101
+ # Name of the tool.
102
+ #
103
+ # This is how the tool will be called by the model and in `tool_use` blocks.
104
+ name: :tool_search_tool_regex
105
+ )
106
+ end
107
+
108
+ sig do
109
+ override.returns(
110
+ {
111
+ name: Symbol,
112
+ type:
113
+ Anthropic::Beta::BetaToolSearchToolRegex20251119::Type::OrSymbol,
114
+ allowed_callers:
115
+ T::Array[
116
+ Anthropic::Beta::BetaToolSearchToolRegex20251119::AllowedCaller::OrSymbol
117
+ ],
118
+ cache_control:
119
+ T.nilable(Anthropic::Beta::BetaCacheControlEphemeral),
120
+ defer_loading: T::Boolean,
121
+ strict: T::Boolean
122
+ }
123
+ )
124
+ end
125
+ def to_hash
126
+ end
127
+
128
+ module Type
129
+ extend Anthropic::Internal::Type::Enum
130
+
131
+ TaggedSymbol =
132
+ T.type_alias do
133
+ T.all(
134
+ Symbol,
135
+ Anthropic::Beta::BetaToolSearchToolRegex20251119::Type
136
+ )
137
+ end
138
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
139
+
140
+ TOOL_SEARCH_TOOL_REGEX_20251119 =
141
+ T.let(
142
+ :tool_search_tool_regex_20251119,
143
+ Anthropic::Beta::BetaToolSearchToolRegex20251119::Type::TaggedSymbol
144
+ )
145
+ TOOL_SEARCH_TOOL_REGEX =
146
+ T.let(
147
+ :tool_search_tool_regex,
148
+ Anthropic::Beta::BetaToolSearchToolRegex20251119::Type::TaggedSymbol
149
+ )
150
+
151
+ sig do
152
+ override.returns(
153
+ T::Array[
154
+ Anthropic::Beta::BetaToolSearchToolRegex20251119::Type::TaggedSymbol
155
+ ]
156
+ )
157
+ end
158
+ def self.values
159
+ end
160
+ end
161
+
162
+ module AllowedCaller
163
+ extend Anthropic::Internal::Type::Enum
164
+
165
+ TaggedSymbol =
166
+ T.type_alias do
167
+ T.all(
168
+ Symbol,
169
+ Anthropic::Beta::BetaToolSearchToolRegex20251119::AllowedCaller
170
+ )
171
+ end
172
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
173
+
174
+ DIRECT =
175
+ T.let(
176
+ :direct,
177
+ Anthropic::Beta::BetaToolSearchToolRegex20251119::AllowedCaller::TaggedSymbol
178
+ )
179
+ CODE_EXECUTION_20250825 =
180
+ T.let(
181
+ :code_execution_20250825,
182
+ Anthropic::Beta::BetaToolSearchToolRegex20251119::AllowedCaller::TaggedSymbol
183
+ )
184
+
185
+ sig do
186
+ override.returns(
187
+ T::Array[
188
+ Anthropic::Beta::BetaToolSearchToolRegex20251119::AllowedCaller::TaggedSymbol
189
+ ]
190
+ )
191
+ end
192
+ def self.values
193
+ end
194
+ end
195
+ end
196
+ end
197
+ end
198
+ end
@@ -0,0 +1,81 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ BetaToolSearchToolResultBlock = Beta::BetaToolSearchToolResultBlock
6
+
7
+ module Beta
8
+ class BetaToolSearchToolResultBlock < Anthropic::Internal::Type::BaseModel
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(
12
+ Anthropic::Beta::BetaToolSearchToolResultBlock,
13
+ Anthropic::Internal::AnyHash
14
+ )
15
+ end
16
+
17
+ sig do
18
+ returns(
19
+ Anthropic::Beta::BetaToolSearchToolResultBlock::Content::Variants
20
+ )
21
+ end
22
+ attr_accessor :content
23
+
24
+ sig { returns(String) }
25
+ attr_accessor :tool_use_id
26
+
27
+ sig { returns(Symbol) }
28
+ attr_accessor :type
29
+
30
+ sig do
31
+ params(
32
+ content:
33
+ T.any(
34
+ Anthropic::Beta::BetaToolSearchToolResultError::OrHash,
35
+ Anthropic::Beta::BetaToolSearchToolSearchResultBlock::OrHash
36
+ ),
37
+ tool_use_id: String,
38
+ type: Symbol
39
+ ).returns(T.attached_class)
40
+ end
41
+ def self.new(content:, tool_use_id:, type: :tool_search_tool_result)
42
+ end
43
+
44
+ sig do
45
+ override.returns(
46
+ {
47
+ content:
48
+ Anthropic::Beta::BetaToolSearchToolResultBlock::Content::Variants,
49
+ tool_use_id: String,
50
+ type: Symbol
51
+ }
52
+ )
53
+ end
54
+ def to_hash
55
+ end
56
+
57
+ module Content
58
+ extend Anthropic::Internal::Type::Union
59
+
60
+ Variants =
61
+ T.type_alias do
62
+ T.any(
63
+ Anthropic::Beta::BetaToolSearchToolResultError,
64
+ Anthropic::Beta::BetaToolSearchToolSearchResultBlock
65
+ )
66
+ end
67
+
68
+ sig do
69
+ override.returns(
70
+ T::Array[
71
+ Anthropic::Beta::BetaToolSearchToolResultBlock::Content::Variants
72
+ ]
73
+ )
74
+ end
75
+ def self.variants
76
+ end
77
+ end
78
+ end
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,110 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ BetaToolSearchToolResultBlockParam =
6
+ Beta::BetaToolSearchToolResultBlockParam
7
+
8
+ module Beta
9
+ class BetaToolSearchToolResultBlockParam < Anthropic::Internal::Type::BaseModel
10
+ OrHash =
11
+ T.type_alias do
12
+ T.any(
13
+ Anthropic::Beta::BetaToolSearchToolResultBlockParam,
14
+ Anthropic::Internal::AnyHash
15
+ )
16
+ end
17
+
18
+ sig do
19
+ returns(
20
+ T.any(
21
+ Anthropic::Beta::BetaToolSearchToolResultErrorParam,
22
+ Anthropic::Beta::BetaToolSearchToolSearchResultBlockParam
23
+ )
24
+ )
25
+ end
26
+ attr_accessor :content
27
+
28
+ sig { returns(String) }
29
+ attr_accessor :tool_use_id
30
+
31
+ sig { returns(Symbol) }
32
+ attr_accessor :type
33
+
34
+ # Create a cache control breakpoint at this content block.
35
+ sig { returns(T.nilable(Anthropic::Beta::BetaCacheControlEphemeral)) }
36
+ attr_reader :cache_control
37
+
38
+ sig do
39
+ params(
40
+ cache_control:
41
+ T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash)
42
+ ).void
43
+ end
44
+ attr_writer :cache_control
45
+
46
+ sig do
47
+ params(
48
+ content:
49
+ T.any(
50
+ Anthropic::Beta::BetaToolSearchToolResultErrorParam::OrHash,
51
+ Anthropic::Beta::BetaToolSearchToolSearchResultBlockParam::OrHash
52
+ ),
53
+ tool_use_id: String,
54
+ cache_control:
55
+ T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash),
56
+ type: Symbol
57
+ ).returns(T.attached_class)
58
+ end
59
+ def self.new(
60
+ content:,
61
+ tool_use_id:,
62
+ # Create a cache control breakpoint at this content block.
63
+ cache_control: nil,
64
+ type: :tool_search_tool_result
65
+ )
66
+ end
67
+
68
+ sig do
69
+ override.returns(
70
+ {
71
+ content:
72
+ T.any(
73
+ Anthropic::Beta::BetaToolSearchToolResultErrorParam,
74
+ Anthropic::Beta::BetaToolSearchToolSearchResultBlockParam
75
+ ),
76
+ tool_use_id: String,
77
+ type: Symbol,
78
+ cache_control:
79
+ T.nilable(Anthropic::Beta::BetaCacheControlEphemeral)
80
+ }
81
+ )
82
+ end
83
+ def to_hash
84
+ end
85
+
86
+ module Content
87
+ extend Anthropic::Internal::Type::Union
88
+
89
+ Variants =
90
+ T.type_alias do
91
+ T.any(
92
+ Anthropic::Beta::BetaToolSearchToolResultErrorParam,
93
+ Anthropic::Beta::BetaToolSearchToolSearchResultBlockParam
94
+ )
95
+ end
96
+
97
+ sig do
98
+ override.returns(
99
+ T::Array[
100
+ Anthropic::Beta::BetaToolSearchToolResultBlockParam::Content::Variants
101
+ ]
102
+ )
103
+ end
104
+ def self.variants
105
+ end
106
+ end
107
+ end
108
+ end
109
+ end
110
+ end