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,77 @@
1
+ module Anthropic
2
+ module Models
3
+ class BetaClearToolUses20250919Edit = Beta::BetaClearToolUses20250919Edit
4
+
5
+ module Beta
6
+ type beta_clear_tool_uses20250919_edit =
7
+ {
8
+ type: :clear_tool_uses_20250919,
9
+ clear_at_least: Anthropic::Beta::BetaInputTokensClearAtLeast?,
10
+ clear_tool_inputs: Anthropic::Models::Beta::BetaClearToolUses20250919Edit::clear_tool_inputs?,
11
+ exclude_tools: ::Array[String]?,
12
+ keep: Anthropic::Beta::BetaToolUsesKeep,
13
+ trigger: Anthropic::Models::Beta::BetaClearToolUses20250919Edit::trigger
14
+ }
15
+
16
+ class BetaClearToolUses20250919Edit < Anthropic::Internal::Type::BaseModel
17
+ attr_accessor type: :clear_tool_uses_20250919
18
+
19
+ attr_accessor clear_at_least: Anthropic::Beta::BetaInputTokensClearAtLeast?
20
+
21
+ attr_accessor clear_tool_inputs: Anthropic::Models::Beta::BetaClearToolUses20250919Edit::clear_tool_inputs?
22
+
23
+ attr_accessor exclude_tools: ::Array[String]?
24
+
25
+ attr_reader keep: Anthropic::Beta::BetaToolUsesKeep?
26
+
27
+ def keep=: (
28
+ Anthropic::Beta::BetaToolUsesKeep
29
+ ) -> Anthropic::Beta::BetaToolUsesKeep
30
+
31
+ attr_reader trigger: Anthropic::Models::Beta::BetaClearToolUses20250919Edit::trigger?
32
+
33
+ def trigger=: (
34
+ Anthropic::Models::Beta::BetaClearToolUses20250919Edit::trigger
35
+ ) -> Anthropic::Models::Beta::BetaClearToolUses20250919Edit::trigger
36
+
37
+ def initialize: (
38
+ ?clear_at_least: Anthropic::Beta::BetaInputTokensClearAtLeast?,
39
+ ?clear_tool_inputs: Anthropic::Models::Beta::BetaClearToolUses20250919Edit::clear_tool_inputs?,
40
+ ?exclude_tools: ::Array[String]?,
41
+ ?keep: Anthropic::Beta::BetaToolUsesKeep,
42
+ ?trigger: Anthropic::Models::Beta::BetaClearToolUses20250919Edit::trigger,
43
+ ?type: :clear_tool_uses_20250919
44
+ ) -> void
45
+
46
+ def to_hash: -> {
47
+ type: :clear_tool_uses_20250919,
48
+ clear_at_least: Anthropic::Beta::BetaInputTokensClearAtLeast?,
49
+ clear_tool_inputs: Anthropic::Models::Beta::BetaClearToolUses20250919Edit::clear_tool_inputs?,
50
+ exclude_tools: ::Array[String]?,
51
+ keep: Anthropic::Beta::BetaToolUsesKeep,
52
+ trigger: Anthropic::Models::Beta::BetaClearToolUses20250919Edit::trigger
53
+ }
54
+
55
+ type clear_tool_inputs = bool | ::Array[String]
56
+
57
+ module ClearToolInputs
58
+ extend Anthropic::Internal::Type::Union
59
+
60
+ def self?.variants: -> ::Array[Anthropic::Models::Beta::BetaClearToolUses20250919Edit::clear_tool_inputs]
61
+
62
+ StringArray: Anthropic::Internal::Type::Converter
63
+ end
64
+
65
+ type trigger =
66
+ Anthropic::Beta::BetaInputTokensTrigger
67
+ | Anthropic::Beta::BetaToolUsesTrigger
68
+
69
+ module Trigger
70
+ extend Anthropic::Internal::Type::Union
71
+
72
+ def self?.variants: -> ::Array[Anthropic::Models::Beta::BetaClearToolUses20250919Edit::trigger]
73
+ end
74
+ end
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,34 @@
1
+ module Anthropic
2
+ module Models
3
+ class BetaClearToolUses20250919EditResponse = Beta::BetaClearToolUses20250919EditResponse
4
+
5
+ module Beta
6
+ type beta_clear_tool_uses20250919_edit_response =
7
+ {
8
+ cleared_input_tokens: Integer,
9
+ cleared_tool_uses: Integer,
10
+ type: :clear_tool_uses_20250919
11
+ }
12
+
13
+ class BetaClearToolUses20250919EditResponse < Anthropic::Internal::Type::BaseModel
14
+ attr_accessor cleared_input_tokens: Integer
15
+
16
+ attr_accessor cleared_tool_uses: Integer
17
+
18
+ attr_accessor type: :clear_tool_uses_20250919
19
+
20
+ def initialize: (
21
+ cleared_input_tokens: Integer,
22
+ cleared_tool_uses: Integer,
23
+ ?type: :clear_tool_uses_20250919
24
+ ) -> void
25
+
26
+ def to_hash: -> {
27
+ cleared_input_tokens: Integer,
28
+ cleared_tool_uses: Integer,
29
+ type: :clear_tool_uses_20250919
30
+ }
31
+ end
32
+ end
33
+ end
34
+ end
@@ -10,6 +10,7 @@ module Anthropic
10
10
  | Anthropic::Beta::BetaToolUseBlock
