anthropic 1.8.0 → 1.10.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 (165) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +42 -0
  3. data/README.md +12 -12
  4. data/lib/anthropic/errors.rb +25 -11
  5. data/lib/anthropic/internal/page.rb +1 -1
  6. data/lib/anthropic/internal/stream.rb +1 -0
  7. data/lib/anthropic/internal/transport/base_client.rb +11 -7
  8. data/lib/anthropic/internal/type/base_page.rb +1 -1
  9. data/lib/anthropic/internal/type/base_stream.rb +9 -1
  10. data/lib/anthropic/internal/util.rb +3 -2
  11. data/lib/anthropic/models/beta/beta_citation_config.rb +19 -0
  12. data/lib/anthropic/models/beta/beta_clear_tool_uses_20250919_edit.rb +98 -0
  13. data/lib/anthropic/models/beta/beta_clear_tool_uses_20250919_edit_response.rb +38 -0
  14. data/lib/anthropic/models/beta/beta_content_block.rb +3 -1
  15. data/lib/anthropic/models/beta/beta_content_block_param.rb +3 -1
  16. data/lib/anthropic/models/beta/beta_context_management_config.rb +22 -0
  17. data/lib/anthropic/models/beta/beta_context_management_response.rb +23 -0
  18. data/lib/anthropic/models/beta/beta_count_tokens_context_management_response.rb +20 -0
  19. data/lib/anthropic/models/beta/beta_document_block.rb +56 -0
  20. data/lib/anthropic/models/beta/beta_input_tokens_clear_at_least.rb +25 -0
  21. data/lib/anthropic/models/beta/beta_input_tokens_trigger.rb +25 -0
  22. data/lib/anthropic/models/beta/beta_memory_tool_20250818.rb +40 -0
  23. data/lib/anthropic/models/beta/beta_memory_tool_20250818_command.rb +30 -0
  24. data/lib/anthropic/models/beta/beta_memory_tool_20250818_create_command.rb +36 -0
  25. data/lib/anthropic/models/beta/beta_memory_tool_20250818_delete_command.rb +28 -0
  26. data/lib/anthropic/models/beta/beta_memory_tool_20250818_insert_command.rb +44 -0
  27. data/lib/anthropic/models/beta/beta_memory_tool_20250818_rename_command.rb +36 -0
  28. data/lib/anthropic/models/beta/beta_memory_tool_20250818_str_replace_command.rb +44 -0
  29. data/lib/anthropic/models/beta/beta_memory_tool_20250818_view_command.rb +36 -0
  30. data/lib/anthropic/models/beta/beta_message.rb +11 -3
  31. data/lib/anthropic/models/beta/beta_message_param.rb +3 -3
  32. data/lib/anthropic/models/beta/beta_message_tokens_count.rb +13 -1
  33. data/lib/anthropic/models/beta/beta_raw_content_block_start_event.rb +5 -3
  34. data/lib/anthropic/models/beta/beta_raw_message_delta_event.rb +9 -1
  35. data/lib/anthropic/models/beta/beta_request_document_block.rb +2 -2
  36. data/lib/anthropic/models/beta/beta_server_tool_usage.rb +9 -1
  37. data/lib/anthropic/models/beta/beta_server_tool_use_block.rb +1 -0
  38. data/lib/anthropic/models/beta/beta_server_tool_use_block_param.rb +1 -0
  39. data/lib/anthropic/models/beta/beta_stop_reason.rb +1 -0
  40. data/lib/anthropic/models/beta/beta_tool_result_block_param.rb +6 -4
  41. data/lib/anthropic/models/beta/beta_tool_union.rb +5 -1
  42. data/lib/anthropic/models/beta/beta_tool_uses_keep.rb +25 -0
  43. data/lib/anthropic/models/beta/beta_tool_uses_trigger.rb +25 -0
  44. data/lib/anthropic/models/beta/beta_web_fetch_block.rb +42 -0
  45. data/lib/anthropic/models/beta/beta_web_fetch_block_param.rb +42 -0
  46. data/lib/anthropic/models/beta/beta_web_fetch_tool_20250910.rb +82 -0
  47. data/lib/anthropic/models/beta/beta_web_fetch_tool_result_block.rb +43 -0
  48. data/lib/anthropic/models/beta/beta_web_fetch_tool_result_block_param.rb +53 -0
  49. data/lib/anthropic/models/beta/beta_web_fetch_tool_result_error_block.rb +25 -0
  50. data/lib/anthropic/models/beta/beta_web_fetch_tool_result_error_block_param.rb +25 -0
  51. data/lib/anthropic/models/beta/beta_web_fetch_tool_result_error_code.rb +25 -0
  52. data/lib/anthropic/models/beta/message_count_tokens_params.rb +16 -4
  53. data/lib/anthropic/models/beta/message_create_params.rb +11 -3
  54. data/lib/anthropic/models/beta/messages/batch_create_params.rb +11 -3
  55. data/lib/anthropic/models/document_block_param.rb +2 -2
  56. data/lib/anthropic/models/model.rb +10 -0
  57. data/lib/anthropic/models/stop_reason.rb +1 -0
  58. data/lib/anthropic/models/tool_result_block_param.rb +6 -4
  59. data/lib/anthropic/resources/beta/messages.rb +12 -6
  60. data/lib/anthropic/version.rb +1 -1
  61. data/lib/anthropic.rb +27 -0
  62. data/rbi/anthropic/errors.rbi +29 -2
  63. data/rbi/anthropic/internal/transport/base_client.rbi +4 -5
  64. data/rbi/anthropic/internal/type/base_page.rbi +1 -1
  65. data/rbi/anthropic/internal/type/base_stream.rbi +16 -1
  66. data/rbi/anthropic/internal/util.rbi +1 -1
  67. data/rbi/anthropic/models/beta/beta_citation_config.rbi +30 -0
  68. data/rbi/anthropic/models/beta/beta_clear_tool_uses_20250919_edit.rbi +183 -0
  69. data/rbi/anthropic/models/beta/beta_clear_tool_uses_20250919_edit_response.rbi +62 -0
  70. data/rbi/anthropic/models/beta/beta_content_block.rbi +1 -0
  71. data/rbi/anthropic/models/beta/beta_content_block_param.rbi +1 -0
  72. data/rbi/anthropic/models/beta/beta_context_management_config.rbi +56 -0
  73. data/rbi/anthropic/models/beta/beta_context_management_response.rbi +53 -0
  74. data/rbi/anthropic/models/beta/beta_count_tokens_context_management_response.rbi +35 -0
  75. data/rbi/anthropic/models/beta/beta_document_block.rbi +95 -0
  76. data/rbi/anthropic/models/beta/beta_input_tokens_clear_at_least.rbi +33 -0
  77. data/rbi/anthropic/models/beta/beta_input_tokens_trigger.rbi +33 -0
  78. data/rbi/anthropic/models/beta/beta_memory_tool_20250818.rbi +72 -0
  79. data/rbi/anthropic/models/beta/beta_memory_tool_20250818_command.rbi +33 -0
  80. data/rbi/anthropic/models/beta/beta_memory_tool_20250818_create_command.rbi +53 -0
  81. data/rbi/anthropic/models/beta/beta_memory_tool_20250818_delete_command.rbi +41 -0
  82. data/rbi/anthropic/models/beta/beta_memory_tool_20250818_insert_command.rbi +69 -0
  83. data/rbi/anthropic/models/beta/beta_memory_tool_20250818_rename_command.rbi +55 -0
  84. data/rbi/anthropic/models/beta/beta_memory_tool_20250818_str_replace_command.rbi +64 -0
  85. data/rbi/anthropic/models/beta/beta_memory_tool_20250818_view_command.rbi +59 -0
  86. data/rbi/anthropic/models/beta/beta_message.rbi +21 -0
  87. data/rbi/anthropic/models/beta/beta_message_tokens_count.rbi +40 -2
  88. data/rbi/anthropic/models/beta/beta_raw_content_block_start_event.rbi +2 -0
  89. data/rbi/anthropic/models/beta/beta_raw_message_delta_event.rbi +20 -0
  90. data/rbi/anthropic/models/beta/beta_request_document_block.rbi +5 -3
  91. data/rbi/anthropic/models/beta/beta_server_tool_usage.rbi +17 -2
  92. data/rbi/anthropic/models/beta/beta_server_tool_use_block.rbi +5 -0
  93. data/rbi/anthropic/models/beta/beta_server_tool_use_block_param.rbi +5 -0
  94. data/rbi/anthropic/models/beta/beta_stop_reason.rbi +5 -0
  95. data/rbi/anthropic/models/beta/beta_tool_result_block_param.rbi +2 -1
  96. data/rbi/anthropic/models/beta/beta_tool_union.rbi +3 -1
  97. data/rbi/anthropic/models/beta/beta_tool_uses_keep.rbi +33 -0
  98. data/rbi/anthropic/models/beta/beta_tool_uses_trigger.rbi +33 -0
  99. data/rbi/anthropic/models/beta/beta_web_fetch_block.rbi +67 -0
  100. data/rbi/anthropic/models/beta/beta_web_fetch_block_param.rbi +71 -0
  101. data/rbi/anthropic/models/beta/beta_web_fetch_tool_20250910.rbi +125 -0
  102. data/rbi/anthropic/models/beta/beta_web_fetch_tool_result_block.rbi +81 -0
  103. data/rbi/anthropic/models/beta/beta_web_fetch_tool_result_block_param.rbi +109 -0
  104. data/rbi/anthropic/models/beta/beta_web_fetch_tool_result_error_block.rbi +51 -0
  105. data/rbi/anthropic/models/beta/beta_web_fetch_tool_result_error_block_param.rbi +50 -0
  106. data/rbi/anthropic/models/beta/beta_web_fetch_tool_result_error_code.rbi +70 -0
  107. data/rbi/anthropic/models/beta/message_count_tokens_params.rbi +33 -5
  108. data/rbi/anthropic/models/beta/message_create_params.rbi +30 -4
  109. data/rbi/anthropic/models/beta/messages/batch_create_params.rbi +36 -4
  110. data/rbi/anthropic/models/document_block_param.rbi +7 -3
  111. data/rbi/anthropic/models/model.rbi +8 -0
  112. data/rbi/anthropic/models/stop_reason.rbi +5 -0
  113. data/rbi/anthropic/models/tool_result_block_param.rbi +2 -1
  114. data/rbi/anthropic/resources/beta/messages.rbi +21 -3
  115. data/sig/anthropic/errors.rbs +7 -0
  116. data/sig/anthropic/internal/type/base_stream.rbs +5 -0
  117. data/sig/anthropic/models/beta/beta_citation_config.rbs +17 -0
  118. data/sig/anthropic/models/beta/beta_clear_tool_uses_20250919_edit.rbs +77 -0
  119. data/sig/anthropic/models/beta/beta_clear_tool_uses_20250919_edit_response.rbs +34 -0
  120. data/sig/anthropic/models/beta/beta_content_block.rbs +1 -0
  121. data/sig/anthropic/models/beta/beta_content_block_param.rbs +1 -0
  122. data/sig/anthropic/models/beta/beta_context_management_config.rbs +26 -0
  123. data/sig/anthropic/models/beta/beta_context_management_response.rbs +24 -0
  124. data/sig/anthropic/models/beta/beta_count_tokens_context_management_response.rbs +18 -0
  125. data/sig/anthropic/models/beta/beta_document_block.rbs +49 -0
  126. data/sig/anthropic/models/beta/beta_input_tokens_clear_at_least.rbs +20 -0
  127. data/sig/anthropic/models/beta/beta_input_tokens_trigger.rbs +19 -0
  128. data/sig/anthropic/models/beta/beta_memory_tool_20250818.rbs +34 -0
  129. data/sig/anthropic/models/beta/beta_memory_tool_20250818_command.rbs +21 -0
  130. data/sig/anthropic/models/beta/beta_memory_tool_20250818_create_command.rbs +26 -0
  131. data/sig/anthropic/models/beta/beta_memory_tool_20250818_delete_command.rbs +20 -0
  132. data/sig/anthropic/models/beta/beta_memory_tool_20250818_insert_command.rbs +39 -0
  133. data/sig/anthropic/models/beta/beta_memory_tool_20250818_rename_command.rbs +26 -0
  134. data/sig/anthropic/models/beta/beta_memory_tool_20250818_str_replace_command.rbs +39 -0
  135. data/sig/anthropic/models/beta/beta_memory_tool_20250818_view_command.rbs +32 -0
  136. data/sig/anthropic/models/beta/beta_message.rbs +5 -0
  137. data/sig/anthropic/models/beta/beta_message_tokens_count.rbs +15 -3
  138. data/sig/anthropic/models/beta/beta_raw_content_block_start_event.rbs +1 -0
  139. data/sig/anthropic/models/beta/beta_raw_message_delta_event.rbs +5 -0
  140. data/sig/anthropic/models/beta/beta_request_document_block.rbs +4 -8
  141. data/sig/anthropic/models/beta/beta_server_tool_usage.rbs +12 -3
  142. data/sig/anthropic/models/beta/beta_server_tool_use_block.rbs +2 -0
  143. data/sig/anthropic/models/beta/beta_server_tool_use_block_param.rbs +2 -0
  144. data/sig/anthropic/models/beta/beta_stop_reason.rbs +2 -0
  145. data/sig/anthropic/models/beta/beta_tool_result_block_param.rbs +1 -0
  146. data/sig/anthropic/models/beta/beta_tool_union.rbs +2 -0
  147. data/sig/anthropic/models/beta/beta_tool_uses_keep.rbs +19 -0
  148. data/sig/anthropic/models/beta/beta_tool_uses_trigger.rbs +19 -0
  149. data/sig/anthropic/models/beta/beta_web_fetch_block.rbs +39 -0
  150. data/sig/anthropic/models/beta/beta_web_fetch_block_param.rbs +39 -0
  151. data/sig/anthropic/models/beta/beta_web_fetch_tool_20250910.rbs +59 -0
  152. data/sig/anthropic/models/beta/beta_web_fetch_tool_result_block.rbs +44 -0
  153. data/sig/anthropic/models/beta/beta_web_fetch_tool_result_block_param.rbs +49 -0
  154. data/sig/anthropic/models/beta/beta_web_fetch_tool_result_error_block.rbs +29 -0
  155. data/sig/anthropic/models/beta/beta_web_fetch_tool_result_error_block_param.rbs +29 -0
  156. data/sig/anthropic/models/beta/beta_web_fetch_tool_result_error_code.rbs +32 -0
  157. data/sig/anthropic/models/beta/message_count_tokens_params.rbs +7 -0
  158. data/sig/anthropic/models/beta/message_create_params.rbs +5 -0
  159. data/sig/anthropic/models/beta/messages/batch_create_params.rbs +5 -0
  160. data/sig/anthropic/models/document_block_param.rbs +4 -8
  161. data/sig/anthropic/models/model.rbs +8 -0
  162. data/sig/anthropic/models/stop_reason.rbs +2 -0
  163. data/sig/anthropic/models/tool_result_block_param.rbs +1 -0
  164. data/sig/anthropic/resources/beta/messages.rbs +3 -0
  165. metadata +83 -2
