anthropic 1.7.0 → 1.9.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 (179) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +34 -0
  3. data/README.md +1 -1
  4. data/lib/anthropic/helpers/input_schema/array_of.rb +41 -0
  5. data/lib/anthropic/helpers/input_schema/base_model.rb +86 -0
  6. data/lib/anthropic/helpers/input_schema/boolean.rb +29 -0
  7. data/lib/anthropic/helpers/input_schema/enum_of.rb +63 -0
  8. data/lib/anthropic/helpers/input_schema/json_schema_converter.rb +199 -0
  9. data/lib/anthropic/helpers/input_schema/parsed_json.rb +39 -0
  10. data/lib/anthropic/helpers/input_schema/property_mapping.rb +47 -0
  11. data/lib/anthropic/helpers/input_schema/union_of.rb +56 -0
  12. data/lib/anthropic/helpers/input_schema.rb +16 -0
  13. data/lib/anthropic/helpers/streaming/message_stream.rb +41 -1
  14. data/lib/anthropic/input_schema.rb +10 -0
  15. data/lib/anthropic/internal/stream.rb +2 -1
  16. data/lib/anthropic/internal/transport/base_client.rb +1 -2
  17. data/lib/anthropic/internal/transport/pooled_net_requester.rb +1 -9
  18. data/lib/anthropic/internal/type/base_model.rb +2 -9
  19. data/lib/anthropic/internal/util.rb +2 -2
  20. data/lib/anthropic/models/beta/beta_bash_code_execution_output_block.rb +25 -0
  21. data/lib/anthropic/models/beta/beta_bash_code_execution_output_block_param.rb +25 -0
  22. data/lib/anthropic/models/beta/beta_bash_code_execution_result_block.rb +44 -0
  23. data/lib/anthropic/models/beta/beta_bash_code_execution_result_block_param.rb +44 -0
  24. data/lib/anthropic/models/beta/beta_bash_code_execution_tool_result_block.rb +43 -0
  25. data/lib/anthropic/models/beta/beta_bash_code_execution_tool_result_block_param.rb +53 -0
  26. data/lib/anthropic/models/beta/beta_bash_code_execution_tool_result_error.rb +39 -0
  27. data/lib/anthropic/models/beta/beta_bash_code_execution_tool_result_error_param.rb +39 -0
  28. data/lib/anthropic/models/beta/beta_citation_config.rb +19 -0
  29. data/lib/anthropic/models/beta/beta_code_execution_tool_20250825.rb +40 -0
  30. data/lib/anthropic/models/beta/beta_content_block.rb +8 -1
  31. data/lib/anthropic/models/beta/beta_content_block_param.rb +9 -1
  32. data/lib/anthropic/models/beta/beta_document_block.rb +56 -0
  33. data/lib/anthropic/models/beta/beta_message.rb +2 -2
  34. data/lib/anthropic/models/beta/beta_message_param.rb +3 -3
  35. data/lib/anthropic/models/beta/beta_raw_content_block_start_event.rb +10 -3
  36. data/lib/anthropic/models/beta/beta_request_document_block.rb +2 -2
  37. data/lib/anthropic/models/beta/beta_server_tool_usage.rb +9 -1
  38. data/lib/anthropic/models/beta/beta_server_tool_use_block.rb +3 -0
  39. data/lib/anthropic/models/beta/beta_server_tool_use_block_param.rb +3 -0
  40. data/lib/anthropic/models/beta/beta_text_editor_code_execution_create_result_block.rb +25 -0
  41. data/lib/anthropic/models/beta/beta_text_editor_code_execution_create_result_block_param.rb +26 -0
  42. data/lib/anthropic/models/beta/beta_text_editor_code_execution_str_replace_result_block.rb +49 -0
  43. data/lib/anthropic/models/beta/beta_text_editor_code_execution_str_replace_result_block_param.rb +50 -0
  44. data/lib/anthropic/models/beta/beta_text_editor_code_execution_tool_result_block.rb +47 -0
  45. data/lib/anthropic/models/beta/beta_text_editor_code_execution_tool_result_block_param.rb +57 -0
  46. data/lib/anthropic/models/beta/beta_text_editor_code_execution_tool_result_error.rb +45 -0
  47. data/lib/anthropic/models/beta/beta_text_editor_code_execution_tool_result_error_param.rb +46 -0
  48. data/lib/anthropic/models/beta/beta_text_editor_code_execution_view_result_block.rb +61 -0
  49. data/lib/anthropic/models/beta/beta_text_editor_code_execution_view_result_block_param.rb +62 -0
  50. data/lib/anthropic/models/beta/beta_tool_result_block_param.rb +6 -4
  51. data/lib/anthropic/models/beta/beta_tool_union.rb +5 -1
  52. data/lib/anthropic/models/beta/beta_web_fetch_block.rb +42 -0
  53. data/lib/anthropic/models/beta/beta_web_fetch_block_param.rb +42 -0
  54. data/lib/anthropic/models/beta/beta_web_fetch_tool_20250910.rb +82 -0
  55. data/lib/anthropic/models/beta/beta_web_fetch_tool_result_block.rb +43 -0
  56. data/lib/anthropic/models/beta/beta_web_fetch_tool_result_block_param.rb +53 -0
  57. data/lib/anthropic/models/beta/beta_web_fetch_tool_result_error_block.rb +25 -0
  58. data/lib/anthropic/models/beta/beta_web_fetch_tool_result_error_block_param.rb +25 -0
  59. data/lib/anthropic/models/beta/beta_web_fetch_tool_result_error_code.rb +25 -0
  60. data/lib/anthropic/models/beta/message_count_tokens_params.rb +9 -30
  61. data/lib/anthropic/models/beta/message_create_params.rb +3 -26
  62. data/lib/anthropic/models/beta/messages/batch_create_params.rb +6 -36
  63. data/lib/anthropic/models/beta/messages/beta_message_batch.rb +1 -4
  64. data/lib/anthropic/models/beta_error_response.rb +7 -1
  65. data/lib/anthropic/models/document_block_param.rb +2 -2
  66. data/lib/anthropic/models/error_response.rb +7 -1
  67. data/lib/anthropic/models/message_count_tokens_params.rb +1 -24
  68. data/lib/anthropic/models/message_create_params.rb +1 -24
  69. data/lib/anthropic/models/messages/batch_create_params.rb +2 -28
  70. data/lib/anthropic/models/tool_result_block_param.rb +6 -4
  71. data/lib/anthropic/models/tool_use_block.rb +8 -0
  72. data/lib/anthropic/resources/beta/messages.rb +3 -3
  73. data/lib/anthropic/resources/messages.rb +85 -1
  74. data/lib/anthropic/version.rb +1 -1
  75. data/lib/anthropic.rb +39 -0
  76. data/rbi/anthropic/errors.rbi +2 -2
  77. data/rbi/anthropic/helpers/input_schema/array_of.rbi +16 -0
  78. data/rbi/anthropic/helpers/input_schema/base_model.rbi +21 -0
  79. data/rbi/anthropic/helpers/input_schema/boolean.rbi +11 -0
  80. data/rbi/anthropic/helpers/input_schema/enum_of.rbi +30 -0
  81. data/rbi/anthropic/helpers/input_schema/json_schema_converter.rbi +89 -0
  82. data/rbi/anthropic/helpers/input_schema/union_of.rbi +23 -0
  83. data/rbi/anthropic/helpers/structured_output.rbi +16 -0
  84. data/rbi/anthropic/input_schema.rbi +12 -0
  85. data/rbi/anthropic/models/beta/beta_bash_code_execution_output_block.rbi +33 -0
  86. data/rbi/anthropic/models/beta/beta_bash_code_execution_output_block_param.rbi +34 -0
  87. data/rbi/anthropic/models/beta/beta_bash_code_execution_result_block.rbi +72 -0
  88. data/rbi/anthropic/models/beta/beta_bash_code_execution_result_block_param.rbi +77 -0
  89. data/rbi/anthropic/models/beta/beta_bash_code_execution_tool_result_block.rbi +86 -0
  90. data/rbi/anthropic/models/beta/beta_bash_code_execution_tool_result_block_param.rbi +110 -0
  91. data/rbi/anthropic/models/beta/beta_bash_code_execution_tool_result_error.rbi +101 -0
  92. data/rbi/anthropic/models/beta/beta_bash_code_execution_tool_result_error_param.rbi +101 -0
  93. data/rbi/anthropic/models/beta/beta_citation_config.rbi +30 -0
  94. data/rbi/anthropic/models/beta/beta_code_execution_tool_20250825.rbi +72 -0
  95. data/rbi/anthropic/models/beta/beta_content_block.rbi +3 -0
  96. data/rbi/anthropic/models/beta/beta_content_block_param.rbi +3 -0
  97. data/rbi/anthropic/models/beta/beta_document_block.rbi +95 -0
  98. data/rbi/anthropic/models/beta/beta_message.rbi +3 -0
  99. data/rbi/anthropic/models/beta/beta_raw_content_block_start_event.rbi +6 -0
  100. data/rbi/anthropic/models/beta/beta_request_document_block.rbi +5 -3
  101. data/rbi/anthropic/models/beta/beta_server_tool_usage.rbi +17 -2
  102. data/rbi/anthropic/models/beta/beta_server_tool_use_block.rbi +15 -0
  103. data/rbi/anthropic/models/beta/beta_server_tool_use_block_param.rbi +15 -0
  104. data/rbi/anthropic/models/beta/beta_text_editor_code_execution_create_result_block.rbi +41 -0
  105. data/rbi/anthropic/models/beta/beta_text_editor_code_execution_create_result_block_param.rbi +41 -0
  106. data/rbi/anthropic/models/beta/beta_text_editor_code_execution_str_replace_result_block.rbi +73 -0
  107. data/rbi/anthropic/models/beta/beta_text_editor_code_execution_str_replace_result_block_param.rbi +73 -0
  108. data/rbi/anthropic/models/beta/beta_text_editor_code_execution_tool_result_block.rbi +90 -0
  109. data/rbi/anthropic/models/beta/beta_text_editor_code_execution_tool_result_block_param.rbi +118 -0
  110. data/rbi/anthropic/models/beta/beta_text_editor_code_execution_tool_result_error.rbi +110 -0
  111. data/rbi/anthropic/models/beta/beta_text_editor_code_execution_tool_result_error_param.rbi +110 -0
  112. data/rbi/anthropic/models/beta/beta_text_editor_code_execution_view_result_block.rbi +118 -0
  113. data/rbi/anthropic/models/beta/beta_text_editor_code_execution_view_result_block_param.rbi +118 -0
  114. data/rbi/anthropic/models/beta/beta_tool_result_block_param.rbi +2 -1
  115. data/rbi/anthropic/models/beta/beta_tool_union.rbi +3 -1
  116. data/rbi/anthropic/models/beta/beta_web_fetch_block.rbi +67 -0
  117. data/rbi/anthropic/models/beta/beta_web_fetch_block_param.rbi +71 -0
  118. data/rbi/anthropic/models/beta/beta_web_fetch_tool_20250910.rbi +125 -0
  119. data/rbi/anthropic/models/beta/beta_web_fetch_tool_result_block.rbi +81 -0
  120. data/rbi/anthropic/models/beta/beta_web_fetch_tool_result_block_param.rbi +109 -0
  121. data/rbi/anthropic/models/beta/beta_web_fetch_tool_result_error_block.rbi +51 -0
  122. data/rbi/anthropic/models/beta/beta_web_fetch_tool_result_error_block_param.rbi +50 -0
  123. data/rbi/anthropic/models/beta/beta_web_fetch_tool_result_error_code.rbi +70 -0
  124. data/rbi/anthropic/models/beta/message_count_tokens_params.rbi +17 -53
  125. data/rbi/anthropic/models/beta/message_create_params.rbi +14 -52
  126. data/rbi/anthropic/models/beta/messages/batch_create_params.rbi +14 -52
  127. data/rbi/anthropic/models/beta_error_response.rbi +10 -2
  128. data/rbi/anthropic/models/document_block_param.rbi +7 -3
  129. data/rbi/anthropic/models/error_response.rbi +10 -2
  130. data/rbi/anthropic/models/message_count_tokens_params.rbi +2 -48
  131. data/rbi/anthropic/models/message_create_params.rbi +2 -48
  132. data/rbi/anthropic/models/messages/batch_create_params.rbi +2 -48
  133. data/rbi/anthropic/models/tool_result_block_param.rbi +2 -1
  134. data/rbi/anthropic/resources/beta/messages.rbi +12 -75
  135. data/rbi/anthropic/resources/messages.rbi +3 -72
  136. data/sig/anthropic/models/beta/beta_bash_code_execution_output_block.rbs +23 -0
  137. data/sig/anthropic/models/beta/beta_bash_code_execution_output_block_param.rbs +23 -0
  138. data/sig/anthropic/models/beta/beta_bash_code_execution_result_block.rbs +44 -0
  139. data/sig/anthropic/models/beta/beta_bash_code_execution_result_block_param.rbs +44 -0
  140. data/sig/anthropic/models/beta/beta_bash_code_execution_tool_result_block.rbs +44 -0
  141. data/sig/anthropic/models/beta/beta_bash_code_execution_tool_result_block_param.rbs +49 -0
  142. data/sig/anthropic/models/beta/beta_bash_code_execution_tool_result_error.rbs +48 -0
  143. data/sig/anthropic/models/beta/beta_bash_code_execution_tool_result_error_param.rbs +48 -0
  144. data/sig/anthropic/models/beta/beta_citation_config.rbs +17 -0
  145. data/sig/anthropic/models/beta/beta_code_execution_tool_20250825.rbs +34 -0
  146. data/sig/anthropic/models/beta/beta_content_block.rbs +3 -0
  147. data/sig/anthropic/models/beta/beta_content_block_param.rbs +3 -0
  148. data/sig/anthropic/models/beta/beta_document_block.rbs +49 -0
  149. data/sig/anthropic/models/beta/beta_raw_content_block_start_event.rbs +3 -0
  150. data/sig/anthropic/models/beta/beta_request_document_block.rbs +4 -8
  151. data/sig/anthropic/models/beta/beta_server_tool_usage.rbs +12 -3
  152. data/sig/anthropic/models/beta/beta_server_tool_use_block.rbs +9 -1
  153. data/sig/anthropic/models/beta/beta_server_tool_use_block_param.rbs +9 -1
  154. data/sig/anthropic/models/beta/beta_text_editor_code_execution_create_result_block.rbs +29 -0
  155. data/sig/anthropic/models/beta/beta_text_editor_code_execution_create_result_block_param.rbs +29 -0
  156. data/sig/anthropic/models/beta/beta_text_editor_code_execution_str_replace_result_block.rbs +49 -0
  157. data/sig/anthropic/models/beta/beta_text_editor_code_execution_str_replace_result_block_param.rbs +49 -0
  158. data/sig/anthropic/models/beta/beta_text_editor_code_execution_tool_result_block.rbs +46 -0
  159. data/sig/anthropic/models/beta/beta_text_editor_code_execution_tool_result_block_param.rbs +51 -0
  160. data/sig/anthropic/models/beta/beta_text_editor_code_execution_tool_result_error.rbs +53 -0
  161. data/sig/anthropic/models/beta/beta_text_editor_code_execution_tool_result_error_param.rbs +53 -0
  162. data/sig/anthropic/models/beta/beta_text_editor_code_execution_view_result_block.rbs +61 -0
  163. data/sig/anthropic/models/beta/beta_text_editor_code_execution_view_result_block_param.rbs +61 -0
  164. data/sig/anthropic/models/beta/beta_tool_result_block_param.rbs +1 -0
  165. data/sig/anthropic/models/beta/beta_tool_union.rbs +2 -0
  166. data/sig/anthropic/models/beta/beta_web_fetch_block.rbs +39 -0
  167. data/sig/anthropic/models/beta/beta_web_fetch_block_param.rbs +39 -0
  168. data/sig/anthropic/models/beta/beta_web_fetch_tool_20250910.rbs +59 -0
  169. data/sig/anthropic/models/beta/beta_web_fetch_tool_result_block.rbs +44 -0
  170. data/sig/anthropic/models/beta/beta_web_fetch_tool_result_block_param.rbs +49 -0
  171. data/sig/anthropic/models/beta/beta_web_fetch_tool_result_error_block.rbs +29 -0
  172. data/sig/anthropic/models/beta/beta_web_fetch_tool_result_error_block_param.rbs +29 -0
  173. data/sig/anthropic/models/beta/beta_web_fetch_tool_result_error_code.rbs +32 -0
  174. data/sig/anthropic/models/beta/message_count_tokens_params.rbs +2 -0
  175. data/sig/anthropic/models/beta_error_response.rbs +13 -2
  176. data/sig/anthropic/models/document_block_param.rbs +4 -8
  177. data/sig/anthropic/models/error_response.rbs +13 -2
  178. data/sig/anthropic/models/tool_result_block_param.rbs +1 -0
  179. metadata +107 -2