11
11
  | Anthropic::Beta::BetaServerToolUseBlock
12
12
  | Anthropic::Beta::BetaWebSearchToolResultBlock
13
+ | Anthropic::Beta::BetaWebFetchToolResultBlock
13
14
  | Anthropic::Beta::BetaCodeExecutionToolResultBlock
14
15
  | Anthropic::Beta::BetaBashCodeExecutionToolResultBlock
15
16
  | Anthropic::Beta::BetaTextEditorCodeExecutionToolResultBlock
@@ -14,6 +14,7 @@ module Anthropic
14
14
  | Anthropic::Beta::BetaToolResultBlockParam
15
15
  | Anthropic::Beta::BetaServerToolUseBlockParam
16
16
  | Anthropic::Beta::BetaWebSearchToolResultBlockParam
17
+ | Anthropic::Beta::BetaWebFetchToolResultBlockParam
17
18
  | Anthropic::Beta::BetaCodeExecutionToolResultBlockParam
18
19
  | Anthropic::Beta::BetaBashCodeExecutionToolResultBlockParam
19
20
  | Anthropic::Beta::BetaTextEditorCodeExecutionToolResultBlockParam
@@ -0,0 +1,26 @@
1
+ module Anthropic
2
+ module Models
3
+ class BetaContextManagementConfig = Beta::BetaContextManagementConfig
4
+
5
+ module Beta
6
+ type beta_context_management_config =
7
+ { edits: ::Array[Anthropic::Beta::BetaClearToolUses20250919Edit] }
8
+
9
+ class BetaContextManagementConfig < Anthropic::Internal::Type::BaseModel
10
+ attr_reader edits: ::Array[Anthropic::Beta::BetaClearToolUses20250919Edit]?
11
+
12
+ def edits=: (
13
+ ::Array[Anthropic::Beta::BetaClearToolUses20250919Edit]
14
+ ) -> ::Array[Anthropic::Beta::BetaClearToolUses20250919Edit]
15
+
16
+ def initialize: (
17
+ ?edits: ::Array[Anthropic::Beta::BetaClearToolUses20250919Edit]
18
+ ) -> void
19
+
20
+ def to_hash: -> {
21
+ edits: ::Array[Anthropic::Beta::BetaClearToolUses20250919Edit]
22
+ }
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,24 @@
1
+ module Anthropic
2
+ module Models
3
+ class BetaContextManagementResponse = Beta::BetaContextManagementResponse
4
+
5
+ module Beta
6
+ type beta_context_management_response =
7
+ {
8
+ applied_edits: ::Array[Anthropic::Beta::BetaClearToolUses20250919EditResponse]
9
+ }
10
+
11
+ class BetaContextManagementResponse < Anthropic::Internal::Type::BaseModel
12
+ attr_accessor applied_edits: ::Array[Anthropic::Beta::BetaClearToolUses20250919EditResponse]
13
+
14
+ def initialize: (
15
+ applied_edits: ::Array[Anthropic::Beta::BetaClearToolUses20250919EditResponse]
16
+ ) -> void
17
+
18
+ def to_hash: -> {
19
+ applied_edits: ::Array[Anthropic::Beta::BetaClearToolUses20250919EditResponse]
20
+ }
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,18 @@
1
+ module Anthropic
2
+ module Models
3
+ class BetaCountTokensContextManagementResponse = Beta::BetaCountTokensContextManagementResponse
4
+
5
+ module Beta
6
+ type beta_count_tokens_context_management_response =
7
+ { original_input_tokens: Integer }
8
+
9
+ class BetaCountTokensContextManagementResponse < Anthropic::Internal::Type::BaseModel
10
+ attr_accessor original_input_tokens: Integer
11
+
12
+ def initialize: (original_input_tokens: Integer) -> void
13
+
14
+ def to_hash: -> { original_input_tokens: Integer }
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,49 @@
1
+ module Anthropic
2
+ module Models
3
+ class BetaDocumentBlock = Beta::BetaDocumentBlock
4
+
5
+ module Beta
6
+ type beta_document_block =
7
+ {
8
+ citations: Anthropic::Beta::BetaCitationConfig?,
9
+ source: Anthropic::Models::Beta::BetaDocumentBlock::source,
10
+ title: String?,
11
+ type: :document
12
+ }
13
+
14
+ class BetaDocumentBlock < Anthropic::Internal::Type::BaseModel
15
+ attr_accessor citations: Anthropic::Beta::BetaCitationConfig?
16
+
17
+ attr_accessor source: Anthropic::Models::Beta::BetaDocumentBlock::source
18
+
19
+ attr_accessor title: String?
20
+
21
+ attr_accessor type: :document
22
+
23
+ def initialize: (
24
+ citations: Anthropic::Beta::BetaCitationConfig?,
25
+ source: Anthropic::Models::Beta::BetaDocumentBlock::source,
26
+ title: String?,
27
+ ?type: :document
28
+ ) -> void
29
+
30
+ def to_hash: -> {
31
+ citations: Anthropic::Beta::BetaCitationConfig?,
32
+ source: Anthropic::Models::Beta::BetaDocumentBlock::source,
33
+ title: String?,
34
+ type: :document
35
+ }
36
+
37
+ type source =
38
+ Anthropic::Beta::BetaBase64PDFSource
39
+ | Anthropic::Beta::BetaPlainTextSource
40
+
41
+ module Source
42
+ extend Anthropic::Internal::Type::Union
43
+
44
+ def self?.variants: -> ::Array[Anthropic::Models::Beta::BetaDocumentBlock::source]
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,20 @@
1
+ module Anthropic
2
+ module Models
3
+ class BetaInputTokensClearAtLeast = Beta::BetaInputTokensClearAtLeast
4
+
5
+ module Beta
6
+ type beta_input_tokens_clear_at_least =
7
+ { type: :input_tokens, value: Integer }
8
+
9
+ class BetaInputTokensClearAtLeast < Anthropic::Internal::Type::BaseModel
10
+ attr_accessor type: :input_tokens
11
+
12
+ attr_accessor value: Integer
13
+
14
+ def initialize: (value: Integer, ?type: :input_tokens) -> void
15
+
16
+ def to_hash: -> { type: :input_tokens, value: Integer }
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,19 @@
1
+ module Anthropic
2
+ module Models
3
+ class BetaInputTokensTrigger = Beta::BetaInputTokensTrigger
4
+
5
+ module Beta
6
+ type beta_input_tokens_trigger = { type: :input_tokens, value: Integer }
7
+
8
+ class BetaInputTokensTrigger < Anthropic::Internal::Type::BaseModel
9
+ attr_accessor type: :input_tokens
10
+
11
+ attr_accessor value: Integer
12
+
13
+ def initialize: (value: Integer, ?type: :input_tokens) -> void
14
+
15
+ def to_hash: -> { type: :input_tokens, value: Integer }
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,34 @@
1
+ module Anthropic
2
+ module Models
3
+ class BetaMemoryTool20250818 = Beta::BetaMemoryTool20250818
4
+
5
+ module Beta
6
+ type beta_memory_tool20250818 =
7
+ {
8
+ name: :memory,
9
+ type: :memory_20250818,
10
+ cache_control: Anthropic::Beta::BetaCacheControlEphemeral?
11
+ }
12
+
13
+ class BetaMemoryTool20250818 < Anthropic::Internal::Type::BaseModel
14
+ attr_accessor name: :memory
15
+
16
+ attr_accessor type: :memory_20250818
17
+
18
+ attr_accessor cache_control: Anthropic::Beta::BetaCacheControlEphemeral?
19
+
20
+ def initialize: (
21
+ ?cache_control: Anthropic::Beta::BetaCacheControlEphemeral?,
22
+ ?name: :memory,
23
+ ?type: :memory_20250818
24
+ ) -> void
25
+
26
+ def to_hash: -> {
27
+ name: :memory,
28
+ type: :memory_20250818,
29
+ cache_control: Anthropic::Beta::BetaCacheControlEphemeral?
30
+ }
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,21 @@
1
+ module Anthropic
2
+ module Models
3
+ module BetaMemoryTool20250818Command = Beta::BetaMemoryTool20250818Command
4
+
5
+ module Beta
6
+ type beta_memory_tool20250818_command =
7
+ Anthropic::Beta::BetaMemoryTool20250818ViewCommand
8
+ | Anthropic::Beta::BetaMemoryTool20250818CreateCommand
9
+ | Anthropic::Beta::BetaMemoryTool20250818StrReplaceCommand
10
+ | Anthropic::Beta::BetaMemoryTool20250818InsertCommand
11
+ | Anthropic::Beta::BetaMemoryTool20250818DeleteCommand
12
+ | Anthropic::Beta::BetaMemoryTool20250818RenameCommand
13
+
14
+ module BetaMemoryTool20250818Command
15
+ extend Anthropic::Internal::Type::Union
16
+
17
+ def self?.variants: -> ::Array[Anthropic::Models::Beta::beta_memory_tool20250818_command]
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,26 @@
1
+ module Anthropic
2
+ module Models
3
+ class BetaMemoryTool20250818CreateCommand = Beta::BetaMemoryTool20250818CreateCommand
4
+
5
+ module Beta
6
+ type beta_memory_tool20250818_create_command =
7
+ { command: :create, file_text: String, path: String }
8
+
9
+ class BetaMemoryTool20250818CreateCommand < Anthropic::Internal::Type::BaseModel
10
+ attr_accessor command: :create
11
+
12
+ attr_accessor file_text: String
13
+
14
+ attr_accessor path: String
15
+
16
+ def initialize: (
17
+ file_text: String,
18
+ path: String,
19
+ ?command: :create
20
+ ) -> void
21
+
22
+ def to_hash: -> { command: :create, file_text: String, path: String }
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,20 @@
1
+ module Anthropic
2
+ module Models
3
+ class BetaMemoryTool20250818DeleteCommand = Beta::BetaMemoryTool20250818DeleteCommand
4
+
5
+ module Beta
6
+ type beta_memory_tool20250818_delete_command =
7
+ { command: :delete, path: String }
8
+
9
+ class BetaMemoryTool20250818DeleteCommand < Anthropic::Internal::Type::BaseModel
10
+ attr_accessor command: :delete
11
+
12
+ attr_accessor path: String
13
+
14
+ def initialize: (path: String, ?command: :delete) -> void
15
+
16
+ def to_hash: -> { command: :delete, path: String }
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,39 @@
1
+ module Anthropic
2
+ module Models
3
+ class BetaMemoryTool20250818InsertCommand = Beta::BetaMemoryTool20250818InsertCommand
4
+
5
+ module Beta
6
+ type beta_memory_tool20250818_insert_command =
7
+ {
8
+ command: :insert,
9
+ insert_line: Integer,
10
+ insert_text: String,
11
+ path: String
12
+ }
13
+
14
+ class BetaMemoryTool20250818InsertCommand < Anthropic::Internal::Type::BaseModel
15
+ attr_accessor command: :insert
16
+
17
+ attr_accessor insert_line: Integer
18
+
19
+ attr_accessor insert_text: String
20
+
21
+ attr_accessor path: String
22
+
23
+ def initialize: (
24
+ insert_line: Integer,
25
+ insert_text: String,
26
+ path: String,
27
+ ?command: :insert
28
+ ) -> void
29
+
30
+ def to_hash: -> {
31
+ command: :insert,
32
+ insert_line: Integer,
33
+ insert_text: String,
34
+ path: String
35
+ }
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,26 @@
1
+ module Anthropic
2
+ module Models
3
+ class BetaMemoryTool20250818RenameCommand = Beta::BetaMemoryTool20250818RenameCommand
4
+
5
+ module Beta
6
+ type beta_memory_tool20250818_rename_command =
7
+ { command: :rename, new_path: String, old_path: String }
8
+
9
+ class BetaMemoryTool20250818RenameCommand < Anthropic::Internal::Type::BaseModel
10
+ attr_accessor command: :rename
11
+
12
+ attr_accessor new_path: String
13
+
14
+ attr_accessor old_path: String
15
+
16
+ def initialize: (
17
+ new_path: String,
18
+ old_path: String,
19
+ ?command: :rename
20
+ ) -> void
21
+
22
+ def to_hash: -> { command: :rename, new_path: String, old_path: String }
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,39 @@
1
+ module Anthropic
2
+ module Models
3
+ class BetaMemoryTool20250818StrReplaceCommand = Beta::BetaMemoryTool20250818StrReplaceCommand
4
+
5
+ module Beta
6
+ type beta_memory_tool20250818_str_replace_command =
7
+ {
8
+ command: :str_replace,
9
+ new_str: String,
10
+ old_str: String,
11
+ path: String
12
+ }
13
+
14
+ class BetaMemoryTool20250818StrReplaceCommand < Anthropic::Internal::Type::BaseModel
15
+ attr_accessor command: :str_replace
16
+
17
+ attr_accessor new_str: String
18
+
19
+ attr_accessor old_str: String
20
+
21
+ attr_accessor path: String
22
+
23
+ def initialize: (
24
+ new_str: String,
25
+ old_str: String,
26
+ path: String,
27
+ ?command: :str_replace
28
+ ) -> void
29
+
30
+ def to_hash: -> {
31
+ command: :str_replace,
32
+ new_str: String,
33
+ old_str: String,
34
+ path: String
35
+ }
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,32 @@
1
+ module Anthropic
2
+ module Models
3
+ class BetaMemoryTool20250818ViewCommand = Beta::BetaMemoryTool20250818ViewCommand
4
+
5
+ module Beta
6
+ type beta_memory_tool20250818_view_command =
7
+ { command: :view, path: String, view_range: ::Array[Integer] }
8
+
9
+ class BetaMemoryTool20250818ViewCommand < Anthropic::Internal::Type::BaseModel
10
+ attr_accessor command: :view
11
+
12
+ attr_accessor path: String
13
+
14
+ attr_reader view_range: ::Array[Integer]?
15
+
16
+ def view_range=: (::Array[Integer]) -> ::Array[Integer]
17
+
18
+ def initialize: (
19
+ path: String,
20
+ ?view_range: ::Array[Integer],
21
+ ?command: :view
22
+ ) -> void
23
+
24
+ def to_hash: -> {
25
+ command: :view,
26
+ path: String,
27
+ view_range: ::Array[Integer]
28
+ }
29
+ end
30
+ end
31
+ end
32
+ end
@@ -8,6 +8,7 @@ module Anthropic
8
8
  id: String,