@@ -0,0 +1,53 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ BetaMemoryTool20250818CreateCommand =
6
+ Beta::BetaMemoryTool20250818CreateCommand
7
+
8
+ module Beta
9
+ class BetaMemoryTool20250818CreateCommand < Anthropic::Internal::Type::BaseModel
10
+ OrHash =
11
+ T.type_alias do
12
+ T.any(
13
+ Anthropic::Beta::BetaMemoryTool20250818CreateCommand,
14
+ Anthropic::Internal::AnyHash
15
+ )
16
+ end
17
+
18
+ # Command type identifier
19
+ sig { returns(Symbol) }
20
+ attr_accessor :command
21
+
22
+ # Content to write to the file
23
+ sig { returns(String) }
24
+ attr_accessor :file_text
25
+
26
+ # Path where the file should be created
27
+ sig { returns(String) }
28
+ attr_accessor :path
29
+
30
+ sig do
31
+ params(file_text: String, path: String, command: Symbol).returns(
32
+ T.attached_class
33
+ )
34
+ end
35
+ def self.new(
36
+ # Content to write to the file
37
+ file_text:,
38
+ # Path where the file should be created
39
+ path:,
40
+ # Command type identifier
41
+ command: :create
42
+ )
43
+ end
44
+
45
+ sig do
46
+ override.returns({ command: Symbol, file_text: String, path: String })
47
+ end
48
+ def to_hash
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,41 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ BetaMemoryTool20250818DeleteCommand =
6
+ Beta::BetaMemoryTool20250818DeleteCommand
7
+
8
+ module Beta
9
+ class BetaMemoryTool20250818DeleteCommand < Anthropic::Internal::Type::BaseModel
10
+ OrHash =
11
+ T.type_alias do
12
+ T.any(
13
+ Anthropic::Beta::BetaMemoryTool20250818DeleteCommand,
14
+ Anthropic::Internal::AnyHash
15
+ )
16
+ end
17
+
18
+ # Command type identifier
19
+ sig { returns(Symbol) }
20
+ attr_accessor :command
21
+
22
+ # Path to the file or directory to delete
23
+ sig { returns(String) }
24
+ attr_accessor :path
25
+
26
+ sig { params(path: String, command: Symbol).returns(T.attached_class) }
27
+ def self.new(
28
+ # Path to the file or directory to delete
29
+ path:,
30
+ # Command type identifier
31
+ command: :delete
32
+ )
33
+ end
34
+
35
+ sig { override.returns({ command: Symbol, path: String }) }
36
+ def to_hash
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,69 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ BetaMemoryTool20250818InsertCommand =
6
+ Beta::BetaMemoryTool20250818InsertCommand
7
+
8
+ module Beta
9
+ class BetaMemoryTool20250818InsertCommand < Anthropic::Internal::Type::BaseModel
10
+ OrHash =
11
+ T.type_alias do
12
+ T.any(
13
+ Anthropic::Beta::BetaMemoryTool20250818InsertCommand,
14
+ Anthropic::Internal::AnyHash
15
+ )
16
+ end
17
+
18
+ # Command type identifier
19
+ sig { returns(Symbol) }
20
+ attr_accessor :command
21
+
22
+ # Line number where text should be inserted
23
+ sig { returns(Integer) }
24
+ attr_accessor :insert_line
25
+
26
+ # Text to insert at the specified line
27
+ sig { returns(String) }
28
+ attr_accessor :insert_text
29
+
30
+ # Path to the file where text should be inserted
31
+ sig { returns(String) }
32
+ attr_accessor :path
33
+
34
+ sig do
35
+ params(
36
+ insert_line: Integer,
37
+ insert_text: String,
38
+ path: String,
39
+ command: Symbol
40
+ ).returns(T.attached_class)
41
+ end
42
+ def self.new(
43
+ # Line number where text should be inserted
44
+ insert_line:,
45
+ # Text to insert at the specified line
46
+ insert_text:,
47
+ # Path to the file where text should be inserted
48
+ path:,
49
+ # Command type identifier
50
+ command: :insert
51
+ )
52
+ end
53
+
54
+ sig do
55
+ override.returns(
56
+ {
57
+ command: Symbol,
58
+ insert_line: Integer,
59
+ insert_text: String,
60
+ path: String
61
+ }
62
+ )
63
+ end
64
+ def to_hash
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,55 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ BetaMemoryTool20250818RenameCommand =
6
+ Beta::BetaMemoryTool20250818RenameCommand
7
+
8
+ module Beta
9
+ class BetaMemoryTool20250818RenameCommand < Anthropic::Internal::Type::BaseModel
10
+ OrHash =
11
+ T.type_alias do
12
+ T.any(
13
+ Anthropic::Beta::BetaMemoryTool20250818RenameCommand,
14
+ Anthropic::Internal::AnyHash
15
+ )
16
+ end
17
+
18
+ # Command type identifier
19
+ sig { returns(Symbol) }
20
+ attr_accessor :command
21
+
22
+ # New path for the file or directory
23
+ sig { returns(String) }
24
+ attr_accessor :new_path
25
+
26
+ # Current path of the file or directory
27
+ sig { returns(String) }
28
+ attr_accessor :old_path
29
+
30
+ sig do
31
+ params(new_path: String, old_path: String, command: Symbol).returns(
32
+ T.attached_class
33
+ )
34
+ end
35
+ def self.new(
36
+ # New path for the file or directory
37
+ new_path:,
38
+ # Current path of the file or directory
39
+ old_path:,
40
+ # Command type identifier
41
+ command: :rename
42
+ )
43
+ end
44
+
45
+ sig do
46
+ override.returns(
47
+ { command: Symbol, new_path: String, old_path: String }
48
+ )
49
+ end
50
+ def to_hash
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,64 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ BetaMemoryTool20250818StrReplaceCommand =
6
+ Beta::BetaMemoryTool20250818StrReplaceCommand
7
+
8
+ module Beta
9
+ class BetaMemoryTool20250818StrReplaceCommand < Anthropic::Internal::Type::BaseModel
10
+ OrHash =
11
+ T.type_alias do
12
+ T.any(
13
+ Anthropic::Beta::BetaMemoryTool20250818StrReplaceCommand,
14
+ Anthropic::Internal::AnyHash
15
+ )
16
+ end
17
+
18
+ # Command type identifier
19
+ sig { returns(Symbol) }
20
+ attr_accessor :command
21
+
22
+ # Text to replace with
23
+ sig { returns(String) }
24
+ attr_accessor :new_str
25
+
26
+ # Text to search for and replace
27
+ sig { returns(String) }
28
+ attr_accessor :old_str
29
+
30
+ # Path to the file where text should be replaced
31
+ sig { returns(String) }
32
+ attr_accessor :path
33
+
34
+ sig do
35
+ params(
36
+ new_str: String,
37
+ old_str: String,
38
+ path: String,
39
+ command: Symbol
40
+ ).returns(T.attached_class)
41
+ end
42
+ def self.new(
43
+ # Text to replace with
44
+ new_str:,
45
+ # Text to search for and replace
46
+ old_str:,
47
+ # Path to the file where text should be replaced
48
+ path:,
49
+ # Command type identifier
50
+ command: :str_replace
51
+ )
52
+ end
53
+
54
+ sig do
55
+ override.returns(
56
+ { command: Symbol, new_str: String, old_str: String, path: String }
57
+ )
58
+ end
59
+ def to_hash
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,59 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ BetaMemoryTool20250818ViewCommand = Beta::BetaMemoryTool20250818ViewCommand
6
+
7
+ module Beta
8
+ class BetaMemoryTool20250818ViewCommand < Anthropic::Internal::Type::BaseModel
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(
12
+ Anthropic::Beta::BetaMemoryTool20250818ViewCommand,
13
+ Anthropic::Internal::AnyHash
14
+ )
15
+ end
16
+
17
+ # Command type identifier
18
+ sig { returns(Symbol) }
19
+ attr_accessor :command
20
+
21
+ # Path to directory or file to view
22
+ sig { returns(String) }
23
+ attr_accessor :path
24
+
25
+ # Optional line range for viewing specific lines
26
+ sig { returns(T.nilable(T::Array[Integer])) }
27
+ attr_reader :view_range
28
+
29
+ sig { params(view_range: T::Array[Integer]).void }
30
+ attr_writer :view_range
31
+
32
+ sig do
33
+ params(
34
+ path: String,
35
+ view_range: T::Array[Integer],
36
+ command: Symbol
37
+ ).returns(T.attached_class)
38
+ end
39
+ def self.new(
40
+ # Path to directory or file to view
41
+ path:,
42
+ # Optional line range for viewing specific lines
43
+ view_range: nil,
44
+ # Command type identifier
45
+ command: :view
46
+ )
47
+ end
48
+
49
+ sig do
50
+ override.returns(
51
+ { command: Symbol, path: String, view_range: T::Array[Integer] }
52
+ )
53
+ end
54
+ def to_hash
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
@@ -64,6 +64,20 @@ module Anthropic
64
64
  sig { returns(T::Array[Anthropic::Beta::BetaContentBlock::Variants]) }