@@ -0,0 +1,72 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ BetaCodeExecutionTool20250825 = Beta::BetaCodeExecutionTool20250825
6
+
7
+ module Beta
8
+ class BetaCodeExecutionTool20250825 < Anthropic::Internal::Type::BaseModel
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(
12
+ Anthropic::Beta::BetaCodeExecutionTool20250825,
13
+ Anthropic::Internal::AnyHash
14
+ )
15
+ end
16
+
17
+ # Name of the tool.
18
+ #
19
+ # This is how the tool will be called by the model and in `tool_use` blocks.
20
+ sig { returns(Symbol) }
21
+ attr_accessor :name
22
+
23
+ sig { returns(Symbol) }
24
+ attr_accessor :type
25
+
26
+ # Create a cache control breakpoint at this content block.
27
+ sig { returns(T.nilable(Anthropic::Beta::BetaCacheControlEphemeral)) }
28
+ attr_reader :cache_control
29
+
30
+ sig do
31
+ params(
32
+ cache_control:
33
+ T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash)
34
+ ).void
35
+ end
36
+ attr_writer :cache_control
37
+
38
+ sig do
39
+ params(
40
+ cache_control:
41
+ T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash),
42
+ name: Symbol,
43
+ type: Symbol
44
+ ).returns(T.attached_class)
45
+ end
46
+ def self.new(
47
+ # Create a cache control breakpoint at this content block.
48
+ cache_control: nil,
49
+ # Name of the tool.
50
+ #
51
+ # This is how the tool will be called by the model and in `tool_use` blocks.
52
+ name: :code_execution,
53
+ type: :code_execution_20250825
54
+ )
55
+ end
56
+
57
+ sig do
58
+ override.returns(
59
+ {
60
+ name: Symbol,
61
+ type: Symbol,
62
+ cache_control:
63
+ T.nilable(Anthropic::Beta::BetaCacheControlEphemeral)
64
+ }
65
+ )
66
+ end
67
+ def to_hash
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end
@@ -18,7 +18,10 @@ module Anthropic
18
18
  Anthropic::Beta::BetaToolUseBlock,
