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
@@ -23,6 +23,27 @@ module Anthropic
23
23
  sig { returns(Symbol) }
24
24
  attr_accessor :type
25
25
 
26
+ sig do
27
+ returns(
28
+ T.nilable(
29
+ T::Array[
30
+ Anthropic::Beta::BetaToolBash20250124::AllowedCaller::OrSymbol
31
+ ]
32
+ )
33
+ )
34
+ end
35
+ attr_reader :allowed_callers
36
+
37
+ sig do
38
+ params(
39
+ allowed_callers:
40
+ T::Array[
41
+ Anthropic::Beta::BetaToolBash20250124::AllowedCaller::OrSymbol
42
+ ]
43
+ ).void
44
+ end
45
+ attr_writer :allowed_callers
46
+
26
47
  # Create a cache control breakpoint at this content block.
27
48
  sig { returns(T.nilable(Anthropic::Beta::BetaCacheControlEphemeral)) }
28
49
  attr_reader :cache_control
@@ -35,6 +56,22 @@ module Anthropic
35
56
  end
36
57
  attr_writer :cache_control
37
58
 
59
+ # If true, tool will not be included in initial system prompt. Only loaded when
60
+ # returned via tool_reference from tool search.
61
+ sig { returns(T.nilable(T::Boolean)) }
62
+ attr_reader :defer_loading
63
+
64
+ sig { params(defer_loading: T::Boolean).void }
65
+ attr_writer :defer_loading
66
+
67
+ sig { returns(T.nilable(T::Array[T::Hash[Symbol, T.anything]])) }
68
+ attr_reader :input_examples
69
+
70
+ sig do
71
+ params(input_examples: T::Array[T::Hash[Symbol, T.anything]]).void
72
+ end
73
+ attr_writer :input_examples
74
+
38
75
  sig { returns(T.nilable(T::Boolean)) }
39
76
  attr_reader :strict
40
77
 
@@ -43,16 +80,27 @@ module Anthropic
43
80
 
44
81
  sig do
45
82
  params(
83
+ allowed_callers:
84
+ T::Array[
85
+ Anthropic::Beta::BetaToolBash20250124::AllowedCaller::OrSymbol
86
+ ],
46
87
  cache_control:
47
88
  T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash),
89
+ defer_loading: T::Boolean,
90
+ input_examples: T::Array[T::Hash[Symbol, T.anything]],
48
91
  strict: T::Boolean,
49
92
  name: Symbol,
50
93
  type: Symbol
51
94
  ).returns(T.attached_class)
52
95
  end
53
96
  def self.new(
97
+ allowed_callers: nil,
54
98
  # Create a cache control breakpoint at this content block.
55
99
  cache_control: nil,
100
+ # If true, tool will not be included in initial system prompt. Only loaded when
101
+ # returned via tool_reference from tool search.
102
+ defer_loading: nil,
103
+ input_examples: nil,
56
104
  strict: nil,
57
105
  # Name of the tool.
58
106
  #
@@ -67,14 +115,54 @@ module Anthropic
67
115
  {
68
116
  name: Symbol,
69
117
  type: Symbol,
118
+ allowed_callers:
119
+ T::Array[
120
+ Anthropic::Beta::BetaToolBash20250124::AllowedCaller::OrSymbol
121
+ ],
70
122
  cache_control:
71
123
  T.nilable(Anthropic::Beta::BetaCacheControlEphemeral),
124
+ defer_loading: T::Boolean,
125
+ input_examples: T::Array[T::Hash[Symbol, T.anything]],
72
126
  strict: T::Boolean
73
127
  }
74
128
  )
75
129
  end
76
130
  def to_hash
77
131
  end
132
+
133
+ module AllowedCaller
134
+ extend Anthropic::Internal::Type::Enum
135
+
136
+ TaggedSymbol =
137
+ T.type_alias do
138
+ T.all(
139
+ Symbol,
140
+ Anthropic::Beta::BetaToolBash20250124::AllowedCaller
141
+ )
142
+ end
143
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
144
+
145
+ DIRECT =
146
+ T.let(
147
+ :direct,
148
+ Anthropic::Beta::BetaToolBash20250124::AllowedCaller::TaggedSymbol
149
+ )
150
+ CODE_EXECUTION_20250825 =
151
+ T.let(
152
+ :code_execution_20250825,
153
+ Anthropic::Beta::BetaToolBash20250124::AllowedCaller::TaggedSymbol
154
+ )
155
+
156
+ sig do
157
+ override.returns(
158
+ T::Array[
159
+ Anthropic::Beta::BetaToolBash20250124::AllowedCaller::TaggedSymbol
160
+ ]
161
+ )
162
+ end
163
+ def self.values
164
+ end
165
+ end
78
166
  end