65
65
  attr_accessor :content
66
66
 
67
+ # Information about context management operations applied during the request.
68
+ sig do
69
+ returns(T.nilable(Anthropic::Beta::BetaContextManagementResponse))
70
+ end
71
+ attr_reader :context_management
72
+
73
+ sig do
74
+ params(
75
+ context_management:
76
+ T.nilable(Anthropic::Beta::BetaContextManagementResponse::OrHash)
77
+ ).void
78
+ end
79
+ attr_writer :context_management
80
+
67
81
  # The model that will complete your prompt.\n\nSee
68
82
  # [models](https://docs.anthropic.com/en/docs/models-overview) for additional
69
83
  # details and options.
@@ -143,6 +157,7 @@ module Anthropic
143
157
  Anthropic::Beta::BetaToolUseBlock::OrHash,
144
158
  Anthropic::Beta::BetaServerToolUseBlock::OrHash,
145
159
  Anthropic::Beta::BetaWebSearchToolResultBlock::OrHash,
160
+ Anthropic::Beta::BetaWebFetchToolResultBlock::OrHash,
146
161
  Anthropic::Beta::BetaCodeExecutionToolResultBlock::OrHash,
147
162
  Anthropic::Beta::BetaBashCodeExecutionToolResultBlock::OrHash,
