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
@@ -29,24 +29,43 @@ module Anthropic
29
29
  # @return [Symbol, :computer_20241022]
30
30
  required :type, const: :computer_20241022
31
31
 
32
+ # @!attribute allowed_callers
33
+ #
34
+ # @return [Array<Symbol, Anthropic::Models::Beta::BetaToolComputerUse20241022::AllowedCaller>, nil]
35
+ optional :allowed_callers,
36
+ -> { Anthropic::Internal::Type::ArrayOf[enum: Anthropic::Beta::BetaToolComputerUse20241022::AllowedCaller] }
37
+
32
38
  # @!attribute cache_control
33
39
  # Create a cache control breakpoint at this content block.
34
40
  #
35
41
  # @return [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil]
36
42
  optional :cache_control, -> { Anthropic::Beta::BetaCacheControlEphemeral }, nil?: true
37
43
 
44
+ # @!attribute defer_loading
45
+ # If true, tool will not be included in initial system prompt. Only loaded when
46
+ # returned via tool_reference from tool search.
47
+ #
48
+ # @return [Boolean, nil]
49
+ optional :defer_loading, Anthropic::Internal::Type::Boolean
50
+
38
51
  # @!attribute display_number
39
52
  # The X11 display number (e.g. 0, 1) for the display.
40
53
  #
41
54
  # @return [Integer, nil]
42
55
  optional :display_number, Integer, nil?: true
43
56
 
57
+ # @!attribute input_examples
58
+ #
59
+ # @return [Array<Hash{Symbol=>Object}>, nil]
60
+ optional :input_examples,
61
+ Anthropic::Internal::Type::ArrayOf[Anthropic::Internal::Type::HashOf[Anthropic::Internal::Type::Unknown]]
62
+
44
63
  # @!attribute strict
45
64
  #
46
65
  # @return [Boolean, nil]
47
66
  optional :strict, Anthropic::Internal::Type::Boolean
48
67
 
49
- # @!method initialize(display_height_px:, display_width_px:, cache_control: nil, display_number: nil, strict: nil, name: :computer, type: :computer_20241022)
68
+ # @!method initialize(display_height_px:, display_width_px:, allowed_callers: nil, cache_control: nil, defer_loading: nil, display_number: nil, input_examples: nil, strict: nil, name: :computer, type: :computer_20241022)
50
69
  # Some parameter documentations has been truncated, see
51
70
  # {Anthropic::Models::Beta::BetaToolComputerUse20241022} for more details.
52
71
  #
@@ -54,15 +73,31 @@ module Anthropic
54
73
  #
55
74
  # @param display_width_px [Integer] The width of the display in pixels.
56
75
  #
76
+ # @param allowed_callers [Array<Symbol, Anthropic::Models::Beta::BetaToolComputerUse20241022::AllowedCaller>]
77
+ #
57
78
  # @param cache_control [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil] Create a cache control breakpoint at this content block.
58
79
  #
80
+ # @param defer_loading [Boolean] If true, tool will not be included in initial system prompt. Only loaded when re
81
+ #
59
82
  # @param display_number [Integer, nil] The X11 display number (e.g. 0, 1) for the display.
60
83
  #
84
+ # @param input_examples [Array<Hash{Symbol=>Object}>]
85
+ #
61
86
  # @param strict [Boolean]
62
87
  #
63
88
  # @param name [Symbol, :computer] Name of the tool.
64
89
  #
65
90
  # @param type [Symbol, :computer_20241022]
91
+
92
+ module AllowedCaller
93
+ extend Anthropic::Internal::Type::Enum
94
+
95
+ DIRECT = :direct
96
+ CODE_EXECUTION_20250825 = :code_execution_20250825
97
+
98
+ # @!method self.values
99
+ # @return [Array<Symbol>]
100
+ end
66
101
  end
67
102
  end
68
103
 