9
9
  container: Anthropic::Beta::BetaContainer?,
10
10
  content: ::Array[Anthropic::Models::Beta::beta_content_block],
11
+ context_management: Anthropic::Beta::BetaContextManagementResponse?,
11
12
  model: Anthropic::Models::model,
12
13
  role: :assistant,
13
14
  stop_reason: Anthropic::Models::Beta::beta_stop_reason?,
@@ -23,6 +24,8 @@ module Anthropic
23
24
 
24
25
  attr_accessor content: ::Array[Anthropic::Models::Beta::beta_content_block]
25
26
 
27
+ attr_accessor context_management: Anthropic::Beta::BetaContextManagementResponse?
28
+
26
29
  attr_accessor model: Anthropic::Models::model
27
30
 
28
31
  attr_accessor role: :assistant
@@ -39,6 +42,7 @@ module Anthropic
39
42
  id: String,
40
43
  container: Anthropic::Beta::BetaContainer?,
41
44
  content: ::Array[Anthropic::Models::Beta::beta_content_block],
45
+ context_management: Anthropic::Beta::BetaContextManagementResponse?,
42
46
  model: Anthropic::Models::model,
43
47
  stop_reason: Anthropic::Models::Beta::beta_stop_reason?,
44
48
  stop_sequence: String?,