19
19
  Anthropic::Beta::BetaServerToolUseBlock,
20
20
  Anthropic::Beta::BetaWebSearchToolResultBlock,
21
+ Anthropic::Beta::BetaWebFetchToolResultBlock,
21
22
  Anthropic::Beta::BetaCodeExecutionToolResultBlock,
23
+ Anthropic::Beta::BetaBashCodeExecutionToolResultBlock,
24
+ Anthropic::Beta::BetaTextEditorCodeExecutionToolResultBlock,
22
25
  Anthropic::Beta::BetaMCPToolUseBlock,
23
26
  Anthropic::Beta::BetaMCPToolResultBlock,
24
27
  Anthropic::Beta::BetaContainerUploadBlock
@@ -22,7 +22,10 @@ module Anthropic
22
22
  Anthropic::Beta::BetaToolResultBlockParam,
23
23
  Anthropic::Beta::BetaServerToolUseBlockParam,
24
24
  Anthropic::Beta::BetaWebSearchToolResultBlockParam,
25
+ Anthropic::Beta::BetaWebFetchToolResultBlockParam,
25
26
  Anthropic::Beta::BetaCodeExecutionToolResultBlockParam,
27
+ Anthropic::Beta::BetaBashCodeExecutionToolResultBlockParam,
28
+ Anthropic::Beta::BetaTextEditorCodeExecutionToolResultBlockParam,
26
29
  Anthropic::Beta::BetaMCPToolUseBlockParam,