@@ -29,24 +29,43 @@ module Anthropic
29
29
  # @return [Symbol, :computer_20250124]
30
30
  required :type, const: :computer_20250124
31
31
 
32
+ # @!attribute allowed_callers
33
+ #
34
+ # @return [Array<Symbol, Anthropic::Models::Beta::BetaToolComputerUse20250124::AllowedCaller>, nil]
35
+ optional :allowed_callers,
36
+ -> { Anthropic::Internal::Type::ArrayOf[enum: Anthropic::Beta::BetaToolComputerUse20250124::AllowedCaller] }
37
+
32
38
  # @!attribute cache_control
33
39
  # Create a cache control breakpoint at this content block.
34
40
  #
35
41
  # @return [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil]
36
42
  optional :cache_control, -> { Anthropic::Beta::BetaCacheControlEphemeral }, nil?: true
37
43
 
44
+ # @!attribute defer_loading
45
+ # If true, tool will not be included in initial system prompt. Only loaded when
46
+ # returned via tool_reference from tool search.
47
+ #
48
+ # @return [Boolean, nil]
49
+ optional :defer_loading, Anthropic::Internal::Type::Boolean
50
+
38
51
  # @!attribute display_number
39
52
  # The X11 display number (e.g. 0, 1) for the display.
40
53
  #
41
54
  # @return [Integer, nil]
42
55
  optional :display_number, Integer, nil?: true
43
56
 
57
+ # @!attribute input_examples
58
+ #
59
+ # @return [Array<Hash{Symbol=>Object}>, nil]
60
+ optional :input_examples,
61
+ Anthropic::Internal::Type::ArrayOf[Anthropic::Internal::Type::HashOf[Anthropic::Internal::Type::Unknown]]
62
+
44
63
  # @!attribute strict
45
64
  #
46
65
  # @return [Boolean, nil]
47
66
  optional :strict, Anthropic::Internal::Type::Boolean
48
67
 
49
- # @!method initialize(display_height_px:, display_width_px:, cache_control: nil, display_number: nil, strict: nil, name: :computer, type: :computer_20250124)
68
+ # @!method initialize(display_height_px:, display_width_px:, allowed_callers: nil, cache_control: nil, defer_loading: nil, display_number: nil, input_examples: nil, strict: nil, name: :computer, type: :computer_20250124)
50
69
  # Some parameter documentations has been truncated, see
51
70
  # {Anthropic::Models::Beta::BetaToolComputerUse20250124} for more details.
52
71
  #
@@ -54,15 +73,31 @@ module Anthropic
54
73
  #
55
74
  # @param display_width_px [Integer] The width of the display in pixels.
56
75
  #
76
+ # @param allowed_callers [Array<Symbol, Anthropic::Models::Beta::BetaToolComputerUse20250124::AllowedCaller>]
77
+ #
57
78
  # @param cache_control [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil] Create a cache control breakpoint at this content block.
58
79
  #
80
+ # @param defer_loading [Boolean] If true, tool will not be included in initial system prompt. Only loaded when re
81
+ #
59
82
  # @param display_number [Integer, nil] The X11 display number (e.g. 0, 1) for the display.
60
83
  #
84
+ # @param input_examples [Array<Hash{Symbol=>Object}>]
85
+ #
61
86
  # @param strict [Boolean]
62
87
  #
63
88
  # @param name [Symbol, :computer] Name of the tool.
64
89
  #
65
90
  # @param type [Symbol, :computer_20250124]
91
+
92
+ module AllowedCaller
93
+ extend Anthropic::Internal::Type::Enum
94
+
95
+ DIRECT = :direct
96
+ CODE_EXECUTION_20250825 = :code_execution_20250825
97
+
98
+ # @!method self.values
99
+ # @return [Array<Symbol>]
100
+ end
66
101
  end
67
102
  end
68
103
 
