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
@@ -8,7 +8,7 @@ module Anthropic
8
8
  source: Anthropic::Models::Beta::BetaRequestDocumentBlock::source,
9
9
  type: :document,
10
10
  cache_control: Anthropic::Beta::BetaCacheControlEphemeral?,
11
- citations: Anthropic::Beta::BetaCitationsConfigParam,
11
+ citations: Anthropic::Beta::BetaCitationsConfigParam?,
12
12
  context: String?,
13
13
  title: String?
14
14
  }
@@ -20,11 +20,7 @@ module Anthropic
20
20
 
21
21
  attr_accessor cache_control: Anthropic::Beta::BetaCacheControlEphemeral?
22
22
 
23
- attr_reader citations: Anthropic::Beta::BetaCitationsConfigParam?
24
-
25
- def citations=: (
26
- Anthropic::Beta::BetaCitationsConfigParam
27
- ) -> Anthropic::Beta::BetaCitationsConfigParam
23
+ attr_accessor citations: Anthropic::Beta::BetaCitationsConfigParam?
28
24
 
29
25
  attr_accessor context: String?
30
26
 
@@ -33,7 +29,7 @@ module Anthropic
33
29
  def initialize: (
34
30
  source: Anthropic::Models::Beta::BetaRequestDocumentBlock::source,
35
31
  ?cache_control: Anthropic::Beta::BetaCacheControlEphemeral?,
36
- ?citations: Anthropic::Beta::BetaCitationsConfigParam,
32
+ ?citations: Anthropic::Beta::BetaCitationsConfigParam?,
37
33
  ?context: String?,
38
34
  ?title: String?,
39
35
  ?type: :document
@@ -43,7 +39,7 @@ module Anthropic
43
39
  source: Anthropic::Models::Beta::BetaRequestDocumentBlock::source,
44
40
  type: :document,
45
41
  cache_control: Anthropic::Beta::BetaCacheControlEphemeral?,
46
- citations: Anthropic::Beta::BetaCitationsConfigParam,
42
+ citations: Anthropic::Beta::BetaCitationsConfigParam?,
47
43
  context: String?,
48
44
  title: String?
49
45
  }
@@ -3,14 +3,23 @@ module Anthropic
3
3
  class BetaServerToolUsage = Beta::BetaServerToolUsage
4
4
 
5
5
  module Beta
6
- type beta_server_tool_usage = { web_search_requests: Integer }
6
+ type beta_server_tool_usage =
7
+ { web_fetch_requests: Integer, web_search_requests: Integer }
7
8
 
8
9
  class BetaServerToolUsage < Anthropic::Internal::Type::BaseModel
10
+ attr_accessor web_fetch_requests: Integer
11
+
9
12
  attr_accessor web_search_requests: Integer
10
13
 
11
- def initialize: (web_search_requests: Integer) -> void
14
+ def initialize: (
15
+ web_fetch_requests: Integer,
16
+ web_search_requests: Integer
17
+ ) -> void
12
18
 
13
- def to_hash: -> { web_search_requests: Integer }
19
+ def to_hash: -> {
20
+ web_fetch_requests: Integer,
21
+ web_search_requests: Integer
22
+ }
14
23
  end
15
24
  end
16
25
  end
@@ -36,6 +36,7 @@ module Anthropic
36
36
 
37
37
  type name_ =
38
38
  :web_search
39
+ | :web_fetch
39
40
  | :code_execution
40
41
  | :bash_code_execution
41
42
  | :text_editor_code_execution
@@ -44,6 +45,7 @@ module Anthropic
44
45
  extend Anthropic::Internal::Type::Enum
45
46
 
46
47
  WEB_SEARCH: :web_search
48
+ WEB_FETCH: :web_fetch
47
49
  CODE_EXECUTION: :code_execution
48
50
  BASH_CODE_EXECUTION: :bash_code_execution
49
51
  TEXT_EDITOR_CODE_EXECUTION: :text_editor_code_execution
@@ -41,6 +41,7 @@ module Anthropic
41
41
 
42
42
  type name_ =
43
43
  :web_search
44
+ | :web_fetch
44
45
  | :code_execution
45
46
  | :bash_code_execution
46
47
  | :text_editor_code_execution
@@ -49,6 +50,7 @@ module Anthropic
49
50
  extend Anthropic::Internal::Type::Enum