27
30
  Anthropic::Beta::BetaRequestMCPToolResultBlockParam,
28
31
  Anthropic::Beta::BetaContainerUploadBlockParam
@@ -0,0 +1,95 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ BetaDocumentBlock = Beta::BetaDocumentBlock
6
+
7
+ module Beta
8
+ class BetaDocumentBlock < Anthropic::Internal::Type::BaseModel
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(
12
+ Anthropic::Beta::BetaDocumentBlock,
13
+ Anthropic::Internal::AnyHash
14
+ )
15
+ end
16
+
17
+ # Citation configuration for the document
18
+ sig { returns(T.nilable(Anthropic::Beta::BetaCitationConfig)) }
19
+ attr_reader :citations
20
+
21
+ sig do
22
+ params(
23
+ citations: T.nilable(Anthropic::Beta::BetaCitationConfig::OrHash)
24
+ ).void
25
+ end
26
+ attr_writer :citations
27
+
28
+ sig { returns(Anthropic::Beta::BetaDocumentBlock::Source::Variants) }
29
+ attr_accessor :source
30
+
31
+ # The title of the document
32
+ sig { returns(T.nilable(String)) }
33
+ attr_accessor :title
34
+
35
+ sig { returns(Symbol) }
36
+ attr_accessor :type
37
+
38
+ sig do
39
+ params(
40
+ citations: T.nilable(Anthropic::Beta::BetaCitationConfig::OrHash),
41
+ source:
42
+ T.any(
43
+ Anthropic::Beta::BetaBase64PDFSource::OrHash,
44
+ Anthropic::Beta::BetaPlainTextSource::OrHash
45
+ ),
46
+ title: T.nilable(String),
47
+ type: Symbol
48
+ ).returns(T.attached_class)
49
+ end
50
+ def self.new(
51
+ # Citation configuration for the document
52
+ citations:,
53
+ source:,
54
+ # The title of the document
55
+ title:,
56
+ type: :document
57
+ )
58
+ end
59
+
60
+ sig do
61
+ override.returns(
62
+ {
63
+ citations: T.nilable(Anthropic::Beta::BetaCitationConfig),
64
+ source: Anthropic::Beta::BetaDocumentBlock::Source::Variants,
65
+ title: T.nilable(String),
66
+ type: Symbol
67
+ }
68
+ )
69
+ end
70
+ def to_hash
71
+ end
72
+
73
+ module Source
74
+ extend Anthropic::Internal::Type::Union
75
+
76
+ Variants =
77
+ T.type_alias do
78
+ T.any(
79
+ Anthropic::Beta::BetaBase64PDFSource,
80
+ Anthropic::Beta::BetaPlainTextSource
81
+ )
82
+ end
83
+
84
+ sig do
85
+ override.returns(
86
+ T::Array[Anthropic::Beta::BetaDocumentBlock::Source::Variants]
87
+ )
88
+ end
89
+ def self.variants
90
+ end
91
+ end
92
+ end
93
+ end
94
+ end
95
+ end
@@ -143,7 +143,10 @@ module Anthropic
143
143
  Anthropic::Beta::BetaToolUseBlock::OrHash,
