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,16 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Helpers
5
+ # Helpers for the structured output API.
6
+ #
7
+ # see https://platform.Anthropic.com/docs/guides/structured-outputs
8
+ # see https://json-schema.org
9
+ #
10
+ # Based on the DSL in {Anthropic::Internal::Type}, but currently only support the limited subset of JSON schema types used in structured output APIs.
11
+ #
12
+ # Supported types: {NilClass} {String} {Symbol} {Integer} {Float} {Anthropic::Boolean}, {Anthropic::EnumOf}, {Anthropic::UnionOf}, {Anthropic::ArrayOf}, {Anthropic::BaseModel}
13
+ module InputSchema
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,12 @@
1
+ # typed: strong
2
+ # frozen_string_literal: true
3
+
4
+ module Anthropic
5
+ # Convenience aliases for input schema classes
6
+ InputSchema = Anthropic::Helpers::InputSchema
7
+ ArrayOf = Anthropic::Helpers::InputSchema::ArrayOf
8
+ BaseModel = Anthropic::Helpers::InputSchema::BaseModel
9
+ Boolean = Anthropic::Helpers::InputSchema::Boolean
10
+ EnumOf = Anthropic::Helpers::InputSchema::EnumOf
11
+ UnionOf = Anthropic::Helpers::InputSchema::UnionOf
12
+ end
@@ -0,0 +1,33 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ BetaBashCodeExecutionOutputBlock = Beta::BetaBashCodeExecutionOutputBlock
6
+
7
+ module Beta
8
+ class BetaBashCodeExecutionOutputBlock < Anthropic::Internal::Type::BaseModel
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(
12
+ Anthropic::Beta::BetaBashCodeExecutionOutputBlock,
13
+ Anthropic::Internal::AnyHash
14
+ )
15
+ end
16
+
17
+ sig { returns(String) }
18
+ attr_accessor :file_id
19
+
20
+ sig { returns(Symbol) }
21
+ attr_accessor :type
22
+
23
+ sig { params(file_id: String, type: Symbol).returns(T.attached_class) }
24
+ def self.new(file_id:, type: :bash_code_execution_output)
25
+ end
26
+
27
+ sig { override.returns({ file_id: String, type: Symbol }) }
28
+ def to_hash
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,34 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ BetaBashCodeExecutionOutputBlockParam =
6
+ Beta::BetaBashCodeExecutionOutputBlockParam
7
+
8
+ module Beta
9
+ class BetaBashCodeExecutionOutputBlockParam < Anthropic::Internal::Type::BaseModel
10
+ OrHash =
11
+ T.type_alias do
12
+ T.any(
13
+ Anthropic::Beta::BetaBashCodeExecutionOutputBlockParam,
14
+ Anthropic::Internal::AnyHash
15
+ )
16
+ end
17
+
18
+ sig { returns(String) }
19
+ attr_accessor :file_id
20
+
21
+ sig { returns(Symbol) }
22
+ attr_accessor :type
23
+
24
+ sig { params(file_id: String, type: Symbol).returns(T.attached_class) }
25
+ def self.new(file_id:, type: :bash_code_execution_output)
26
+ end
27
+
28
+ sig { override.returns({ file_id: String, type: Symbol }) }
29
+ def to_hash
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,72 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ BetaBashCodeExecutionResultBlock = Beta::BetaBashCodeExecutionResultBlock
6
+
7
+ module Beta
8
+ class BetaBashCodeExecutionResultBlock < Anthropic::Internal::Type::BaseModel
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(
12
+ Anthropic::Beta::BetaBashCodeExecutionResultBlock,
13
+ Anthropic::Internal::AnyHash
14
+ )
15
+ end
16
+
17
+ sig do
18
+ returns(T::Array[Anthropic::Beta::BetaBashCodeExecutionOutputBlock])
19
+ end
20
+ attr_accessor :content
21
+
22
+ sig { returns(Integer) }
23
+ attr_accessor :return_code
24
+
25
+ sig { returns(String) }
26
+ attr_accessor :stderr
27
+
28
+ sig { returns(String) }
29
+ attr_accessor :stdout
30
+
31
+ sig { returns(Symbol) }
32
+ attr_accessor :type
33
+
34
+ sig do
35
+ params(
36
+ content:
37
+ T::Array[
38
+ Anthropic::Beta::BetaBashCodeExecutionOutputBlock::OrHash
39
+ ],
40
+ return_code: Integer,
41
+ stderr: String,
42
+ stdout: String,
43
+ type: Symbol
44
+ ).returns(T.attached_class)
45
+ end
46
+ def self.new(
47
+ content:,
48
+ return_code:,
49
+ stderr:,
50
+ stdout:,
51
+ type: :bash_code_execution_result
52
+ )
53
+ end
54
+
55
+ sig do
56
+ override.returns(
57
+ {
58
+ content:
59
+ T::Array[Anthropic::Beta::BetaBashCodeExecutionOutputBlock],
60
+ return_code: Integer,
61
+ stderr: String,
62
+ stdout: String,
63
+ type: Symbol
64
+ }
65
+ )
66
+ end
67
+ def to_hash
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,77 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ BetaBashCodeExecutionResultBlockParam =
6
+ Beta::BetaBashCodeExecutionResultBlockParam
7
+
8
+ module Beta
9
+ class BetaBashCodeExecutionResultBlockParam < Anthropic::Internal::Type::BaseModel
10
+ OrHash =
11
+ T.type_alias do
12
+ T.any(
13
+ Anthropic::Beta::BetaBashCodeExecutionResultBlockParam,
14
+ Anthropic::Internal::AnyHash
15
+ )
16
+ end
17
+
18
+ sig do
19
+ returns(
20
+ T::Array[Anthropic::Beta::BetaBashCodeExecutionOutputBlockParam]
21
+ )
22
+ end
23
+ attr_accessor :content
24
+
25
+ sig { returns(Integer) }
26
+ attr_accessor :return_code
27
+
28
+ sig { returns(String) }
29
+ attr_accessor :stderr
30
+
31
+ sig { returns(String) }
32
+ attr_accessor :stdout
33
+
34
+ sig { returns(Symbol) }
35
+ attr_accessor :type
36
+
37
+ sig do
38
+ params(
39
+ content:
40
+ T::Array[
41
+ Anthropic::Beta::BetaBashCodeExecutionOutputBlockParam::OrHash
42
+ ],
43
+ return_code: Integer,
44
+ stderr: String,
45
+ stdout: String,
46
+ type: Symbol
47
+ ).returns(T.attached_class)
48
+ end
49
+ def self.new(
50
+ content:,
51
+ return_code:,
52
+ stderr:,
53
+ stdout:,
54
+ type: :bash_code_execution_result
55
+ )
56
+ end
57
+
58
+ sig do
59
+ override.returns(
60
+ {
61
+ content:
62
+ T::Array[
63
+ Anthropic::Beta::BetaBashCodeExecutionOutputBlockParam
64
+ ],
65
+ return_code: Integer,
66
+ stderr: String,
67
+ stdout: String,
68
+ type: Symbol
69
+ }
70
+ )
71
+ end
72
+ def to_hash
73
+ end
74
+ end
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,86 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ BetaBashCodeExecutionToolResultBlock =
6
+ Beta::BetaBashCodeExecutionToolResultBlock
7
+
8
+ module Beta
9
+ class BetaBashCodeExecutionToolResultBlock < Anthropic::Internal::Type::BaseModel
10
+ OrHash =
11
+ T.type_alias do
12
+ T.any(
13
+ Anthropic::Beta::BetaBashCodeExecutionToolResultBlock,
14
+ Anthropic::Internal::AnyHash
15
+ )
16
+ end
17
+
18
+ sig do
19
+ returns(
20
+ Anthropic::Beta::BetaBashCodeExecutionToolResultBlock::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::BetaBashCodeExecutionToolResultError::OrHash,
36
+ Anthropic::Beta::BetaBashCodeExecutionResultBlock::OrHash
37
+ ),
38
+ tool_use_id: String,
39
+ type: Symbol
40
+ ).returns(T.attached_class)
41
+ end
42
+ def self.new(
43
+ content:,
44
+ tool_use_id:,
45
+ type: :bash_code_execution_tool_result
46
+ )
47
+ end
48
+
49
+ sig do
50
+ override.returns(
51
+ {
52
+ content:
53
+ Anthropic::Beta::BetaBashCodeExecutionToolResultBlock::Content::Variants,
54
+ tool_use_id: String,
55
+ type: Symbol
56
+ }
57
+ )
58
+ end
59
+ def to_hash
60
+ end
61
+
62
+ module Content
63
+ extend Anthropic::Internal::Type::Union
64
+
65
+ Variants =
66
+ T.type_alias do
67
+ T.any(
68
+ Anthropic::Beta::BetaBashCodeExecutionToolResultError,
69
+ Anthropic::Beta::BetaBashCodeExecutionResultBlock
70
+ )
71
+ end
72
+
73
+ sig do
74
+ override.returns(
75
+ T::Array[
76
+ Anthropic::Beta::BetaBashCodeExecutionToolResultBlock::Content::Variants
77
+ ]
78
+ )
79
+ end
80
+ def self.variants
81
+ end
82
+ end
83
+ end
84
+ end
85
+ end
86
+ end
@@ -0,0 +1,110 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ BetaBashCodeExecutionToolResultBlockParam =
6
+ Beta::BetaBashCodeExecutionToolResultBlockParam
7
+
8
+ module Beta
9
+ class BetaBashCodeExecutionToolResultBlockParam < Anthropic::Internal::Type::BaseModel
10
+ OrHash =
11
+ T.type_alias do
12
+ T.any(
13
+ Anthropic::Beta::BetaBashCodeExecutionToolResultBlockParam,
14
+ Anthropic::Internal::AnyHash
15
+ )
16
+ end
17
+
18
+ sig do
19
+ returns(
20
+ T.any(
21
+ Anthropic::Beta::BetaBashCodeExecutionToolResultErrorParam,
22
+ Anthropic::Beta::BetaBashCodeExecutionResultBlockParam
23
+ )
24
+ )
25
+ end
26
+ attr_accessor :content
27
+
28
+ sig { returns(String) }
29
+ attr_accessor :tool_use_id
30
+
31
+ sig { returns(Symbol) }
32
+ attr_accessor :type
33
+
34
+ # Create a cache control breakpoint at this content block.
35
+ sig { returns(T.nilable(Anthropic::Beta::BetaCacheControlEphemeral)) }
36
+ attr_reader :cache_control
37
+
38
+ sig do
39
+ params(
40
+ cache_control:
41
+ T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash)
42
+ ).void
43
+ end
44
+ attr_writer :cache_control
45
+
46
+ sig do
47
+ params(
48
+ content:
49
+ T.any(
50
+ Anthropic::Beta::BetaBashCodeExecutionToolResultErrorParam::OrHash,
51
+ Anthropic::Beta::BetaBashCodeExecutionResultBlockParam::OrHash
52
+ ),
53
+ tool_use_id: String,
54
+ cache_control:
55
+ T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash),
56
+ type: Symbol
57
+ ).returns(T.attached_class)
58
+ end
59
+ def self.new(
60
+ content:,
61
+ tool_use_id:,
62
+ # Create a cache control breakpoint at this content block.
63
+ cache_control: nil,
64
+ type: :bash_code_execution_tool_result
65
+ )
66
+ end
67
+
68
+ sig do
69
+ override.returns(
70
+ {
71
+ content:
72
+ T.any(
73
+ Anthropic::Beta::BetaBashCodeExecutionToolResultErrorParam,
74
+ Anthropic::Beta::BetaBashCodeExecutionResultBlockParam
75
+ ),
76
+ tool_use_id: String,
77
+ type: Symbol,
78
+ cache_control:
79
+ T.nilable(Anthropic::Beta::BetaCacheControlEphemeral)
80
+ }
81
+ )
82
+ end
83
+ def to_hash
84
+ end
85
+
86
+ module Content
87
+ extend Anthropic::Internal::Type::Union
88
+
89
+ Variants =
90
+ T.type_alias do
91
+ T.any(
92
+ Anthropic::Beta::BetaBashCodeExecutionToolResultErrorParam,
93
+ Anthropic::Beta::BetaBashCodeExecutionResultBlockParam
94
+ )
95
+ end
96
+
97
+ sig do
98
+ override.returns(
99
+ T::Array[
100
+ Anthropic::Beta::BetaBashCodeExecutionToolResultBlockParam::Content::Variants
101
+ ]
102
+ )
103
+ end
104
+ def self.variants
105
+ end
106
+ end
107
+ end
108
+ end
109
+ end
110
+ end
@@ -0,0 +1,101 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ BetaBashCodeExecutionToolResultError =
6
+ Beta::BetaBashCodeExecutionToolResultError
7
+
8
+ module Beta
9
+ class BetaBashCodeExecutionToolResultError < Anthropic::Internal::Type::BaseModel
10
+ OrHash =
11
+ T.type_alias do
12
+ T.any(
13
+ Anthropic::Beta::BetaBashCodeExecutionToolResultError,
14
+ Anthropic::Internal::AnyHash
15
+ )
16
+ end
17
+
18
+ sig do
19
+ returns(
20
+ Anthropic::Beta::BetaBashCodeExecutionToolResultError::ErrorCode::TaggedSymbol
21
+ )
22
+ end
23
+ attr_accessor :error_code
24
+
25
+ sig { returns(Symbol) }
26
+ attr_accessor :type
27
+
28
+ sig do
29
+ params(
30
+ error_code:
31
+ Anthropic::Beta::BetaBashCodeExecutionToolResultError::ErrorCode::OrSymbol,
32
+ type: Symbol
33
+ ).returns(T.attached_class)
34
+ end
35
+ def self.new(error_code:, type: :bash_code_execution_tool_result_error)
36
+ end
37
+
38
+ sig do
39
+ override.returns(
40
+ {
41
+ error_code:
42
+ Anthropic::Beta::BetaBashCodeExecutionToolResultError::ErrorCode::TaggedSymbol,
43
+ type: Symbol
44
+ }
45
+ )
46
+ end
47
+ def to_hash
48
+ end
49
+
50
+ module ErrorCode
51
+ extend Anthropic::Internal::Type::Enum
52
+
53
+ TaggedSymbol =
54
+ T.type_alias do
55
+ T.all(
56
+ Symbol,
57
+ Anthropic::Beta::BetaBashCodeExecutionToolResultError::ErrorCode
58
+ )
59
+ end
60
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
61
+
62
+ INVALID_TOOL_INPUT =
63
+ T.let(
64
+ :invalid_tool_input,
65
+ Anthropic::Beta::BetaBashCodeExecutionToolResultError::ErrorCode::TaggedSymbol
66
+ )
67
+ UNAVAILABLE =
68
+ T.let(
69
+ :unavailable,
70
+ Anthropic::Beta::BetaBashCodeExecutionToolResultError::ErrorCode::TaggedSymbol
71
+ )
72
+ TOO_MANY_REQUESTS =
73
+ T.let(
74
+ :too_many_requests,
75
+ Anthropic::Beta::BetaBashCodeExecutionToolResultError::ErrorCode::TaggedSymbol
76
+ )
77
+ EXECUTION_TIME_EXCEEDED =
78
+ T.let(
79
+ :execution_time_exceeded,
80
+ Anthropic::Beta::BetaBashCodeExecutionToolResultError::ErrorCode::TaggedSymbol
81
+ )
82
+ OUTPUT_FILE_TOO_LARGE =
83
+ T.let(
84
+ :output_file_too_large,
85
+ Anthropic::Beta::BetaBashCodeExecutionToolResultError::ErrorCode::TaggedSymbol
86
+ )
87
+
88
+ sig do
89
+ override.returns(
90
+ T::Array[
91
+ Anthropic::Beta::BetaBashCodeExecutionToolResultError::ErrorCode::TaggedSymbol
92
+ ]
93
+ )
94
+ end
95
+ def self.values
96
+ end
97
+ end
98
+ end
99
+ end
100
+ end
101
+ end
@@ -0,0 +1,101 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ BetaBashCodeExecutionToolResultErrorParam =
6
+ Beta::BetaBashCodeExecutionToolResultErrorParam
7
+
8
+ module Beta
9
+ class BetaBashCodeExecutionToolResultErrorParam < Anthropic::Internal::Type::BaseModel
10
+ OrHash =
11
+ T.type_alias do
12
+ T.any(
13
+ Anthropic::Beta::BetaBashCodeExecutionToolResultErrorParam,
14
+ Anthropic::Internal::AnyHash
15
+ )
16
+ end
17
+
18
+ sig do
19
+ returns(
20
+ Anthropic::Beta::BetaBashCodeExecutionToolResultErrorParam::ErrorCode::OrSymbol
21
+ )
22
+ end
23
+ attr_accessor :error_code
24
+
25
+ sig { returns(Symbol) }
26
+ attr_accessor :type
27
+
28
+ sig do
29
+ params(
30
+ error_code:
31
+ Anthropic::Beta::BetaBashCodeExecutionToolResultErrorParam::ErrorCode::OrSymbol,
32
+ type: Symbol
33
+ ).returns(T.attached_class)
34
+ end
35
+ def self.new(error_code:, type: :bash_code_execution_tool_result_error)
36
+ end
37
+
38
+ sig do
39
+ override.returns(
40
+ {
41
+ error_code:
42
+ Anthropic::Beta::BetaBashCodeExecutionToolResultErrorParam::ErrorCode::OrSymbol,
43
+ type: Symbol
44
+ }
45
+ )
46
+ end
47
+ def to_hash
48
+ end
49
+
50
+ module ErrorCode
51
+ extend Anthropic::Internal::Type::Enum
52
+
53
+ TaggedSymbol =
54
+ T.type_alias do
55
+ T.all(
56
+ Symbol,
57
+ Anthropic::Beta::BetaBashCodeExecutionToolResultErrorParam::ErrorCode
58
+ )
59
+ end
60
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
61
+
62
+ INVALID_TOOL_INPUT =
63
+ T.let(
64
+ :invalid_tool_input,
65
+ Anthropic::Beta::BetaBashCodeExecutionToolResultErrorParam::ErrorCode::TaggedSymbol
66
+ )
67
+ UNAVAILABLE =
68
+ T.let(
69
+ :unavailable,
70
+ Anthropic::Beta::BetaBashCodeExecutionToolResultErrorParam::ErrorCode::TaggedSymbol
71
+ )
72
+ TOO_MANY_REQUESTS =
73
+ T.let(
74
+ :too_many_requests,
75
+ Anthropic::Beta::BetaBashCodeExecutionToolResultErrorParam::ErrorCode::TaggedSymbol
76
+ )
77
+ EXECUTION_TIME_EXCEEDED =
78
+ T.let(
79
+ :execution_time_exceeded,
80
+ Anthropic::Beta::BetaBashCodeExecutionToolResultErrorParam::ErrorCode::TaggedSymbol
81
+ )
82
+ OUTPUT_FILE_TOO_LARGE =
83
+ T.let(
84
+ :output_file_too_large,
85
+ Anthropic::Beta::BetaBashCodeExecutionToolResultErrorParam::ErrorCode::TaggedSymbol
86
+ )
87
+
88
+ sig do
89
+ override.returns(
90
+ T::Array[
91
+ Anthropic::Beta::BetaBashCodeExecutionToolResultErrorParam::ErrorCode::TaggedSymbol
92
+ ]
93
+ )
94
+ end
95
+ def self.values
96
+ end
97
+ end
98
+ end
99
+ end
100
+ end
101
+ end
@@ -0,0 +1,30 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ BetaCitationConfig = Beta::BetaCitationConfig
6
+
7
+ module Beta
8
+ class BetaCitationConfig < Anthropic::Internal::Type::BaseModel
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(
12
+ Anthropic::Beta::BetaCitationConfig,
13
+ Anthropic::Internal::AnyHash
14
+ )
15
+ end
16
+
17
+ sig { returns(T::Boolean) }
18
+ attr_accessor :enabled
19
+
20
+ sig { params(enabled: T::Boolean).returns(T.attached_class) }
21
+ def self.new(enabled:)
22
+ end
23
+
24
+ sig { override.returns({ enabled: T::Boolean }) }
25
+ def to_hash
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end