148
163
  Anthropic::Beta::BetaTextEditorCodeExecutionToolResultBlock::OrHash,
@@ -151,6 +166,8 @@ module Anthropic
151
166
  Anthropic::Beta::BetaContainerUploadBlock::OrHash
152
167
  )
153
168
  ],
169
+ context_management:
170
+ T.nilable(Anthropic::Beta::BetaContextManagementResponse::OrHash),
154
171
  model: T.any(Anthropic::Model::OrSymbol, String),
155
172
  stop_reason: T.nilable(Anthropic::Beta::BetaStopReason::OrSymbol),
156
173
  stop_sequence: T.nilable(String),
@@ -200,6 +217,8 @@ module Anthropic
200
217
  # [{ "type": "text", "text": "B)" }]
201
218
  # ```
202
219
  content:,
220
+ # Information about context management operations applied during the request.
221
+ context_management:,
203
222
  # The model that will complete your prompt.\n\nSee
204
223
  # [models](https://docs.anthropic.com/en/docs/models-overview) for additional
205
224
  # details and options.
@@ -258,6 +277,8 @@ module Anthropic
258
277
  id: String,
259
278
  container: T.nilable(Anthropic::Beta::BetaContainer),
260
279
  content: T::Array[Anthropic::Beta::BetaContentBlock::Variants],