144
144
  Anthropic::Beta::BetaServerToolUseBlock::OrHash,
145
145
  Anthropic::Beta::BetaWebSearchToolResultBlock::OrHash,
146
+ Anthropic::Beta::BetaWebFetchToolResultBlock::OrHash,
146
147
  Anthropic::Beta::BetaCodeExecutionToolResultBlock::OrHash,
148
+ Anthropic::Beta::BetaBashCodeExecutionToolResultBlock::OrHash,
149
+ Anthropic::Beta::BetaTextEditorCodeExecutionToolResultBlock::OrHash,
147
150
  Anthropic::Beta::BetaMCPToolUseBlock::OrHash,
148
151
  Anthropic::Beta::BetaMCPToolResultBlock::OrHash,
149
152
  Anthropic::Beta::BetaContainerUploadBlock::OrHash
@@ -38,7 +38,10 @@ 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,
43
+ Anthropic::Beta::BetaBashCodeExecutionToolResultBlock::OrHash,
44
+ Anthropic::Beta::BetaTextEditorCodeExecutionToolResultBlock::OrHash,
42
45
  Anthropic::Beta::BetaMCPToolUseBlock::OrHash,
43
46
  Anthropic::Beta::BetaMCPToolResultBlock::OrHash,
44
47
  Anthropic::Beta::BetaContainerUploadBlock::OrHash