79
167
  end
80
168
  end
@@ -31,6 +31,27 @@ module Anthropic
31
31
  sig { returns(Symbol) }
32
32
  attr_accessor :type
33
33
 
34
+ sig do
35
+ returns(
36
+ T.nilable(
37
+ T::Array[
38
+ Anthropic::Beta::BetaToolComputerUse20241022::AllowedCaller::OrSymbol
39
+ ]
40
+ )
41
+ )
42
+ end
43
+ attr_reader :allowed_callers
44
+
45
+ sig do
46
+ params(
47
+ allowed_callers:
48
+ T::Array[
49
+ Anthropic::Beta::BetaToolComputerUse20241022::AllowedCaller::OrSymbol
50
+ ]
51
+ ).void
52
+ end
53
+ attr_writer :allowed_callers
54
+
34
55
  # Create a cache control breakpoint at this content block.
35
56
  sig { returns(T.nilable(Anthropic::Beta::BetaCacheControlEphemeral)) }
36
57
  attr_reader :cache_control
@@ -43,10 +64,26 @@ module Anthropic
43
64
  end
44
65
  attr_writer :cache_control
45
66
 
67
+ # If true, tool will not be included in initial system prompt. Only loaded when
68
+ # returned via tool_reference from tool search.
69
+ sig { returns(T.nilable(T::Boolean)) }
70
+ attr_reader :defer_loading
71
+
72
+ sig { params(defer_loading: T::Boolean).void }
73
+ attr_writer :defer_loading
74
+
46
75
  # The X11 display number (e.g. 0, 1) for the display.
47
76
  sig { returns(T.nilable(Integer)) }
48
77
  attr_accessor :display_number
49
78
 
79
+ sig { returns(T.nilable(T::Array[T::Hash[Symbol, T.anything]])) }
80
+ attr_reader :input_examples
81
+
82
+ sig do
83
+ params(input_examples: T::Array[T::Hash[Symbol, T.anything]]).void
84
+ end
85
+ attr_writer :input_examples
86
+
50
87
  sig { returns(T.nilable(T::Boolean)) }
51
88
  attr_reader :strict
52
89
 
@@ -57,9 +94,15 @@ module Anthropic
57
94
  params(
58
95
  display_height_px: Integer,
59
96
  display_width_px: Integer,
97
+ allowed_callers:
98
+ T::Array[
99
+ Anthropic::Beta::BetaToolComputerUse20241022::AllowedCaller::OrSymbol
100
+ ],
60
101
  cache_control:
61
102
  T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash),
103
+ defer_loading: T::Boolean,
62
104
  display_number: T.nilable(Integer),
105
+ input_examples: T::Array[T::Hash[Symbol, T.anything]],
63
106
  strict: T::Boolean,
64
107
  name: Symbol,
65
108
  type: Symbol
@@ -70,10 +113,15 @@ module Anthropic
70
113
  display_height_px:,
71
114
  # The width of the display in pixels.
72
115
  display_width_px:,
116
+ allowed_callers: nil,
73
117
  # Create a cache control breakpoint at this content block.
74
118
  cache_control: nil,
119
+ # If true, tool will not be included in initial system prompt. Only loaded when
120
+ # returned via tool_reference from tool search.
121
+ defer_loading: nil,
75
122
  # The X11 display number (e.g. 0, 1) for the display.
76
123
  display_number: nil,
124
+ input_examples: nil,
77
125
  strict: nil,
78
126
  # Name of the tool.
79
127
  #
@@ -90,15 +138,55 @@ module Anthropic
90
138
  display_width_px: Integer,
91
139
  name: Symbol,
92
140
  type: Symbol,
141
+ allowed_callers:
142
+ T::Array[
143
+ Anthropic::Beta::BetaToolComputerUse20241022::AllowedCaller::OrSymbol
144
+ ],
93
145
  cache_control:
94
146
  T.nilable(Anthropic::Beta::BetaCacheControlEphemeral),
147
+ defer_loading: T::Boolean,
95
148
  display_number: T.nilable(Integer),
149
+ input_examples: T::Array[T::Hash[Symbol, T.anything]],
96
150
  strict: T::Boolean
97
151
  }
98
152
  )
99
153
  end
100
154
  def to_hash
101
155
  end