@@ -0,0 +1,114 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Anthropic
4
+ module Models
5
+ module Beta
6
+ class BetaToolComputerUse20251124 < Anthropic::Internal::Type::BaseModel
7
+ # @!attribute display_height_px
8
+ # The height of the display in pixels.
9
+ #
10
+ # @return [Integer]
11
+ required :display_height_px, Integer
12
+
13
+ # @!attribute display_width_px
14
+ # The width of the display in pixels.
15
+ #
16
+ # @return [Integer]
17
+ required :display_width_px, Integer
18
+
19
+ # @!attribute name
20
+ # Name of the tool.
21
+ #
22
+ # This is how the tool will be called by the model and in `tool_use` blocks.
23
+ #
24
+ # @return [Symbol, :computer]
25
+ required :name, const: :computer
26
+
27
+ # @!attribute type
28
+ #
29
+ # @return [Symbol, :computer_20251124]
30
+ required :type, const: :computer_20251124
31
+
32
+ # @!attribute allowed_callers
33
+ #
34
+ # @return [Array<Symbol, Anthropic::Models::Beta::BetaToolComputerUse20251124::AllowedCaller>, nil]
35
+ optional :allowed_callers,
36
+ -> { Anthropic::Internal::Type::ArrayOf[enum: Anthropic::Beta::BetaToolComputerUse20251124::AllowedCaller] }
37
+
38
+ # @!attribute cache_control
39
+ # Create a cache control breakpoint at this content block.
40
+ #
41
+ # @return [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil]
42
+ optional :cache_control, -> { Anthropic::Beta::BetaCacheControlEphemeral }, nil?: true
43
+
44
+ # @!attribute defer_loading
45
+ # If true, tool will not be included in initial system prompt. Only loaded when
46
+ # returned via tool_reference from tool search.
47
+ #
48
+ # @return [Boolean, nil]
49
+ optional :defer_loading, Anthropic::Internal::Type::Boolean
50
+
51
+ # @!attribute display_number
52
+ # The X11 display number (e.g. 0, 1) for the display.
53
+ #
54
+ # @return [Integer, nil]
55
+ optional :display_number, Integer, nil?: true
56
+
57
+ # @!attribute enable_zoom
58
+ # Whether to enable an action to take a zoomed-in screenshot of the screen.
59
+ #
60
+ # @return [Boolean, nil]
61
+ optional :enable_zoom, Anthropic::Internal::Type::Boolean
62
+
63
+ # @!attribute input_examples
64
+ #
65
+ # @return [Array<Hash{Symbol=>Object}>, nil]
66
+ optional :input_examples,
67
+ Anthropic::Internal::Type::ArrayOf[Anthropic::Internal::Type::HashOf[Anthropic::Internal::Type::Unknown]]
68
+
69
+ # @!attribute strict
70
+ #
71
+ # @return [Boolean, nil]
72
+ optional :strict, Anthropic::Internal::Type::Boolean
73
+
74
+ # @!method initialize(display_height_px:, display_width_px:, allowed_callers: nil, cache_control: nil, defer_loading: nil, display_number: nil, enable_zoom: nil, input_examples: nil, strict: nil, name: :computer, type: :computer_20251124)
75
+ # Some parameter documentations has been truncated, see
76
+ # {Anthropic::Models::Beta::BetaToolComputerUse20251124} for more details.
77
+ #
78
+ # @param display_height_px [Integer] The height of the display in pixels.
79
+ #
80
+ # @param display_width_px [Integer] The width of the display in pixels.
81
+ #
82
+ # @param allowed_callers [Array<Symbol, Anthropic::Models::Beta::BetaToolComputerUse20251124::AllowedCaller>]
83
+ #
84
+ # @param cache_control [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil] Create a cache control breakpoint at this content block.
85
+ #
86
+ # @param defer_loading [Boolean] If true, tool will not be included in initial system prompt. Only loaded when re
87
+ #
88
+ # @param display_number [Integer, nil] The X11 display number (e.g. 0, 1) for the display.
89
+ #
90
+ # @param enable_zoom [Boolean] Whether to enable an action to take a zoomed-in screenshot of the screen.
91
+ #
92
+ # @param input_examples [Array<Hash{Symbol=>Object}>]
93
+ #
94
+ # @param strict [Boolean]
95
+ #
96
+ # @param name [Symbol, :computer] Name of the tool.
97
+ #
98
+ # @param type [Symbol, :computer_20251124]
99
+
100
+ module AllowedCaller
101
+ extend Anthropic::Internal::Type::Enum
102
+
103
+ DIRECT = :direct
104
+ CODE_EXECUTION_20250825 = :code_execution_20250825
105
+
106
+ # @!method self.values
107
+ # @return [Array<Symbol>]
108
+ end
109
+ end
110
+ end
111
+
112
+ BetaToolComputerUse20251124 = Beta::BetaToolComputerUse20251124
113
+ end
114
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Anthropic
4
+ module Models
5
+ module Beta
6
+ class BetaToolReferenceBlock < Anthropic::Internal::Type::BaseModel
7
+ # @!attribute tool_name
8
+ #
9
+ # @return [String]
10
+ required :tool_name, String
11
+
12
+ # @!attribute type
13
+ #
14
+ # @return [Symbol, :tool_reference]
15
+ required :type, const: :tool_reference
16
+
17
+ # @!method initialize(tool_name:, type: :tool_reference)
18
+ # @param tool_name [String]
19
+ # @param type [Symbol, :tool_reference]
20
+ end
21
+ end
22
+
23
+ BetaToolReferenceBlock = Beta::BetaToolReferenceBlock
24
+ end
25
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Anthropic
4
+ module Models
5
+ module Beta
6
+ class BetaToolReferenceBlockParam < Anthropic::Internal::Type::BaseModel
7
+ # @!attribute tool_name
8
+ #
9
+ # @return [String]
10
+ required :tool_name, String
11
+
12
+ # @!attribute type
13
+ #
14
+ # @return [Symbol, :tool_reference]
15
+ required :type, const: :tool_reference
16
+
17
+ # @!attribute cache_control
18
+ # Create a cache control breakpoint at this content block.
19
+ #
20
+ # @return [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil]
21
+ optional :cache_control, -> { Anthropic::Beta::BetaCacheControlEphemeral }, nil?: true
22
+
23
+ # @!method initialize(tool_name:, cache_control: nil, type: :tool_reference)
24
+ # Tool reference block that can be included in tool_result content.
25
+ #
26
+ # @param tool_name [String]
27
+ #
28
+ # @param cache_control [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil] Create a cache control breakpoint at this content block.
29
+ #
30
+ # @param type [Symbol, :tool_reference]
31
+ end
32
+ end
33
+
34
+ BetaToolReferenceBlockParam = Beta::BetaToolReferenceBlockParam
35
+ end
36
+ end
@@ -22,7 +22,7 @@ module Anthropic
22
22
 