280
+ context_management:
281
+ T.nilable(Anthropic::Beta::BetaContextManagementResponse),
261
282
  model: Anthropic::Model::Variants,
262
283
  role: Symbol,
263
284
  stop_reason:
@@ -14,20 +14,58 @@ module Anthropic
14
14
  )
15
15
  end
16
16
 
17
+ # Information about context management applied to the message.
18
+ sig do
19
+ returns(
20
+ T.nilable(Anthropic::Beta::BetaCountTokensContextManagementResponse)
21
+ )
22
+ end
23
+ attr_reader :context_management
24
+
25
+ sig do
26
+ params(
27
+ context_management:
28
+ T.nilable(
29
+ Anthropic::Beta::BetaCountTokensContextManagementResponse::OrHash
30
+ )
31
+ ).void
32
+ end
33
+ attr_writer :context_management
34
+
17
35
  # The total number of tokens across the provided list of messages, system prompt,
18
36
  # and tools.
19
37
  sig { returns(Integer) }
20
38
  attr_accessor :input_tokens
21
39
 
22
- sig { params(input_tokens: Integer).returns(T.attached_class) }
40
+ sig do
41
+ params(
42
+ context_management:
43
+ T.nilable(
44
+ Anthropic::Beta::BetaCountTokensContextManagementResponse::OrHash
45
+ ),
46
+ input_tokens: Integer
47
+ ).returns(T.attached_class)
48
+ end
23
49
  def self.new(
50
+ # Information about context management applied to the message.
51
+ context_management:,
24
52
  # The total number of tokens across the provided list of messages, system prompt,
25
53
  # and tools.
26
54
  input_tokens:
27
55
  )