156
+
157
+ module AllowedCaller
158
+ extend Anthropic::Internal::Type::Enum
159
+
160
+ TaggedSymbol =
161
+ T.type_alias do
162
+ T.all(
163
+ Symbol,
164
+ Anthropic::Beta::BetaToolComputerUse20241022::AllowedCaller
165
+ )
166
+ end
167
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
168
+
169
+ DIRECT =
170
+ T.let(
171
+ :direct,
172
+ Anthropic::Beta::BetaToolComputerUse20241022::AllowedCaller::TaggedSymbol
173
+ )
174
+ CODE_EXECUTION_20250825 =
175
+ T.let(
176
+ :code_execution_20250825,
177
+ Anthropic::Beta::BetaToolComputerUse20241022::AllowedCaller::TaggedSymbol
178
+ )
179
+
180
+ sig do
181
+ override.returns(
182
+ T::Array[
183
+ Anthropic::Beta::BetaToolComputerUse20241022::AllowedCaller::TaggedSymbol
184
+ ]
185
+ )
186
+ end
187
+ def self.values
188
+ end
189
+ end
102
190
  end
103
191
  end
104
192
  end
@@ -31,6 +31,27 @@ module Anthropic
31
31
  sig { returns(Symbol) }
32
32
  attr_accessor :type
33
33
 
34
+ sig do
35
+ returns(
36
+ T.nilable(
37
+ T::Array[
38
+ Anthropic::Beta::BetaToolComputerUse20250124::AllowedCaller::OrSymbol
39
+ ]
40
+ )
41
+ )
42
+ end
43
+ attr_reader :allowed_callers
44
+
45
+ sig do
46
+ params(
47
+ allowed_callers:
48
+ T::Array[
49
+ Anthropic::Beta::BetaToolComputerUse20250124::AllowedCaller::OrSymbol
50
+ ]
51
+ ).void
52
+ end
53
+ attr_writer :allowed_callers
54
+
34
55
  # Create a cache control breakpoint at this content block.
35
56
  sig { returns(T.nilable(Anthropic::Beta::BetaCacheControlEphemeral)) }
36
57
  attr_reader :cache_control
@@ -43,10 +64,26 @@ module Anthropic
43
64
  end
44
65
  attr_writer :cache_control
45
66
 
67
+ # If true, tool will not be included in initial system prompt. Only loaded when
68
+ # returned via tool_reference from tool search.
69
+ sig { returns(T.nilable(T::Boolean)) }
70
+ attr_reader :defer_loading
71
+
72
+ sig { params(defer_loading: T::Boolean).void }
73
+ attr_writer :defer_loading
74
+
46
75
  # The X11 display number (e.g. 0, 1) for the display.
47
76
  sig { returns(T.nilable(Integer)) }
48
77
  attr_accessor :display_number
49
78
 
79
+ sig { returns(T.nilable(T::Array[T::Hash[Symbol, T.anything]])) }
80
+ attr_reader :input_examples
81
+
82
+ sig do
83
+ params(input_examples: T::Array[T::Hash[Symbol, T.anything]]).void
84
+ end
85
+ attr_writer :input_examples
86
+
50
87
  sig { returns(T.nilable(T::Boolean)) }
51
88
  attr_reader :strict
52
89
 
@@ -57,9 +94,15 @@ module Anthropic
57
94
  params(
58
95
  display_height_px: Integer,
59
96
  display_width_px: Integer,
97
+ allowed_callers:
98
+ T::Array[
99
+ Anthropic::Beta::BetaToolComputerUse20250124::AllowedCaller::OrSymbol
100
+ ],
60
101
  cache_control:
61
102
  T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash),
103
+ defer_loading: T::Boolean,
62
104
  display_number: T.nilable(Integer),
105
+ input_examples: T::Array[T::Hash[Symbol, T.anything]],
63
106
  strict: T::Boolean,
64
107
  name: Symbol,
65
108
  type: Symbol
@@ -70,10 +113,15 @@ module Anthropic
70
113
  display_height_px:,
71
114
  # The width of the display in pixels.
72
115
  display_width_px:,
116
+ allowed_callers: nil,
73
117
  # Create a cache control breakpoint at this content block.
74
118
  cache_control: nil,
119
+ # If true, tool will not be included in initial system prompt. Only loaded when
120
+ # returned via tool_reference from tool search.
121
+ defer_loading: nil,
75
122
  # The X11 display number (e.g. 0, 1) for the display.
76
123
  display_number: nil,
124
+ input_examples: nil,
77
125
  strict: nil,
78
126
  # Name of the tool.
79
127
  #
@@ -90,15 +138,55 @@ module Anthropic
90
138
  display_width_px: Integer,
91
139
  name: Symbol,
92
140
  type: Symbol,
141
+ allowed_callers:
142
+ T::Array[
143
+ Anthropic::Beta::BetaToolComputerUse20250124::AllowedCaller::OrSymbol
144
+ ],
93
145
  cache_control:
94
146
  T.nilable(Anthropic::Beta::BetaCacheControlEphemeral),
147
+ defer_loading: T::Boolean,
95
148
  display_number: T.nilable(Integer),
149
+ input_examples: T::Array[T::Hash[Symbol, T.anything]],
96
150
  strict: T::Boolean
97
151
  }
98
152
  )
99
153
  end
100
154
  def to_hash
101
155
  end
156
+
157
+ module AllowedCaller
158
+ extend Anthropic::Internal::Type::Enum
159
+
160
+ TaggedSymbol =
161
+ T.type_alias do
162
+ T.all(
163
+ Symbol,
164
+ Anthropic::Beta::BetaToolComputerUse20250124::AllowedCaller
165
+ )
166
+ end
167
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
168
+
169
+ DIRECT =
170
+ T.let(
171
+ :direct,
172
+ Anthropic::Beta::BetaToolComputerUse20250124::AllowedCaller::TaggedSymbol
173
+ )
174
+ CODE_EXECUTION_20250825 =
175
+ T.let(
176
+ :code_execution_20250825,
177
+ Anthropic::Beta::BetaToolComputerUse20250124::AllowedCaller::TaggedSymbol
178
+ )
179
+
180
+ sig do
181
+ override.returns(
182
+ T::Array[
183
+ Anthropic::Beta::BetaToolComputerUse20250124::AllowedCaller::TaggedSymbol
184
+ ]
185
+ )
186
+ end
187
+ def self.values
188
+ end
189
+ end
102
190
  end
103
191
  end
104
192
  end