23
23
  # @!attribute content
24
24
  #
25
- # @return [String, Array<Anthropic::Models::Beta::BetaTextBlockParam, Anthropic::Models::Beta::BetaImageBlockParam, Anthropic::Models::Beta::BetaSearchResultBlockParam, Anthropic::Models::Beta::BetaRequestDocumentBlock>, nil]
25
+ # @return [String, Array<Anthropic::Models::Beta::BetaTextBlockParam, Anthropic::Models::Beta::BetaImageBlockParam, Anthropic::Models::Beta::BetaSearchResultBlockParam, Anthropic::Models::Beta::BetaRequestDocumentBlock, Anthropic::Models::Beta::BetaToolReferenceBlockParam>, nil]
26
26
  optional :content, union: -> { Anthropic::Beta::BetaToolResultBlockParam::Content }
27
27
 
28
28
  # @!attribute is_error
@@ -35,7 +35,7 @@ module Anthropic
35
35
  #
36
36
  # @param cache_control [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil] Create a cache control breakpoint at this content block.
37
37
  #
38
- # @param content [String, Array<Anthropic::Models::Beta::BetaTextBlockParam, Anthropic::Models::Beta::BetaImageBlockParam, Anthropic::Models::Beta::BetaSearchResultBlockParam, Anthropic::Models::Beta::BetaRequestDocumentBlock>]
38
+ # @param content [String, Array<Anthropic::Models::Beta::BetaTextBlockParam, Anthropic::Models::Beta::BetaImageBlockParam, Anthropic::Models::Beta::BetaSearchResultBlockParam, Anthropic::Models::Beta::BetaRequestDocumentBlock, Anthropic::Models::Beta::BetaToolReferenceBlockParam>]
39
39
  #