28
56
  end
29
57
 
30
- sig { override.returns({ input_tokens: Integer }) }
58
+ sig do
59
+ override.returns(
60
+ {
61
+ context_management:
62
+ T.nilable(
63
+ Anthropic::Beta::BetaCountTokensContextManagementResponse
64
+ ),
65
+ input_tokens: Integer
66
+ }
67
+ )
68
+ end
31
69
  def to_hash
32
70
  end
33
71
  end
@@ -38,6 +38,7 @@ module Anthropic
38
38
  Anthropic::Beta::BetaToolUseBlock::OrHash,
39
39
  Anthropic::Beta::BetaServerToolUseBlock::OrHash,
40
40
  Anthropic::Beta::BetaWebSearchToolResultBlock::OrHash,
41
+ Anthropic::Beta::BetaWebFetchToolResultBlock::OrHash,
41
42
  Anthropic::Beta::BetaCodeExecutionToolResultBlock::OrHash,
42
43
  Anthropic::Beta::BetaBashCodeExecutionToolResultBlock::OrHash,
43
44
  Anthropic::Beta::BetaTextEditorCodeExecutionToolResultBlock::OrHash,
@@ -83,6 +84,7 @@ module Anthropic
83
84
  Anthropic::Beta::BetaToolUseBlock,