@@ -51,6 +55,7 @@ module Anthropic
51
55
  id: String,
52
56
  container: Anthropic::Beta::BetaContainer?,
53
57
  content: ::Array[Anthropic::Models::Beta::beta_content_block],
58
+ context_management: Anthropic::Beta::BetaContextManagementResponse?,
54
59
  model: Anthropic::Models::model,
55
60
  role: :assistant,
56
61
  stop_reason: Anthropic::Models::Beta::beta_stop_reason?,
@@ -3,14 +3,26 @@ module Anthropic
3
3
  class BetaMessageTokensCount = Beta::BetaMessageTokensCount
4
4
 
5
5
  module Beta
6
- type beta_message_tokens_count = { input_tokens: Integer }
6
+ type beta_message_tokens_count =
7
+ {
8
+ context_management: Anthropic::Beta::BetaCountTokensContextManagementResponse?,
9
+ input_tokens: Integer
10
+ }
7
11
 
8
12
  class BetaMessageTokensCount < Anthropic::Internal::Type::BaseModel
13
+ attr_accessor context_management: Anthropic::Beta::BetaCountTokensContextManagementResponse?
14
+
9
15
  attr_accessor input_tokens: Integer
10
16
 
11
- def initialize: (input_tokens: Integer) -> void
17
+ def initialize: (
18
+ context_management: Anthropic::Beta::BetaCountTokensContextManagementResponse?,
19
+ input_tokens: Integer
20
+ ) -> void
12
21
 