@@ -81,7 +84,10 @@ module Anthropic
81
84
  Anthropic::Beta::BetaToolUseBlock,
82
85
  Anthropic::Beta::BetaServerToolUseBlock,
83
86
  Anthropic::Beta::BetaWebSearchToolResultBlock,
87
+ Anthropic::Beta::BetaWebFetchToolResultBlock,
84
88
  Anthropic::Beta::BetaCodeExecutionToolResultBlock,
89
+ Anthropic::Beta::BetaBashCodeExecutionToolResultBlock,
90
+ Anthropic::Beta::BetaTextEditorCodeExecutionToolResultBlock,
85
91
  Anthropic::Beta::BetaMCPToolUseBlock,
86
92
  Anthropic::Beta::BetaMCPToolResultBlock,
87
93
  Anthropic::Beta::BetaContainerUploadBlock
@@ -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,11 +66,26 @@ 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,
72
77
  Anthropic::Beta::BetaServerToolUseBlock::Name::TaggedSymbol
73
78
  )
79
+ BASH_CODE_EXECUTION =
80
+ T.let(
81
+ :bash_code_execution,
82
+ Anthropic::Beta::BetaServerToolUseBlock::Name::TaggedSymbol
83
+ )
84
+ TEXT_EDITOR_CODE_EXECUTION =
85
+ T.let(
86
+ :text_editor_code_execution,
87
+ Anthropic::Beta::BetaServerToolUseBlock::Name::TaggedSymbol
88
+ )
74
89
 
75
90
  sig do
76
91
  override.returns(
@@ -90,11 +90,26 @@ 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,
96
101
  Anthropic::Beta::BetaServerToolUseBlockParam::Name::TaggedSymbol
97
102
  )
103
+ BASH_CODE_EXECUTION =
104
+ T.let(
105
+ :bash_code_execution,
106
+ Anthropic::Beta::BetaServerToolUseBlockParam::Name::TaggedSymbol
107
+ )
108
+ TEXT_EDITOR_CODE_EXECUTION =
109
+ T.let(
110
+ :text_editor_code_execution,
111
+ Anthropic::Beta::BetaServerToolUseBlockParam::Name::TaggedSymbol
112
+ )
98
113
 
99
114
  sig do