84
85
  Anthropic::Beta::BetaServerToolUseBlock,
85
86
  Anthropic::Beta::BetaWebSearchToolResultBlock,
87
+ Anthropic::Beta::BetaWebFetchToolResultBlock,
86
88
  Anthropic::Beta::BetaCodeExecutionToolResultBlock,
87
89
  Anthropic::Beta::BetaBashCodeExecutionToolResultBlock,
88
90
  Anthropic::Beta::BetaTextEditorCodeExecutionToolResultBlock,
@@ -14,6 +14,20 @@ module Anthropic
14
14
  )
15
15
  end
16
16
 
17
+ # Information about context management operations applied during the request.
18
+ sig do
19
+ returns(T.nilable(Anthropic::Beta::BetaContextManagementResponse))
20
+ end
21
+ attr_reader :context_management
22
+
23
+ sig do
24
+ params(
25
+ context_management:
26
+ T.nilable(Anthropic::Beta::BetaContextManagementResponse::OrHash)
27
+ ).void
28
+ end
29
+ attr_writer :context_management
30
+
17
31
  sig { returns(Anthropic::Beta::BetaRawMessageDeltaEvent::Delta) }
18
32
  attr_reader :delta
19
33
 
@@ -52,12 +66,16 @@ module Anthropic
52
66
 
53
67
  sig do
54
68
  params(
69
+ context_management:
70
+ T.nilable(Anthropic::Beta::BetaContextManagementResponse::OrHash),
55
71
  delta: Anthropic::Beta::BetaRawMessageDeltaEvent::Delta::OrHash,
56
72
  usage: Anthropic::Beta::BetaMessageDeltaUsage::OrHash,
57
73
  type: Symbol
58
74
  ).returns(T.attached_class)
59
75
  end
60
76
  def self.new(
77
+ # Information about context management operations applied during the request.
78
+ context_management:,
61
79
  delta:,
62
80
  # Billing and rate-limit usage.
63
81
  #
@@ -82,6 +100,8 @@ module Anthropic
82
100
  sig do
83
101
  override.returns(
84
102
  {
103
+ context_management:
104
+ T.nilable(Anthropic::Beta::BetaContextManagementResponse),
85
105
  delta: Anthropic::Beta::BetaRawMessageDeltaEvent::Delta,
86
106
  type: Symbol,
87
107
  usage: Anthropic::Beta::BetaMessageDeltaUsage
@@ -47,7 +47,8 @@ module Anthropic
47
47
 
48
48
  sig do
49
49
  params(
50
- citations: Anthropic::Beta::BetaCitationsConfigParam::OrHash
50
+ citations:
51
+ T.nilable(Anthropic::Beta::BetaCitationsConfigParam::OrHash)
51
52
  ).void
52
53
  end
53
54
  attr_writer :citations
@@ -70,7 +71,8 @@ module Anthropic
70
71
  ),
71
72
  cache_control:
72
73
  T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash),
73
- citations: Anthropic::Beta::BetaCitationsConfigParam::OrHash,
74
+ citations:
75
+ T.nilable(Anthropic::Beta::BetaCitationsConfigParam::OrHash),
74
76
  context: T.nilable(String),
75
77
  title: T.nilable(String),
76
78
  type: Symbol
@@ -101,7 +103,7 @@ module Anthropic
101
103
  type: Symbol,
102
104
  cache_control:
103
105
  T.nilable(Anthropic::Beta::BetaCacheControlEphemeral),
104
- citations: Anthropic::Beta::BetaCitationsConfigParam,
106
+ citations: T.nilable(Anthropic::Beta::BetaCitationsConfigParam),
105
107
  context: T.nilable(String),
106
108
  title: T.nilable(String)
107
109
  }
@@ -14,18 +14,33 @@ module Anthropic
14
14
  )
15
15
  end
16
16
 
17
+ # The number of web fetch tool requests.
18
+ sig { returns(Integer) }
19
+ attr_accessor :web_fetch_requests
20
+
17
21
  # The number of web search tool requests.