40
40
  # @param is_error [Boolean]
41
41
  #
@@ -49,6 +49,7 @@ module Anthropic
49
49
 
50
50
  variant -> { Anthropic::Models::Beta::BetaToolResultBlockParam::Content::ContentArray }
51
51
 
52
+ # Tool reference block that can be included in tool_result content.
52
53
  module Content
53
54
  extend Anthropic::Internal::Type::Union
54
55
 
@@ -62,12 +63,15 @@ module Anthropic
62
63
 
63
64
  variant :document, -> { Anthropic::Beta::BetaRequestDocumentBlock }
64
65
 
66
+ # Tool reference block that can be included in tool_result content.
67
+ variant :tool_reference, -> { Anthropic::Beta::BetaToolReferenceBlockParam }
68
+
65
69
  # @!method self.variants
66
- # @return [Array(Anthropic::Models::Beta::BetaTextBlockParam, Anthropic::Models::Beta::BetaImageBlockParam, Anthropic::Models::Beta::BetaSearchResultBlockParam, Anthropic::Models::Beta::BetaRequestDocumentBlock)]
70
+ # @return [Array(Anthropic::Models::Beta::BetaTextBlockParam, Anthropic::Models::Beta::BetaImageBlockParam, Anthropic::Models::Beta::BetaSearchResultBlockParam, Anthropic::Models::Beta::BetaRequestDocumentBlock, Anthropic::Models::Beta::BetaToolReferenceBlockParam)]
67
71
  end
68
72
 
69
73
  # @!method self.variants
70
- # @return [Array(String, Array<Anthropic::Models::Beta::BetaTextBlockParam, Anthropic::Models::Beta::BetaImageBlockParam, Anthropic::Models::Beta::BetaSearchResultBlockParam, Anthropic::Models::Beta::BetaRequestDocumentBlock>)]
74
+ # @return [Array(String, Array<Anthropic::Models::Beta::BetaTextBlockParam, Anthropic::Models::Beta::BetaImageBlockParam, Anthropic::Models::Beta::BetaSearchResultBlockParam, Anthropic::Models::Beta::BetaRequestDocumentBlock, Anthropic::Models::Beta::BetaToolReferenceBlockParam>)]
71
75
 
72
76
  # @type [Anthropic::Internal::Type::Converter]
73
77
  ContentArray =