100
115
  override.returns(
@@ -0,0 +1,41 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ BetaTextEditorCodeExecutionCreateResultBlock =
6
+ Beta::BetaTextEditorCodeExecutionCreateResultBlock
7
+
8
+ module Beta
9
+ class BetaTextEditorCodeExecutionCreateResultBlock < Anthropic::Internal::Type::BaseModel
10
+ OrHash =
11
+ T.type_alias do
12
+ T.any(
13
+ Anthropic::Beta::BetaTextEditorCodeExecutionCreateResultBlock,
14
+ Anthropic::Internal::AnyHash
15
+ )
16
+ end
17
+
18
+ sig { returns(T::Boolean) }
19
+ attr_accessor :is_file_update
20
+
21
+ sig { returns(Symbol) }
22
+ attr_accessor :type
23
+
24
+ sig do
25
+ params(is_file_update: T::Boolean, type: Symbol).returns(
26
+ T.attached_class
27
+ )
28
+ end
29
+ def self.new(
30
+ is_file_update:,
31
+ type: :text_editor_code_execution_create_result
32
+ )
33
+ end
34
+
35
+ sig { override.returns({ is_file_update: T::Boolean, type: Symbol }) }
36
+ def to_hash
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,41 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ BetaTextEditorCodeExecutionCreateResultBlockParam =
6
+ Beta::BetaTextEditorCodeExecutionCreateResultBlockParam
7
+
8
+ module Beta
9
+ class BetaTextEditorCodeExecutionCreateResultBlockParam < Anthropic::Internal::Type::BaseModel
10
+ OrHash =
11
+ T.type_alias do
12
+ T.any(
13
+ Anthropic::Beta::BetaTextEditorCodeExecutionCreateResultBlockParam,
14
+ Anthropic::Internal::AnyHash
15
+ )
16
+ end
17
+
18
+ sig { returns(T::Boolean) }
19
+ attr_accessor :is_file_update
20
+
21
+ sig { returns(Symbol) }
22
+ attr_accessor :type
23
+
24
+ sig do
25
+ params(is_file_update: T::Boolean, type: Symbol).returns(
26
+ T.attached_class
27
+ )
28
+ end
29
+ def self.new(
30
+ is_file_update:,
31
+ type: :text_editor_code_execution_create_result
32
+ )
33
+ end
34
+
35
+ sig { override.returns({ is_file_update: T::Boolean, type: Symbol }) }
36
+ def to_hash
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,73 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ BetaTextEditorCodeExecutionStrReplaceResultBlock =
6
+ Beta::BetaTextEditorCodeExecutionStrReplaceResultBlock
7
+
8
+ module Beta
9
+ class BetaTextEditorCodeExecutionStrReplaceResultBlock < Anthropic::Internal::Type::BaseModel
10
+ OrHash =
11
+ T.type_alias do
12
+ T.any(
13
+ Anthropic::Beta::BetaTextEditorCodeExecutionStrReplaceResultBlock,
14
+ Anthropic::Internal::AnyHash
15
+ )
16
+ end
17
+
18
+ sig { returns(T.nilable(T::Array[String])) }
19
+ attr_accessor :lines
20
+
21
+ sig { returns(T.nilable(Integer)) }
22
+ attr_accessor :new_lines
23
+
24
+ sig { returns(T.nilable(Integer)) }
25
+ attr_accessor :new_start
26
+
27
+ sig { returns(T.nilable(Integer)) }
28
+ attr_accessor :old_lines
29
+
30
+ sig { returns(T.nilable(Integer)) }
31
+ attr_accessor :old_start
32
+
33
+ sig { returns(Symbol) }
34
+ attr_accessor :type
35
+
36
+ sig do
37
+ params(
38
+ lines: T.nilable(T::Array[String]),
39
+ new_lines: T.nilable(Integer),
40
+ new_start: T.nilable(Integer),
41
+ old_lines: T.nilable(Integer),
42
+ old_start: T.nilable(Integer),
43
+ type: Symbol
44
+ ).returns(T.attached_class)
45
+ end
46
+ def self.new(
47
+ lines:,
48
+ new_lines:,
49
+ new_start:,
50
+ old_lines:,
51
+ old_start:,
52
+ type: :text_editor_code_execution_str_replace_result
53
+ )
54
+ end
55
+
56
+ sig do
57
+ override.returns(
58
+ {
59
+ lines: T.nilable(T::Array[String]),
60
+ new_lines: T.nilable(Integer),
61
+ new_start: T.nilable(Integer),
62
+ old_lines: T.nilable(Integer),
63
+ old_start: T.nilable(Integer),
64
+ type: Symbol
65
+ }
66
+ )
67
+ end
68
+ def to_hash
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,73 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ BetaTextEditorCodeExecutionStrReplaceResultBlockParam =
6
+ Beta::BetaTextEditorCodeExecutionStrReplaceResultBlockParam
7
+
8
+ module Beta
9
+ class BetaTextEditorCodeExecutionStrReplaceResultBlockParam < Anthropic::Internal::Type::BaseModel
10
+ OrHash =
11
+ T.type_alias do
12
+ T.any(
13
+ Anthropic::Beta::BetaTextEditorCodeExecutionStrReplaceResultBlockParam,
14
+ Anthropic::Internal::AnyHash
15
+ )
16
+ end
17
+
18
+ sig { returns(Symbol) }
19
+ attr_accessor :type
20
+
21
+ sig { returns(T.nilable(T::Array[String])) }
22
+ attr_accessor :lines
23
+
24
+ sig { returns(T.nilable(Integer)) }
25
+ attr_accessor :new_lines
26
+
27
+ sig { returns(T.nilable(Integer)) }
28
+ attr_accessor :new_start
29
+
30
+ sig { returns(T.nilable(Integer)) }
31
+ attr_accessor :old_lines
32
+
33
+ sig { returns(T.nilable(Integer)) }
34
+ attr_accessor :old_start
35
+
36
+ sig do
37
+ params(
38
+ lines: T.nilable(T::Array[String]),
39
+ new_lines: T.nilable(Integer),
40
+ new_start: T.nilable(Integer),
41
+ old_lines: T.nilable(Integer),
42
+ old_start: T.nilable(Integer),
43
+ type: Symbol
44
+ ).returns(T.attached_class)
45
+ end
46
+ def self.new(
47
+ lines: nil,
48
+ new_lines: nil,
49
+ new_start: nil,
50
+ old_lines: nil,
51
+ old_start: nil,
52
+ type: :text_editor_code_execution_str_replace_result
53
+ )
54
+ end
55
+
56
+ sig do
57
+ override.returns(
58
+ {
59
+ type: Symbol,
60
+ lines: T.nilable(T::Array[String]),
61
+ new_lines: T.nilable(Integer),
62
+ new_start: T.nilable(Integer),
63
+ old_lines: T.nilable(Integer),
64
+ old_start: T.nilable(Integer)
65
+ }
66
+ )
67
+ end
68
+ def to_hash
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,90 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ BetaTextEditorCodeExecutionToolResultBlock =
6
+ Beta::BetaTextEditorCodeExecutionToolResultBlock
7
+
8
+ module Beta
9
+ class BetaTextEditorCodeExecutionToolResultBlock < Anthropic::Internal::Type::BaseModel
10
+ OrHash =
11
+ T.type_alias do
12
+ T.any(
13
+ Anthropic::Beta::BetaTextEditorCodeExecutionToolResultBlock,
14
+ Anthropic::Internal::AnyHash
15
+ )
16
+ end
17
+
18
+ sig do
19
+ returns(
20
+ Anthropic::Beta::BetaTextEditorCodeExecutionToolResultBlock::Content::Variants
21
+ )
22
+ end
23
+ attr_accessor :content
24
+
25
+ sig { returns(String) }
26
+ attr_accessor :tool_use_id
27
+
28
+ sig { returns(Symbol) }
29
+ attr_accessor :type
30
+
31
+ sig do
32
+ params(
33
+ content:
34
+ T.any(
35
+ Anthropic::Beta::BetaTextEditorCodeExecutionToolResultError::OrHash,
36
+ Anthropic::Beta::BetaTextEditorCodeExecutionViewResultBlock::OrHash,
37
+ Anthropic::Beta::BetaTextEditorCodeExecutionCreateResultBlock::OrHash,
38
+ Anthropic::Beta::BetaTextEditorCodeExecutionStrReplaceResultBlock::OrHash
39
+ ),
40
+ tool_use_id: String,
41
+ type: Symbol
42
+ ).returns(T.attached_class)
43
+ end
44
+ def self.new(
45
+ content:,
46
+ tool_use_id:,
47
+ type: :text_editor_code_execution_tool_result
48
+ )
49
+ end
50
+
51
+ sig do
52
+ override.returns(
53
+ {
54
+ content:
55
+ Anthropic::Beta::BetaTextEditorCodeExecutionToolResultBlock::Content::Variants,
56
+ tool_use_id: String,
57
+ type: Symbol
58
+ }
59
+ )
60
+ end
61
+ def to_hash
62
+ end
63
+
64
+ module Content
65
+ extend Anthropic::Internal::Type::Union
66
+
67
+ Variants =
68
+ T.type_alias do
69
+ T.any(
70
+ Anthropic::Beta::BetaTextEditorCodeExecutionToolResultError,
71
+ Anthropic::Beta::BetaTextEditorCodeExecutionViewResultBlock,
72
+ Anthropic::Beta::BetaTextEditorCodeExecutionCreateResultBlock,
73
+ Anthropic::Beta::BetaTextEditorCodeExecutionStrReplaceResultBlock
74
+ )
75
+ end
76
+
77
+ sig do
78
+ override.returns(
79
+ T::Array[
80
+ Anthropic::Beta::BetaTextEditorCodeExecutionToolResultBlock::Content::Variants
81
+ ]
82
+ )
83
+ end
84
+ def self.variants
85
+ end
86
+ end
87
+ end
88
+ end
89
+ end
90
+ end