18
22
  sig { returns(Integer) }
19
23
  attr_accessor :web_search_requests
20
24
 
21
- sig { params(web_search_requests: Integer).returns(T.attached_class) }
25
+ sig do
26
+ params(
27
+ web_fetch_requests: Integer,
28
+ web_search_requests: Integer
29
+ ).returns(T.attached_class)
30
+ end
22
31
  def self.new(
32
+ # The number of web fetch tool requests.
33
+ web_fetch_requests:,
23
34
  # The number of web search tool requests.
24
35
  web_search_requests:
25
36
  )
26
37
  end
27
38
 
28
- sig { override.returns({ web_search_requests: Integer }) }
39
+ sig do
40
+ override.returns(
41
+ { web_fetch_requests: Integer, web_search_requests: Integer }
42
+ )
43
+ end
29
44
  def to_hash
30
45
  end
31
46
  end
@@ -66,6 +66,11 @@ module Anthropic
66
66
  :web_search,
67
67
  Anthropic::Beta::BetaServerToolUseBlock::Name::TaggedSymbol
68
68
  )
69
+ WEB_FETCH =
70
+ T.let(
71
+ :web_fetch,
72
+ Anthropic::Beta::BetaServerToolUseBlock::Name::TaggedSymbol
73
+ )
69
74
  CODE_EXECUTION =
70
75
  T.let(
71
76
  :code_execution,
@@ -90,6 +90,11 @@ module Anthropic
90
90
  :web_search,
91
91
  Anthropic::Beta::BetaServerToolUseBlockParam::Name::TaggedSymbol
92
92
  )
93
+ WEB_FETCH =
94
+ T.let(
95
+ :web_fetch,
96
+ Anthropic::Beta::BetaServerToolUseBlockParam::Name::TaggedSymbol
97
+ )
93
98
  CODE_EXECUTION =
94
99
  T.let(
95
100
  :code_execution,
@@ -23,6 +23,11 @@ module Anthropic
23
23
  PAUSE_TURN =
24
24
  T.let(:pause_turn, Anthropic::Beta::BetaStopReason::TaggedSymbol)
25
25
  REFUSAL = T.let(:refusal, Anthropic::Beta::BetaStopReason::TaggedSymbol)
26
+ MODEL_CONTEXT_WINDOW_EXCEEDED =
27
+ T.let(
28
+ :model_context_window_exceeded,
29
+ Anthropic::Beta::BetaStopReason::TaggedSymbol
30
+ )
26
31
 
27
32
  sig do
28
33
  override.returns(
@@ -113,7 +113,8 @@ module Anthropic
113
113
  T.any(
114
114
  Anthropic::Beta::BetaTextBlockParam,
115
115
  Anthropic::Beta::BetaImageBlockParam,
116
- Anthropic::Beta::BetaSearchResultBlockParam
116
+ Anthropic::Beta::BetaSearchResultBlockParam,
117
+ Anthropic::Beta::BetaRequestDocumentBlock
117
118
  )
118
119
  end
119
120
 
@@ -17,12 +17,14 @@ module Anthropic
17
17
  Anthropic::Beta::BetaCodeExecutionTool20250522,
18
18
  Anthropic::Beta::BetaCodeExecutionTool20250825,
19
19
  Anthropic::Beta::BetaToolComputerUse20241022,
20
+ Anthropic::Beta::BetaMemoryTool20250818,
20
21
  Anthropic::Beta::BetaToolComputerUse20250124,
21
22
  Anthropic::Beta::BetaToolTextEditor20241022,
22
23
  Anthropic::Beta::BetaToolTextEditor20250124,
23
24
  Anthropic::Beta::BetaToolTextEditor20250429,
24
25
  Anthropic::Beta::BetaToolTextEditor20250728,
25
- Anthropic::Beta::BetaWebSearchTool20250305
26
+ Anthropic::Beta::BetaWebSearchTool20250305,
27
+ Anthropic::Beta::BetaWebFetchTool20250910
26
28
  )
27
29
  end
28
30
 
@@ -0,0 +1,33 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ BetaToolUsesKeep = Beta::BetaToolUsesKeep
6
+
7
+ module Beta
8
+ class BetaToolUsesKeep < Anthropic::Internal::Type::BaseModel
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(
12
+ Anthropic::Beta::BetaToolUsesKeep,
13
+ Anthropic::Internal::AnyHash
14
+ )
15
+ end
16
+
17
+ sig { returns(Symbol) }
18
+ attr_accessor :type
19
+
20
+ sig { returns(Integer) }
21
+ attr_accessor :value
22
+
23
+ sig { params(value: Integer, type: Symbol).returns(T.attached_class) }
24
+ def self.new(value:, type: :tool_uses)
25
+ end
26
+
27
+ sig { override.returns({ type: Symbol, value: Integer }) }
28
+ def to_hash
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end