50
51
 
51
52
  WEB_SEARCH: :web_search
53
+ WEB_FETCH: :web_fetch
52
54
  CODE_EXECUTION: :code_execution
53
55
  BASH_CODE_EXECUTION: :bash_code_execution
54
56
  TEXT_EDITOR_CODE_EXECUTION: :text_editor_code_execution
@@ -10,6 +10,7 @@ module Anthropic
10
10
  | :tool_use
11
11
  | :pause_turn
12
12
  | :refusal
13
+ | :model_context_window_exceeded
13
14
 
14
15
  module BetaStopReason
15
16
  extend Anthropic::Internal::Type::Enum
@@ -20,6 +21,7 @@ module Anthropic
20
21
  TOOL_USE: :tool_use
21
22
  PAUSE_TURN: :pause_turn
22
23
  REFUSAL: :refusal
24
+ MODEL_CONTEXT_WINDOW_EXCEEDED: :model_context_window_exceeded
23
25
 
24
26
  def self?.values: -> ::Array[Anthropic::Models::Beta::beta_stop_reason]
25
27
  end
@@ -56,6 +56,7 @@ module Anthropic
56
56
  Anthropic::Beta::BetaTextBlockParam
57
57
  | Anthropic::Beta::BetaImageBlockParam
58
58
  | Anthropic::Beta::BetaSearchResultBlockParam
59
+ | Anthropic::Beta::BetaRequestDocumentBlock
59
60
 
60
61
  module Content
61
62
  extend Anthropic::Internal::Type::Union
@@ -10,12 +10,14 @@ module Anthropic
10
10
  | Anthropic::Beta::BetaCodeExecutionTool20250522
11
11
  | Anthropic::Beta::BetaCodeExecutionTool20250825
12
12
  | Anthropic::Beta::BetaToolComputerUse20241022
13
+ | Anthropic::Beta::BetaMemoryTool20250818
13
14
  | Anthropic::Beta::BetaToolComputerUse20250124
14
15
  | Anthropic::Beta::BetaToolTextEditor20241022
15
16
  | Anthropic::Beta::BetaToolTextEditor20250124
16
17
  | Anthropic::Beta::BetaToolTextEditor20250429
17
18
  | Anthropic::Beta::BetaToolTextEditor20250728
18
19
  | Anthropic::Beta::BetaWebSearchTool20250305
20
+ | Anthropic::Beta::BetaWebFetchTool20250910
19
21
 
20
22
  module BetaToolUnion
21
23
  extend Anthropic::Internal::Type::Union