13
- def to_hash: -> { input_tokens: Integer }
22
+ def to_hash: -> {
23
+ context_management: Anthropic::Beta::BetaCountTokensContextManagementResponse?,
24
+ input_tokens: Integer
25
+ }
14
26
  end
15
27
  end
16
28
  end
@@ -36,6 +36,7 @@ module Anthropic
36
36
  | Anthropic::Beta::BetaToolUseBlock
37
37
  | Anthropic::Beta::BetaServerToolUseBlock
38
38
  | Anthropic::Beta::BetaWebSearchToolResultBlock
39
+ | Anthropic::Beta::BetaWebFetchToolResultBlock
39
40
  | Anthropic::Beta::BetaCodeExecutionToolResultBlock
40
41
  | Anthropic::Beta::BetaBashCodeExecutionToolResultBlock
41
42
  | Anthropic::Beta::BetaTextEditorCodeExecutionToolResultBlock
@@ -5,12 +5,15 @@ module Anthropic
5
5
  module Beta
6
6
  type beta_raw_message_delta_event =
7
7
  {
8
+ context_management: Anthropic::Beta::BetaContextManagementResponse?,
8
9
  delta: Anthropic::Beta::BetaRawMessageDeltaEvent::Delta,
9
10
  type: :message_delta,
10
11
  usage: Anthropic::Beta::BetaMessageDeltaUsage
11
12
  }
12
13
 
13
14
  class BetaRawMessageDeltaEvent < Anthropic::Internal::Type::BaseModel
15
+ attr_accessor context_management: Anthropic::Beta::BetaContextManagementResponse?
16
+
14
17
  attr_accessor delta: Anthropic::Beta::BetaRawMessageDeltaEvent::Delta
15
18
 
16
19
  attr_accessor type: :message_delta
@@ -18,12 +21,14 @@ module Anthropic
18
21
  attr_accessor usage: Anthropic::Beta::BetaMessageDeltaUsage
19
22
 
20
23
  def initialize: (
24
+ context_management: Anthropic::Beta::BetaContextManagementResponse?,
21
25
  delta: Anthropic::Beta::BetaRawMessageDeltaEvent::Delta,
22
26
  usage: Anthropic::Beta::BetaMessageDeltaUsage,
23
27
  ?type: :message_delta
24
28
  ) -> void
25
29
 
26
30
  def to_hash: -> {
31
+ context_management: Anthropic::Beta::BetaContextManagementResponse?,
27
32
  delta: Anthropic::Beta::BetaRawMessageDeltaEvent::Delta,
28
33
  type: :message_delta,
29
34
  usage: Anthropic::Beta::BetaMessageDeltaUsage