@@ -0,0 +1,204 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ BetaToolComputerUse20251124 = Beta::BetaToolComputerUse20251124
6
+
7
+ module Beta
8
+ class BetaToolComputerUse20251124 < Anthropic::Internal::Type::BaseModel
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(
12
+ Anthropic::Beta::BetaToolComputerUse20251124,
13
+ Anthropic::Internal::AnyHash
14
+ )
15
+ end
16
+
17
+ # The height of the display in pixels.
18
+ sig { returns(Integer) }
19
+ attr_accessor :display_height_px
20
+
21
+ # The width of the display in pixels.
22
+ sig { returns(Integer) }
23
+ attr_accessor :display_width_px
24
+
25
+ # Name of the tool.
26
+ #
27
+ # This is how the tool will be called by the model and in `tool_use` blocks.
28
+ sig { returns(Symbol) }
29
+ attr_accessor :name
30
+
31
+ sig { returns(Symbol) }
32
+ attr_accessor :type
33
+
34
+ sig do
35
+ returns(
36
+ T.nilable(
37
+ T::Array[
38
+ Anthropic::Beta::BetaToolComputerUse20251124::AllowedCaller::OrSymbol
39
+ ]
40
+ )
41
+ )
42
+ end
43
+ attr_reader :allowed_callers
44
+
45
+ sig do
46
+ params(
47
+ allowed_callers:
48
+ T::Array[
49
+ Anthropic::Beta::BetaToolComputerUse20251124::AllowedCaller::OrSymbol
50
+ ]
51
+ ).void
52
+ end
53
+ attr_writer :allowed_callers
54
+
55
+ # Create a cache control breakpoint at this content block.
56
+ sig { returns(T.nilable(Anthropic::Beta::BetaCacheControlEphemeral)) }
57
+ attr_reader :cache_control
58
+
59
+ sig do
60
+ params(
61
+ cache_control:
62
+ T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash)
63
+ ).void
64
+ end
65
+ attr_writer :cache_control
66
+
67
+ # If true, tool will not be included in initial system prompt. Only loaded when
68
+ # returned via tool_reference from tool search.
69
+ sig { returns(T.nilable(T::Boolean)) }
70
+ attr_reader :defer_loading
71
+
72
+ sig { params(defer_loading: T::Boolean).void }
73
+ attr_writer :defer_loading
74
+
75
+ # The X11 display number (e.g. 0, 1) for the display.
76
+ sig { returns(T.nilable(Integer)) }
77
+ attr_accessor :display_number
78
+
79
+ # Whether to enable an action to take a zoomed-in screenshot of the screen.
80
+ sig { returns(T.nilable(T::Boolean)) }
81
+ attr_reader :enable_zoom
82
+
83
+ sig { params(enable_zoom: T::Boolean).void }
84
+ attr_writer :enable_zoom
85
+
86
+ sig { returns(T.nilable(T::Array[T::Hash[Symbol, T.anything]])) }
87
+ attr_reader :input_examples
88
+
89
+ sig do
90
+ params(input_examples: T::Array[T::Hash[Symbol, T.anything]]).void
91
+ end
92
+ attr_writer :input_examples
93
+
94
+ sig { returns(T.nilable(T::Boolean)) }
95
+ attr_reader :strict
96
+
97
+ sig { params(strict: T::Boolean).void }
98
+ attr_writer :strict
99
+
100
+ sig do
101
+ params(
102
+ display_height_px: Integer,
103
+ display_width_px: Integer,
104
+ allowed_callers:
105
+ T::Array[
106
+ Anthropic::Beta::BetaToolComputerUse20251124::AllowedCaller::OrSymbol
107
+ ],
108
+ cache_control:
109
+ T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash),
110
+ defer_loading: T::Boolean,
111
+ display_number: T.nilable(Integer),
112
+ enable_zoom: T::Boolean,
113
+ input_examples: T::Array[T::Hash[Symbol, T.anything]],
114
+ strict: T::Boolean,
115
+ name: Symbol,
116
+ type: Symbol
117
+ ).returns(T.attached_class)
118
+ end
119
+ def self.new(
120
+ # The height of the display in pixels.
121
+ display_height_px:,
122
+ # The width of the display in pixels.
123
+ display_width_px:,
124
+ allowed_callers: nil,
125
+ # Create a cache control breakpoint at this content block.
126
+ cache_control: nil,
127
+ # If true, tool will not be included in initial system prompt. Only loaded when
128
+ # returned via tool_reference from tool search.
129
+ defer_loading: nil,
130
+ # The X11 display number (e.g. 0, 1) for the display.
131
+ display_number: nil,
132
+ # Whether to enable an action to take a zoomed-in screenshot of the screen.
133
+ enable_zoom: nil,
134
+ input_examples: nil,
135
+ strict: nil,
136
+ # Name of the tool.
137
+ #
138
+ # This is how the tool will be called by the model and in `tool_use` blocks.
139
+ name: :computer,
140
+ type: :computer_20251124
141
+ )
142
+ end
143
+
144
+ sig do
145
+ override.returns(
146
+ {
147
+ display_height_px: Integer,
148
+ display_width_px: Integer,
149
+ name: Symbol,
150
+ type: Symbol,
151
+ allowed_callers:
152
+ T::Array[
153
+ Anthropic::Beta::BetaToolComputerUse20251124::AllowedCaller::OrSymbol
154
+ ],
155
+ cache_control:
156
+ T.nilable(Anthropic::Beta::BetaCacheControlEphemeral),
157
+ defer_loading: T::Boolean,
158
+ display_number: T.nilable(Integer),
159
+ enable_zoom: T::Boolean,
160
+ input_examples: T::Array[T::Hash[Symbol, T.anything]],
161
+ strict: T::Boolean
162
+ }
163
+ )
164
+ end
165
+ def to_hash
166
+ end
167
+
168
+ module AllowedCaller
169
+ extend Anthropic::Internal::Type::Enum
170
+
171
+ TaggedSymbol =
172
+ T.type_alias do
173
+ T.all(
174
+ Symbol,
175
+ Anthropic::Beta::BetaToolComputerUse20251124::AllowedCaller
176
+ )
177
+ end
178
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
179
+
180
+ DIRECT =
181
+ T.let(
182
+ :direct,
183
+ Anthropic::Beta::BetaToolComputerUse20251124::AllowedCaller::TaggedSymbol
184
+ )
185
+ CODE_EXECUTION_20250825 =
186
+ T.let(
187
+ :code_execution_20250825,
188
+ Anthropic::Beta::BetaToolComputerUse20251124::AllowedCaller::TaggedSymbol
189
+ )
190
+
191
+ sig do
192
+ override.returns(
193
+ T::Array[
194
+ Anthropic::Beta::BetaToolComputerUse20251124::AllowedCaller::TaggedSymbol
195
+ ]
196
+ )
197
+ end
198
+ def self.values
199
+ end
200
+ end
201
+ end
202
+ end
203
+ end
204
+ end
@@ -0,0 +1,35 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ BetaToolReferenceBlock = Beta::BetaToolReferenceBlock
6
+
7
+ module Beta
8
+ class BetaToolReferenceBlock < Anthropic::Internal::Type::BaseModel
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(
12
+ Anthropic::Beta::BetaToolReferenceBlock,
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
+ sig do
24
+ params(tool_name: String, type: Symbol).returns(T.attached_class)
25
+ end
26
+ def self.new(tool_name:, type: :tool_reference)
27
+ end
28
+
29
+ sig { override.returns({ tool_name: String, type: Symbol }) }
30
+ def to_hash
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end