@@ -0,0 +1,19 @@
1
+ module Anthropic
2
+ module Models
3
+ class BetaToolUsesKeep = Beta::BetaToolUsesKeep
4
+
5
+ module Beta
6
+ type beta_tool_uses_keep = { type: :tool_uses, value: Integer }
7
+
8
+ class BetaToolUsesKeep < Anthropic::Internal::Type::BaseModel
9
+ attr_accessor type: :tool_uses
10
+
11
+ attr_accessor value: Integer
12
+
13
+ def initialize: (value: Integer, ?type: :tool_uses) -> void
14
+
15
+ def to_hash: -> { type: :tool_uses, value: Integer }
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ module Anthropic
2
+ module Models
3
+ class BetaToolUsesTrigger = Beta::BetaToolUsesTrigger
4
+
5
+ module Beta
6
+ type beta_tool_uses_trigger = { type: :tool_uses, value: Integer }
7
+
8
+ class BetaToolUsesTrigger < Anthropic::Internal::Type::BaseModel
9
+ attr_accessor type: :tool_uses
10
+
11
+ attr_accessor value: Integer
12
+
13
+ def initialize: (value: Integer, ?type: :tool_uses) -> void
14
+
15
+ def to_hash: -> { type: :tool_uses, value: Integer }
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,39 @@
1
+ module Anthropic
2
+ module Models
3
+ class BetaWebFetchBlock = Beta::BetaWebFetchBlock
4
+
5
+ module Beta
6
+ type beta_web_fetch_block =
7
+ {
8
+ content: Anthropic::Beta::BetaDocumentBlock,
9
+ retrieved_at: String?,
10
+ type: :web_fetch_result,
11
+ url: String
12
+ }
13
+
14
+ class BetaWebFetchBlock < Anthropic::Internal::Type::BaseModel
15
+ attr_accessor content: Anthropic::Beta::BetaDocumentBlock
16
+
17
+ attr_accessor retrieved_at: String?
18
+
19
+ attr_accessor type: :web_fetch_result
20
+
21
+ attr_accessor url: String
22
+
23
+ def initialize: (
24
+ content: Anthropic::Beta::BetaDocumentBlock,
25
+ retrieved_at: String?,
26
+ url: String,
27
+ ?type: :web_fetch_result
28
+ ) -> void
29
+
30
+ def to_hash: -> {
31
+ content: Anthropic::Beta::BetaDocumentBlock,
32
+ retrieved_at: String?,
33
+ type: :web_fetch_result,
34
+ url: String
35
+ }
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,39 @@
1
+ module Anthropic
2
+ module Models
3
+ class BetaWebFetchBlockParam = Beta::BetaWebFetchBlockParam
4
+
5
+ module Beta
6
+ type beta_web_fetch_block_param =
7
+ {
8
+ content: Anthropic::Beta::BetaRequestDocumentBlock,
9
+ type: :web_fetch_result,
10
+ url: String,
11
+ retrieved_at: String?
12
+ }
13
+
14
+ class BetaWebFetchBlockParam < Anthropic::Internal::Type::BaseModel
15
+ attr_accessor content: Anthropic::Beta::BetaRequestDocumentBlock
16
+
17
+ attr_accessor type: :web_fetch_result
18
+
19
+ attr_accessor url: String
20
+
21
+ attr_accessor retrieved_at: String?
22
+
23
+ def initialize: (
24
+ content: Anthropic::Beta::BetaRequestDocumentBlock,
25
+ url: String,
26
+ ?retrieved_at: String?,
27
+ ?type: :web_fetch_result
28
+ ) -> void
29
+
30
+ def to_hash: -> {
31
+ content: Anthropic::Beta::BetaRequestDocumentBlock,
32
+ type: :web_fetch_result,
33
+ url: String,
34
+ retrieved_at: String?
35
+ }
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,59 @@
1
+ module Anthropic
2
+ module Models
3
+ class BetaWebFetchTool20250910 = Beta::BetaWebFetchTool20250910
4
+
5
+ module Beta
6
+ type beta_web_fetch_tool20250910 =
7
+ {
8
+ name: :web_fetch,
9
+ type: :web_fetch_20250910,
10
+ allowed_domains: ::Array[String]?,
11
+ blocked_domains: ::Array[String]?,
12
+ cache_control: Anthropic::Beta::BetaCacheControlEphemeral?,
13
+ citations: Anthropic::Beta::BetaCitationsConfigParam?,
14
+ max_content_tokens: Integer?,
15
+ max_uses: Integer?
16
+ }
17
+
18
+ class BetaWebFetchTool20250910 < Anthropic::Internal::Type::BaseModel
19
+ attr_accessor name: :web_fetch
20
+
21
+ attr_accessor type: :web_fetch_20250910
22
+
23
+ attr_accessor allowed_domains: ::Array[String]?
24
+
25
+ attr_accessor blocked_domains: ::Array[String]?
26
+
27
+ attr_accessor cache_control: Anthropic::Beta::BetaCacheControlEphemeral?
28
+
29
+ attr_accessor citations: Anthropic::Beta::BetaCitationsConfigParam?
30
+
31
+ attr_accessor max_content_tokens: Integer?
32
+
33
+ attr_accessor max_uses: Integer?
34
+
35
+ def initialize: (
36
+ ?allowed_domains: ::Array[String]?,
37
+ ?blocked_domains: ::Array[String]?,
38
+ ?cache_control: Anthropic::Beta::BetaCacheControlEphemeral?,
39
+ ?citations: Anthropic::Beta::BetaCitationsConfigParam?,
40
+ ?max_content_tokens: Integer?,
41
+ ?max_uses: Integer?,
42
+ ?name: :web_fetch,
43
+ ?type: :web_fetch_20250910
44
+ ) -> void
45
+
46
+ def to_hash: -> {
47
+ name: :web_fetch,
48
+ type: :web_fetch_20250910,
49
+ allowed_domains: ::Array[String]?,
50
+ blocked_domains: ::Array[String]?,
51
+ cache_control: Anthropic::Beta::BetaCacheControlEphemeral?,
52
+ citations: Anthropic::Beta::BetaCitationsConfigParam?,
53
+ max_content_tokens: Integer?,
54
+ max_uses: Integer?
55
+ }
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,44 @@
1
+ module Anthropic
2
+ module Models
3
+ class BetaWebFetchToolResultBlock = Beta::BetaWebFetchToolResultBlock
4
+
5
+ module Beta
6
+ type beta_web_fetch_tool_result_block =
7
+ {
8
+ content: Anthropic::Models::Beta::BetaWebFetchToolResultBlock::content,
9
+ tool_use_id: String,
10
+ type: :web_fetch_tool_result
11
+ }
12
+
13
+ class BetaWebFetchToolResultBlock < Anthropic::Internal::Type::BaseModel
14
+ attr_accessor content: Anthropic::Models::Beta::BetaWebFetchToolResultBlock::content
15
+
16
+ attr_accessor tool_use_id: String
17
+
18
+ attr_accessor type: :web_fetch_tool_result
19
+
20
+ def initialize: (
21
+ content: Anthropic::Models::Beta::BetaWebFetchToolResultBlock::content,
22
+ tool_use_id: String,
23
+ ?type: :web_fetch_tool_result
24
+ ) -> void
25
+
26
+ def to_hash: -> {
27
+ content: Anthropic::Models::Beta::BetaWebFetchToolResultBlock::content,
28
+ tool_use_id: String,
29
+ type: :web_fetch_tool_result
30
+ }
31
+
32
+ type content =
33
+ Anthropic::Beta::BetaWebFetchToolResultErrorBlock
34
+ | Anthropic::Beta::BetaWebFetchBlock
35
+
36
+ module Content
37
+ extend Anthropic::Internal::Type::Union
38
+
39
+ def self?.variants: -> ::Array[Anthropic::Models::Beta::BetaWebFetchToolResultBlock::content]
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,49 @@
1
+ module Anthropic
2
+ module Models
3
+ class BetaWebFetchToolResultBlockParam = Beta::BetaWebFetchToolResultBlockParam
4
+
5
+ module Beta
6
+ type beta_web_fetch_tool_result_block_param =
7
+ {
8
+ content: Anthropic::Models::Beta::BetaWebFetchToolResultBlockParam::content,
9
+ tool_use_id: String,
10
+ type: :web_fetch_tool_result,
11
+ cache_control: Anthropic::Beta::BetaCacheControlEphemeral?
12
+ }
13
+
14
+ class BetaWebFetchToolResultBlockParam < Anthropic::Internal::Type::BaseModel
15
+ attr_accessor content: Anthropic::Models::Beta::BetaWebFetchToolResultBlockParam::content
16
+
17
+ attr_accessor tool_use_id: String
18
+
19
+ attr_accessor type: :web_fetch_tool_result
20
+
21
+ attr_accessor cache_control: Anthropic::Beta::BetaCacheControlEphemeral?
22
+
23
+ def initialize: (
24
+ content: Anthropic::Models::Beta::BetaWebFetchToolResultBlockParam::content,
25
+ tool_use_id: String,
26
+ ?cache_control: Anthropic::Beta::BetaCacheControlEphemeral?,
27
+ ?type: :web_fetch_tool_result
28
+ ) -> void
29
+
30
+ def to_hash: -> {
31
+ content: Anthropic::Models::Beta::BetaWebFetchToolResultBlockParam::content,
32
+ tool_use_id: String,
33
+ type: :web_fetch_tool_result,
34
+ cache_control: Anthropic::Beta::BetaCacheControlEphemeral?
35
+ }
36
+
37
+ type content =
38
+ Anthropic::Beta::BetaWebFetchToolResultErrorBlockParam
39
+ | Anthropic::Beta::BetaWebFetchBlockParam
40
+
41
+ module Content
42
+ extend Anthropic::Internal::Type::Union
43
+
44
+ def self?.variants: -> ::Array[Anthropic::Models::Beta::BetaWebFetchToolResultBlockParam::content]
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,29 @@
1
+ module Anthropic
2
+ module Models
3
+ class BetaWebFetchToolResultErrorBlock = Beta::BetaWebFetchToolResultErrorBlock
4
+
5
+ module Beta
6
+ type beta_web_fetch_tool_result_error_block =
7
+ {
8
+ error_code: Anthropic::Models::Beta::beta_web_fetch_tool_result_error_code,
9
+ type: :web_fetch_tool_result_error
10
+ }
11
+
12
+ class BetaWebFetchToolResultErrorBlock < Anthropic::Internal::Type::BaseModel
13
+ attr_accessor error_code: Anthropic::Models::Beta::beta_web_fetch_tool_result_error_code
14
+
15
+ attr_accessor type: :web_fetch_tool_result_error
16
+
17
+ def initialize: (
18
+ error_code: Anthropic::Models::Beta::beta_web_fetch_tool_result_error_code,
19
+ ?type: :web_fetch_tool_result_error
20
+ ) -> void
21
+
22
+ def to_hash: -> {
23
+ error_code: Anthropic::Models::Beta::beta_web_fetch_tool_result_error_code,
24
+ type: :web_fetch_tool_result_error
25
+ }
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,29 @@
1
+ module Anthropic
2
+ module Models
3
+ class BetaWebFetchToolResultErrorBlockParam = Beta::BetaWebFetchToolResultErrorBlockParam
4
+
5
+ module Beta
6
+ type beta_web_fetch_tool_result_error_block_param =
7
+ {
8
+ error_code: Anthropic::Models::Beta::beta_web_fetch_tool_result_error_code,
9
+ type: :web_fetch_tool_result_error
10
+ }
11
+
12
+ class BetaWebFetchToolResultErrorBlockParam < Anthropic::Internal::Type::BaseModel
13
+ attr_accessor error_code: Anthropic::Models::Beta::beta_web_fetch_tool_result_error_code
14
+
15
+ attr_accessor type: :web_fetch_tool_result_error
16
+
17
+ def initialize: (
18
+ error_code: Anthropic::Models::Beta::beta_web_fetch_tool_result_error_code,
19
+ ?type: :web_fetch_tool_result_error
20
+ ) -> void
21
+
22
+ def to_hash: -> {
23
+ error_code: Anthropic::Models::Beta::beta_web_fetch_tool_result_error_code,
24
+ type: :web_fetch_tool_result_error
25
+ }
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,32 @@
1
+ module Anthropic
2
+ module Models
3
+ module BetaWebFetchToolResultErrorCode = Beta::BetaWebFetchToolResultErrorCode
4
+
5
+ module Beta
6
+ type beta_web_fetch_tool_result_error_code =
7
+ :invalid_tool_input
8
+ | :url_too_long
9
+ | :url_not_allowed
10
+ | :url_not_accessible
11
+ | :unsupported_content_type
12
+ | :too_many_requests
13
+ | :max_uses_exceeded
14
+ | :unavailable
15
+
16
+ module BetaWebFetchToolResultErrorCode
17
+ extend Anthropic::Internal::Type::Enum
18
+
19
+ INVALID_TOOL_INPUT: :invalid_tool_input
20
+ URL_TOO_LONG: :url_too_long
21
+ URL_NOT_ALLOWED: :url_not_allowed
22
+ URL_NOT_ACCESSIBLE: :url_not_accessible
23
+ UNSUPPORTED_CONTENT_TYPE: :unsupported_content_type
24
+ TOO_MANY_REQUESTS: :too_many_requests
25
+ MAX_USES_EXCEEDED: :max_uses_exceeded
26
+ UNAVAILABLE: :unavailable
27
+
28
+ def self?.values: -> ::Array[Anthropic::Models::Beta::beta_web_fetch_tool_result_error_code]
29
+ end
30
+ end
31
+ end
32
+ end
@@ -5,6 +5,7 @@ module Anthropic
5
5
  {
6
6
  messages: ::Array[Anthropic::Beta::BetaMessageParam],
7
7
  model: Anthropic::Models::model,
8
+ context_management: Anthropic::Beta::BetaContextManagementConfig?,
8
9
  mcp_servers: ::Array[Anthropic::Beta::BetaRequestMCPServerURLDefinition],
9
10
  system_: Anthropic::Models::Beta::MessageCountTokensParams::system_,
10
11
  thinking: Anthropic::Models::Beta::beta_thinking_config_param,
@@ -22,6 +23,8 @@ module Anthropic
22
23
 
23
24
  attr_accessor model: Anthropic::Models::model
24
25
 
26
+ attr_accessor context_management: Anthropic::Beta::BetaContextManagementConfig?
27
+
25
28
  attr_reader mcp_servers: ::Array[Anthropic::Beta::BetaRequestMCPServerURLDefinition]?
26
29
 
27
30
  def mcp_servers=: (
@@ -61,6 +64,7 @@ module Anthropic
61
64
  def initialize: (
62
65
  messages: ::Array[Anthropic::Beta::BetaMessageParam],
63
66
  model: Anthropic::Models::model,
67
+ ?context_management: Anthropic::Beta::BetaContextManagementConfig?,
64
68
  ?mcp_servers: ::Array[Anthropic::Beta::BetaRequestMCPServerURLDefinition],
65
69
  ?system_: Anthropic::Models::Beta::MessageCountTokensParams::system_,
66
70
  ?thinking: Anthropic::Models::Beta::beta_thinking_config_param,
@@ -73,6 +77,7 @@ module Anthropic
73
77
  def to_hash: -> {
74
78
  messages: ::Array[Anthropic::Beta::BetaMessageParam],
75
79
  model: Anthropic::Models::model,
80
+ context_management: Anthropic::Beta::BetaContextManagementConfig?,
76
81
  mcp_servers: ::Array[Anthropic::Beta::BetaRequestMCPServerURLDefinition],
77
82
  system_: Anthropic::Models::Beta::MessageCountTokensParams::system_,
78
83
  thinking: Anthropic::Models::Beta::beta_thinking_config_param,
@@ -99,12 +104,14 @@ module Anthropic
99
104
  | Anthropic::Beta::BetaCodeExecutionTool20250522
100
105
  | Anthropic::Beta::BetaCodeExecutionTool20250825
101
106
  | Anthropic::Beta::BetaToolComputerUse20241022
107
+ | Anthropic::Beta::BetaMemoryTool20250818
102
108
  | Anthropic::Beta::BetaToolComputerUse20250124
103
109
  | Anthropic::Beta::BetaToolTextEditor20241022
104
110
  | Anthropic::Beta::BetaToolTextEditor20250124
105
111
  | Anthropic::Beta::BetaToolTextEditor20250429
106
112
  | Anthropic::Beta::BetaToolTextEditor20250728
107
113
  | Anthropic::Beta::BetaWebSearchTool20250305
114
+ | Anthropic::Beta::BetaWebFetchTool20250910
108
115
 
109
116
  module Tool
110
117
  extend Anthropic::Internal::Type::Union
@@ -7,6 +7,7 @@ module Anthropic
7
7
  messages: ::Array[Anthropic::Beta::BetaMessageParam],
8
8
  model: Anthropic::Models::model,
9
9
  container: String?,
10
+ context_management: Anthropic::Beta::BetaContextManagementConfig?,
10
11
  mcp_servers: ::Array[Anthropic::Beta::BetaRequestMCPServerURLDefinition],
11
12
  metadata: Anthropic::Beta::BetaMetadata,
12
13
  service_tier: Anthropic::Models::Beta::MessageCreateParams::service_tier,
@@ -34,6 +35,8 @@ module Anthropic
34
35
 
35
36
  attr_accessor container: String?
36
37
 
38
+ attr_accessor context_management: Anthropic::Beta::BetaContextManagementConfig?
39
+
37
40
  attr_reader mcp_servers: ::Array[Anthropic::Beta::BetaRequestMCPServerURLDefinition]?
38
41
 
39
42
  def mcp_servers=: (
@@ -103,6 +106,7 @@ module Anthropic
103
106
  messages: ::Array[Anthropic::Beta::BetaMessageParam],
104
107
  model: Anthropic::Models::model,
105
108
  ?container: String?,
109
+ ?context_management: Anthropic::Beta::BetaContextManagementConfig?,
106
110
  ?mcp_servers: ::Array[Anthropic::Beta::BetaRequestMCPServerURLDefinition],
107
111
  ?metadata: Anthropic::Beta::BetaMetadata,
108
112
  ?service_tier: Anthropic::Models::Beta::MessageCreateParams::service_tier,
@@ -123,6 +127,7 @@ module Anthropic
123
127
  messages: ::Array[Anthropic::Beta::BetaMessageParam],
124
128
  model: Anthropic::Models::model,
125
129
  container: String?,
130
+ context_management: Anthropic::Beta::BetaContextManagementConfig?,
126
131
  mcp_servers: ::Array[Anthropic::Beta::BetaRequestMCPServerURLDefinition],
127
132
  metadata: Anthropic::Beta::BetaMetadata,
128
133
  service_tier: Anthropic::Models::Beta::MessageCreateParams::service_tier,
@@ -60,6 +60,7 @@ module Anthropic
60
60
  messages: ::Array[Anthropic::Beta::BetaMessageParam],
61
61
  model: Anthropic::Models::model,
62
62
  container: String?,
63
+ context_management: Anthropic::Beta::BetaContextManagementConfig?,
63
64
  mcp_servers: ::Array[Anthropic::Beta::BetaRequestMCPServerURLDefinition],
64
65
  metadata: Anthropic::Beta::BetaMetadata,
65
66
  service_tier: Anthropic::Models::Beta::Messages::BatchCreateParams::Request::Params::service_tier,
@@ -83,6 +84,8 @@ module Anthropic
83
84
 
84
85
  attr_accessor container: String?
85
86
 
87
+ attr_accessor context_management: Anthropic::Beta::BetaContextManagementConfig?
88
+
86
89
  attr_reader mcp_servers: ::Array[Anthropic::Beta::BetaRequestMCPServerURLDefinition]?
87
90
 
88
91
  def mcp_servers=: (
@@ -150,6 +153,7 @@ module Anthropic
150
153
  messages: ::Array[Anthropic::Beta::BetaMessageParam],
151
154
  model: Anthropic::Models::model,
152
155
  ?container: String?,
156
+ ?context_management: Anthropic::Beta::BetaContextManagementConfig?,
153
157
  ?mcp_servers: ::Array[Anthropic::Beta::BetaRequestMCPServerURLDefinition],
154
158
  ?metadata: Anthropic::Beta::BetaMetadata,
155
159
  ?service_tier: Anthropic::Models::Beta::Messages::BatchCreateParams::Request::Params::service_tier,
@@ -169,6 +173,7 @@ module Anthropic
169
173
  messages: ::Array[Anthropic::Beta::BetaMessageParam],
170
174
  model: Anthropic::Models::model,
171
175
  container: String?,
176
+ context_management: Anthropic::Beta::BetaContextManagementConfig?,
172
177
  mcp_servers: ::Array[Anthropic::Beta::BetaRequestMCPServerURLDefinition],
173
178
  metadata: Anthropic::Beta::BetaMetadata,
174
179
  service_tier: Anthropic::Models::Beta::Messages::BatchCreateParams::Request::Params::service_tier,
@@ -5,7 +5,7 @@ module Anthropic
5
5
  source: Anthropic::Models::DocumentBlockParam::source,
6
6
  type: :document,
7
7
  cache_control: Anthropic::CacheControlEphemeral?,
8
- citations: Anthropic::CitationsConfigParam,
8
+ citations: Anthropic::CitationsConfigParam?,
9
9
  context: String?,
10
10
  title: String?
11
11
  }
@@ -17,11 +17,7 @@ module Anthropic
17
17
 
18
18
  attr_accessor cache_control: Anthropic::CacheControlEphemeral?
19
19
 
20
- attr_reader citations: Anthropic::CitationsConfigParam?
21
-
22
- def citations=: (
23
- Anthropic::CitationsConfigParam
24
- ) -> Anthropic::CitationsConfigParam
20
+ attr_accessor citations: Anthropic::CitationsConfigParam?
25
21
 
26
22
  attr_accessor context: String?
27
23
 
@@ -30,7 +26,7 @@ module Anthropic
30
26
  def initialize: (
31
27
  source: Anthropic::Models::DocumentBlockParam::source,
32
28
  ?cache_control: Anthropic::CacheControlEphemeral?,
33
- ?citations: Anthropic::CitationsConfigParam,
29
+ ?citations: Anthropic::CitationsConfigParam?,
34
30
  ?context: String?,
35
31
  ?title: String?,
36
32
  ?type: :document
@@ -40,7 +36,7 @@ module Anthropic
40
36
  source: Anthropic::Models::DocumentBlockParam::source,
41
37
  type: :document,
42
38
  cache_control: Anthropic::CacheControlEphemeral?,
43
- citations: Anthropic::CitationsConfigParam,
39
+ citations: Anthropic::CitationsConfigParam?,
44
40
  context: String?,
45
41
  title: String?
46
42
  }