@@ -0,0 +1,85 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Anthropic
4
+ module Models
5
+ module Beta
6
+ class BetaToolSearchToolBm25_20251119 < Anthropic::Internal::Type::BaseModel
7
+ # @!attribute name
8
+ # Name of the tool.
9
+ #
10
+ # This is how the tool will be called by the model and in `tool_use` blocks.
11
+ #
12
+ # @return [Symbol, :tool_search_tool_bm25]
13
+ required :name, const: :tool_search_tool_bm25
14
+
15
+ # @!attribute type
16
+ #
17
+ # @return [Symbol, Anthropic::Models::Beta::BetaToolSearchToolBm25_20251119::Type]
18
+ required :type, enum: -> { Anthropic::Beta::BetaToolSearchToolBm25_20251119::Type }
19
+
20
+ # @!attribute allowed_callers
21
+ #
22
+ # @return [Array<Symbol, Anthropic::Models::Beta::BetaToolSearchToolBm25_20251119::AllowedCaller>, nil]
23
+ optional :allowed_callers,
24
+ -> { Anthropic::Internal::Type::ArrayOf[enum: Anthropic::Beta::BetaToolSearchToolBm25_20251119::AllowedCaller] }
25
+
26
+ # @!attribute cache_control
27
+ # Create a cache control breakpoint at this content block.
28
+ #
29
+ # @return [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil]
30
+ optional :cache_control, -> { Anthropic::Beta::BetaCacheControlEphemeral }, nil?: true
31
+
32
+ # @!attribute defer_loading
33
+ # If true, tool will not be included in initial system prompt. Only loaded when
34
+ # returned via tool_reference from tool search.
35
+ #
36
+ # @return [Boolean, nil]
37
+ optional :defer_loading, Anthropic::Internal::Type::Boolean
38
+
39
+ # @!attribute strict
40
+ #
41
+ # @return [Boolean, nil]
42
+ optional :strict, Anthropic::Internal::Type::Boolean
43
+
44
+ # @!method initialize(type:, allowed_callers: nil, cache_control: nil, defer_loading: nil, strict: nil, name: :tool_search_tool_bm25)
45
+ # Some parameter documentations has been truncated, see
46
+ # {Anthropic::Models::Beta::BetaToolSearchToolBm25_20251119} for more details.
47
+ #
48
+ # @param type [Symbol, Anthropic::Models::Beta::BetaToolSearchToolBm25_20251119::Type]
49
+ #
50
+ # @param allowed_callers [Array<Symbol, Anthropic::Models::Beta::BetaToolSearchToolBm25_20251119::AllowedCaller>]
51
+ #
52
+ # @param cache_control [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil] Create a cache control breakpoint at this content block.
53
+ #
54
+ # @param defer_loading [Boolean] If true, tool will not be included in initial system prompt. Only loaded when re
55
+ #
56
+ # @param strict [Boolean]
57
+ #
58
+ # @param name [Symbol, :tool_search_tool_bm25] Name of the tool.
59
+
60
+ # @see Anthropic::Models::Beta::BetaToolSearchToolBm25_20251119#type
61
+ module Type
62
+ extend Anthropic::Internal::Type::Enum
63
+
64
+ TOOL_SEARCH_TOOL_BM25_20251119 = :tool_search_tool_bm25_20251119
65
+ TOOL_SEARCH_TOOL_BM25 = :tool_search_tool_bm25
66
+
67
+ # @!method self.values
68
+ # @return [Array<Symbol>]
69
+ end
70
+
71
+ module AllowedCaller
72
+ extend Anthropic::Internal::Type::Enum
73
+
74
+ DIRECT = :direct
75
+ CODE_EXECUTION_20250825 = :code_execution_20250825
76
+
77
+ # @!method self.values
78
+ # @return [Array<Symbol>]
79
+ end
80
+ end
81
+ end
82
+
83
+ BetaToolSearchToolBm25_20251119 = Beta::BetaToolSearchToolBm25_20251119
84
+ end
85
+ end
@@ -0,0 +1,85 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Anthropic
4
+ module Models
5
+ module Beta
6
+ class BetaToolSearchToolRegex20251119 < Anthropic::Internal::Type::BaseModel
7
+ # @!attribute name
8
+ # Name of the tool.
9
+ #
10
+ # This is how the tool will be called by the model and in `tool_use` blocks.
11
+ #
12
+ # @return [Symbol, :tool_search_tool_regex]
13
+ required :name, const: :tool_search_tool_regex
14
+
15
+ # @!attribute type
16
+ #
17
+ # @return [Symbol, Anthropic::Models::Beta::BetaToolSearchToolRegex20251119::Type]
18
+ required :type, enum: -> { Anthropic::Beta::BetaToolSearchToolRegex20251119::Type }
19
+
20
+ # @!attribute allowed_callers
21
+ #
22
+ # @return [Array<Symbol, Anthropic::Models::Beta::BetaToolSearchToolRegex20251119::AllowedCaller>, nil]
23
+ optional :allowed_callers,
24
+ -> { Anthropic::Internal::Type::ArrayOf[enum: Anthropic::Beta::BetaToolSearchToolRegex20251119::AllowedCaller] }
25
+
26
+ # @!attribute cache_control
27
+ # Create a cache control breakpoint at this content block.
28
+ #
29
+ # @return [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil]
30
+ optional :cache_control, -> { Anthropic::Beta::BetaCacheControlEphemeral }, nil?: true
31
+
32
+ # @!attribute defer_loading
33
+ # If true, tool will not be included in initial system prompt. Only loaded when
34
+ # returned via tool_reference from tool search.
35
+ #
36
+ # @return [Boolean, nil]
37
+ optional :defer_loading, Anthropic::Internal::Type::Boolean
38
+
39
+ # @!attribute strict
40
+ #
41
+ # @return [Boolean, nil]
42
+ optional :strict, Anthropic::Internal::Type::Boolean
43
+
44
+ # @!method initialize(type:, allowed_callers: nil, cache_control: nil, defer_loading: nil, strict: nil, name: :tool_search_tool_regex)
45
+ # Some parameter documentations has been truncated, see
46
+ # {Anthropic::Models::Beta::BetaToolSearchToolRegex20251119} for more details.
47
+ #
48
+ # @param type [Symbol, Anthropic::Models::Beta::BetaToolSearchToolRegex20251119::Type]
49
+ #
50
+ # @param allowed_callers [Array<Symbol, Anthropic::Models::Beta::BetaToolSearchToolRegex20251119::AllowedCaller>]
51
+ #
52
+ # @param cache_control [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil] Create a cache control breakpoint at this content block.
53
+ #
54
+ # @param defer_loading [Boolean] If true, tool will not be included in initial system prompt. Only loaded when re
55
+ #
56
+ # @param strict [Boolean]
57
+ #
58
+ # @param name [Symbol, :tool_search_tool_regex] Name of the tool.
59
+
60
+ # @see Anthropic::Models::Beta::BetaToolSearchToolRegex20251119#type
61
+ module Type
62
+ extend Anthropic::Internal::Type::Enum
63
+
64
+ TOOL_SEARCH_TOOL_REGEX_20251119 = :tool_search_tool_regex_20251119
65
+ TOOL_SEARCH_TOOL_REGEX = :tool_search_tool_regex
66
+
67
+ # @!method self.values
68
+ # @return [Array<Symbol>]
69
+ end
70
+
71
+ module AllowedCaller
72
+ extend Anthropic::Internal::Type::Enum
73
+
74
+ DIRECT = :direct
75
+ CODE_EXECUTION_20250825 = :code_execution_20250825
76
+
77
+ # @!method self.values
78
+ # @return [Array<Symbol>]
79
+ end
80
+ end
81
+ end
82
+
83
+ BetaToolSearchToolRegex20251119 = Beta::BetaToolSearchToolRegex20251119
84
+ end
85
+ end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Anthropic
4
+ module Models
5
+ module Beta
6
+ class BetaToolSearchToolResultBlock < Anthropic::Internal::Type::BaseModel
7
+ # @!attribute content
8
+ #
9
+ # @return [Anthropic::Models::Beta::BetaToolSearchToolResultError, Anthropic::Models::Beta::BetaToolSearchToolSearchResultBlock]
10
+ required :content, union: -> { Anthropic::Beta::BetaToolSearchToolResultBlock::Content }
11
+
12
+ # @!attribute tool_use_id
13
+ #
14
+ # @return [String]
15
+ required :tool_use_id, String
16
+
17
+ # @!attribute type
18
+ #
19
+ # @return [Symbol, :tool_search_tool_result]
20
+ required :type, const: :tool_search_tool_result
21
+
22
+ # @!method initialize(content:, tool_use_id:, type: :tool_search_tool_result)
23
+ # @param content [Anthropic::Models::Beta::BetaToolSearchToolResultError, Anthropic::Models::Beta::BetaToolSearchToolSearchResultBlock]
24
+ # @param tool_use_id [String]
25
+ # @param type [Symbol, :tool_search_tool_result]
26
+
27
+ # @see Anthropic::Models::Beta::BetaToolSearchToolResultBlock#content
28
+ module Content
29
+ extend Anthropic::Internal::Type::Union
30
+
31
+ variant -> { Anthropic::Beta::BetaToolSearchToolResultError }
32
+
33
+ variant -> { Anthropic::Beta::BetaToolSearchToolSearchResultBlock }
34
+
35
+ # @!method self.variants
36
+ # @return [Array(Anthropic::Models::Beta::BetaToolSearchToolResultError, Anthropic::Models::Beta::BetaToolSearchToolSearchResultBlock)]
37
+ end
38
+ end
39
+ end
40
+
41
+ BetaToolSearchToolResultBlock = Beta::BetaToolSearchToolResultBlock
42
+ end
43
+ end
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Anthropic
4
+ module Models
5
+ module Beta
6
+ class BetaToolSearchToolResultBlockParam < Anthropic::Internal::Type::BaseModel
7
+ # @!attribute content
8
+ #
9
+ # @return [Anthropic::Models::Beta::BetaToolSearchToolResultErrorParam, Anthropic::Models::Beta::BetaToolSearchToolSearchResultBlockParam]
10
+ required :content, union: -> { Anthropic::Beta::BetaToolSearchToolResultBlockParam::Content }
11
+
12
+ # @!attribute tool_use_id
13
+ #
14
+ # @return [String]
15
+ required :tool_use_id, String
16
+
17
+ # @!attribute type
18
+ #
19
+ # @return [Symbol, :tool_search_tool_result]
20
+ required :type, const: :tool_search_tool_result
21
+
22
+ # @!attribute cache_control
23
+ # Create a cache control breakpoint at this content block.
24
+ #
25
+ # @return [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil]
26
+ optional :cache_control, -> { Anthropic::Beta::BetaCacheControlEphemeral }, nil?: true
27
+
28
+ # @!method initialize(content:, tool_use_id:, cache_control: nil, type: :tool_search_tool_result)
29
+ # @param content [Anthropic::Models::Beta::BetaToolSearchToolResultErrorParam, Anthropic::Models::Beta::BetaToolSearchToolSearchResultBlockParam]
30
+ #
31
+ # @param tool_use_id [String]
32
+ #
33
+ # @param cache_control [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil] Create a cache control breakpoint at this content block.
34
+ #
35
+ # @param type [Symbol, :tool_search_tool_result]
36
+
37
+ # @see Anthropic::Models::Beta::BetaToolSearchToolResultBlockParam#content
38
+ module Content
39
+ extend Anthropic::Internal::Type::Union
40
+
41
+ variant -> { Anthropic::Beta::BetaToolSearchToolResultErrorParam }
42
+
43
+ variant -> { Anthropic::Beta::BetaToolSearchToolSearchResultBlockParam }
44
+
45
+ # @!method self.variants
46
+ # @return [Array(Anthropic::Models::Beta::BetaToolSearchToolResultErrorParam, Anthropic::Models::Beta::BetaToolSearchToolSearchResultBlockParam)]
47
+ end
48
+ end
49
+ end
50
+
51
+ BetaToolSearchToolResultBlockParam = Beta::BetaToolSearchToolResultBlockParam
52
+ end
53
+ end