anthropic 1.6.0 → 1.8.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 (147) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +33 -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 +1 -1
  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_code_execution_tool_20250825.rb +40 -0
  29. data/lib/anthropic/models/beta/beta_content_block.rb +6 -1
  30. data/lib/anthropic/models/beta/beta_content_block_param.rb +7 -1
  31. data/lib/anthropic/models/beta/beta_message.rb +2 -2
  32. data/lib/anthropic/models/beta/beta_message_param.rb +3 -3
  33. data/lib/anthropic/models/beta/beta_raw_content_block_start_event.rb +8 -3
  34. data/lib/anthropic/models/beta/beta_server_tool_use_block.rb +2 -0
  35. data/lib/anthropic/models/beta/beta_server_tool_use_block_param.rb +2 -0
  36. data/lib/anthropic/models/beta/beta_text_editor_code_execution_create_result_block.rb +25 -0
  37. data/lib/anthropic/models/beta/beta_text_editor_code_execution_create_result_block_param.rb +26 -0
  38. data/lib/anthropic/models/beta/beta_text_editor_code_execution_str_replace_result_block.rb +49 -0
  39. data/lib/anthropic/models/beta/beta_text_editor_code_execution_str_replace_result_block_param.rb +50 -0
  40. data/lib/anthropic/models/beta/beta_text_editor_code_execution_tool_result_block.rb +47 -0
  41. data/lib/anthropic/models/beta/beta_text_editor_code_execution_tool_result_block_param.rb +57 -0
  42. data/lib/anthropic/models/beta/beta_text_editor_code_execution_tool_result_error.rb +45 -0
  43. data/lib/anthropic/models/beta/beta_text_editor_code_execution_tool_result_error_param.rb +46 -0
  44. data/lib/anthropic/models/beta/beta_text_editor_code_execution_view_result_block.rb +61 -0
  45. data/lib/anthropic/models/beta/beta_text_editor_code_execution_view_result_block_param.rb +62 -0
  46. data/lib/anthropic/models/beta/beta_tool_union.rb +3 -1
  47. data/lib/anthropic/models/beta/message_count_tokens_params.rb +7 -30
  48. data/lib/anthropic/models/beta/message_create_params.rb +3 -26
  49. data/lib/anthropic/models/beta/messages/batch_create_params.rb +6 -36
  50. data/lib/anthropic/models/beta/messages/beta_message_batch.rb +1 -4
  51. data/lib/anthropic/models/beta_error_response.rb +7 -1
  52. data/lib/anthropic/models/cache_control_ephemeral.rb +39 -1
  53. data/lib/anthropic/models/cache_creation.rb +24 -0
  54. data/lib/anthropic/models/error_response.rb +7 -1
  55. data/lib/anthropic/models/message_count_tokens_params.rb +1 -24
  56. data/lib/anthropic/models/message_create_params.rb +1 -24
  57. data/lib/anthropic/models/messages/batch_create_params.rb +2 -28
  58. data/lib/anthropic/models/model.rb +6 -0
  59. data/lib/anthropic/models/tool_use_block.rb +8 -0
  60. data/lib/anthropic/models/usage.rb +9 -1
  61. data/lib/anthropic/models.rb +2 -0
  62. data/lib/anthropic/resources/beta/messages.rb +3 -3
  63. data/lib/anthropic/resources/messages.rb +85 -1
  64. data/lib/anthropic/version.rb +1 -1
  65. data/lib/anthropic.rb +30 -0
  66. data/rbi/anthropic/errors.rbi +2 -2
  67. data/rbi/anthropic/helpers/input_schema/array_of.rbi +16 -0
  68. data/rbi/anthropic/helpers/input_schema/base_model.rbi +21 -0
  69. data/rbi/anthropic/helpers/input_schema/boolean.rbi +11 -0
  70. data/rbi/anthropic/helpers/input_schema/enum_of.rbi +30 -0
  71. data/rbi/anthropic/helpers/input_schema/json_schema_converter.rbi +89 -0
  72. data/rbi/anthropic/helpers/input_schema/union_of.rbi +23 -0
  73. data/rbi/anthropic/helpers/structured_output.rbi +16 -0
  74. data/rbi/anthropic/input_schema.rbi +12 -0
  75. data/rbi/anthropic/models/beta/beta_bash_code_execution_output_block.rbi +33 -0
  76. data/rbi/anthropic/models/beta/beta_bash_code_execution_output_block_param.rbi +34 -0
  77. data/rbi/anthropic/models/beta/beta_bash_code_execution_result_block.rbi +72 -0
  78. data/rbi/anthropic/models/beta/beta_bash_code_execution_result_block_param.rbi +77 -0
  79. data/rbi/anthropic/models/beta/beta_bash_code_execution_tool_result_block.rbi +86 -0
  80. data/rbi/anthropic/models/beta/beta_bash_code_execution_tool_result_block_param.rbi +110 -0
  81. data/rbi/anthropic/models/beta/beta_bash_code_execution_tool_result_error.rbi +101 -0
  82. data/rbi/anthropic/models/beta/beta_bash_code_execution_tool_result_error_param.rbi +101 -0
  83. data/rbi/anthropic/models/beta/beta_code_execution_tool_20250825.rbi +72 -0
  84. data/rbi/anthropic/models/beta/beta_content_block.rbi +2 -0
  85. data/rbi/anthropic/models/beta/beta_content_block_param.rbi +2 -0
  86. data/rbi/anthropic/models/beta/beta_message.rbi +2 -0
  87. data/rbi/anthropic/models/beta/beta_raw_content_block_start_event.rbi +4 -0
  88. data/rbi/anthropic/models/beta/beta_server_tool_use_block.rbi +10 -0
  89. data/rbi/anthropic/models/beta/beta_server_tool_use_block_param.rbi +10 -0
  90. data/rbi/anthropic/models/beta/beta_text_editor_code_execution_create_result_block.rbi +41 -0
  91. data/rbi/anthropic/models/beta/beta_text_editor_code_execution_create_result_block_param.rbi +41 -0
  92. data/rbi/anthropic/models/beta/beta_text_editor_code_execution_str_replace_result_block.rbi +73 -0
  93. data/rbi/anthropic/models/beta/beta_text_editor_code_execution_str_replace_result_block_param.rbi +73 -0
  94. data/rbi/anthropic/models/beta/beta_text_editor_code_execution_tool_result_block.rbi +90 -0
  95. data/rbi/anthropic/models/beta/beta_text_editor_code_execution_tool_result_block_param.rbi +118 -0
  96. data/rbi/anthropic/models/beta/beta_text_editor_code_execution_tool_result_error.rbi +110 -0
  97. data/rbi/anthropic/models/beta/beta_text_editor_code_execution_tool_result_error_param.rbi +110 -0
  98. data/rbi/anthropic/models/beta/beta_text_editor_code_execution_view_result_block.rbi +118 -0
  99. data/rbi/anthropic/models/beta/beta_text_editor_code_execution_view_result_block_param.rbi +118 -0
  100. data/rbi/anthropic/models/beta/beta_tool_union.rbi +1 -0
  101. data/rbi/anthropic/models/beta/message_count_tokens_params.rbi +7 -48
  102. data/rbi/anthropic/models/beta/message_create_params.rbi +6 -48
  103. data/rbi/anthropic/models/beta/messages/batch_create_params.rbi +6 -48
  104. data/rbi/anthropic/models/beta_error_response.rbi +10 -2
  105. data/rbi/anthropic/models/cache_control_ephemeral.rbi +68 -3
  106. data/rbi/anthropic/models/cache_creation.rbi +45 -0
  107. data/rbi/anthropic/models/error_response.rbi +10 -2
  108. data/rbi/anthropic/models/message_count_tokens_params.rbi +2 -48
  109. data/rbi/anthropic/models/message_create_params.rbi +2 -48
  110. data/rbi/anthropic/models/messages/batch_create_params.rbi +2 -48
  111. data/rbi/anthropic/models/usage.rbi +13 -0
  112. data/rbi/anthropic/models.rbi +2 -0
  113. data/rbi/anthropic/resources/beta/messages.rbi +6 -72
  114. data/rbi/anthropic/resources/messages.rbi +3 -72
  115. data/sig/anthropic/models/beta/beta_bash_code_execution_output_block.rbs +23 -0
  116. data/sig/anthropic/models/beta/beta_bash_code_execution_output_block_param.rbs +23 -0
  117. data/sig/anthropic/models/beta/beta_bash_code_execution_result_block.rbs +44 -0
  118. data/sig/anthropic/models/beta/beta_bash_code_execution_result_block_param.rbs +44 -0
  119. data/sig/anthropic/models/beta/beta_bash_code_execution_tool_result_block.rbs +44 -0
  120. data/sig/anthropic/models/beta/beta_bash_code_execution_tool_result_block_param.rbs +49 -0
  121. data/sig/anthropic/models/beta/beta_bash_code_execution_tool_result_error.rbs +48 -0
  122. data/sig/anthropic/models/beta/beta_bash_code_execution_tool_result_error_param.rbs +48 -0
  123. data/sig/anthropic/models/beta/beta_code_execution_tool_20250825.rbs +34 -0
  124. data/sig/anthropic/models/beta/beta_content_block.rbs +2 -0
  125. data/sig/anthropic/models/beta/beta_content_block_param.rbs +2 -0
  126. data/sig/anthropic/models/beta/beta_raw_content_block_start_event.rbs +2 -0
  127. data/sig/anthropic/models/beta/beta_server_tool_use_block.rbs +7 -1
  128. data/sig/anthropic/models/beta/beta_server_tool_use_block_param.rbs +7 -1
  129. data/sig/anthropic/models/beta/beta_text_editor_code_execution_create_result_block.rbs +29 -0
  130. data/sig/anthropic/models/beta/beta_text_editor_code_execution_create_result_block_param.rbs +29 -0
  131. data/sig/anthropic/models/beta/beta_text_editor_code_execution_str_replace_result_block.rbs +49 -0
  132. data/sig/anthropic/models/beta/beta_text_editor_code_execution_str_replace_result_block_param.rbs +49 -0
  133. data/sig/anthropic/models/beta/beta_text_editor_code_execution_tool_result_block.rbs +46 -0
  134. data/sig/anthropic/models/beta/beta_text_editor_code_execution_tool_result_block_param.rbs +51 -0
  135. data/sig/anthropic/models/beta/beta_text_editor_code_execution_tool_result_error.rbs +53 -0
  136. data/sig/anthropic/models/beta/beta_text_editor_code_execution_tool_result_error_param.rbs +53 -0
  137. data/sig/anthropic/models/beta/beta_text_editor_code_execution_view_result_block.rbs +61 -0
  138. data/sig/anthropic/models/beta/beta_text_editor_code_execution_view_result_block_param.rbs +61 -0
  139. data/sig/anthropic/models/beta/beta_tool_union.rbs +1 -0
  140. data/sig/anthropic/models/beta/message_count_tokens_params.rbs +1 -0
  141. data/sig/anthropic/models/beta_error_response.rbs +13 -2
  142. data/sig/anthropic/models/cache_control_ephemeral.rbs +27 -3
  143. data/sig/anthropic/models/cache_creation.rbs +25 -0
  144. data/sig/anthropic/models/error_response.rbs +13 -2
  145. data/sig/anthropic/models/usage.rbs +5 -0
  146. data/sig/anthropic/models.rbs +2 -0
  147. metadata +80 -2
@@ -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,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
@@ -19,6 +19,8 @@ module Anthropic
19
19
  Anthropic::Beta::BetaServerToolUseBlock,
20
20
  Anthropic::Beta::BetaWebSearchToolResultBlock,
21
21
  Anthropic::Beta::BetaCodeExecutionToolResultBlock,
22
+ Anthropic::Beta::BetaBashCodeExecutionToolResultBlock,
23
+ Anthropic::Beta::BetaTextEditorCodeExecutionToolResultBlock,
22
24
  Anthropic::Beta::BetaMCPToolUseBlock,
23
25
  Anthropic::Beta::BetaMCPToolResultBlock,
24
26
  Anthropic::Beta::BetaContainerUploadBlock
@@ -23,6 +23,8 @@ module Anthropic
23
23
  Anthropic::Beta::BetaServerToolUseBlockParam,
24
24
  Anthropic::Beta::BetaWebSearchToolResultBlockParam,
25
25
  Anthropic::Beta::BetaCodeExecutionToolResultBlockParam,
26
+ Anthropic::Beta::BetaBashCodeExecutionToolResultBlockParam,
27
+ Anthropic::Beta::BetaTextEditorCodeExecutionToolResultBlockParam,
26
28
  Anthropic::Beta::BetaMCPToolUseBlockParam,
27
29
  Anthropic::Beta::BetaRequestMCPToolResultBlockParam,
28
30
  Anthropic::Beta::BetaContainerUploadBlockParam
@@ -144,6 +144,8 @@ module Anthropic
144
144
  Anthropic::Beta::BetaServerToolUseBlock::OrHash,
145
145
  Anthropic::Beta::BetaWebSearchToolResultBlock::OrHash,
146
146
  Anthropic::Beta::BetaCodeExecutionToolResultBlock::OrHash,
147
+ Anthropic::Beta::BetaBashCodeExecutionToolResultBlock::OrHash,
148
+ Anthropic::Beta::BetaTextEditorCodeExecutionToolResultBlock::OrHash,
147
149
  Anthropic::Beta::BetaMCPToolUseBlock::OrHash,
148
150
  Anthropic::Beta::BetaMCPToolResultBlock::OrHash,
149
151
  Anthropic::Beta::BetaContainerUploadBlock::OrHash
@@ -39,6 +39,8 @@ module Anthropic
39
39
  Anthropic::Beta::BetaServerToolUseBlock::OrHash,
40
40
  Anthropic::Beta::BetaWebSearchToolResultBlock::OrHash,
41
41
  Anthropic::Beta::BetaCodeExecutionToolResultBlock::OrHash,
42
+ Anthropic::Beta::BetaBashCodeExecutionToolResultBlock::OrHash,
43
+ Anthropic::Beta::BetaTextEditorCodeExecutionToolResultBlock::OrHash,
42
44
  Anthropic::Beta::BetaMCPToolUseBlock::OrHash,
43
45
  Anthropic::Beta::BetaMCPToolResultBlock::OrHash,
44
46
  Anthropic::Beta::BetaContainerUploadBlock::OrHash
@@ -82,6 +84,8 @@ module Anthropic
82
84
  Anthropic::Beta::BetaServerToolUseBlock,
83
85
  Anthropic::Beta::BetaWebSearchToolResultBlock,
84
86
  Anthropic::Beta::BetaCodeExecutionToolResultBlock,
87
+ Anthropic::Beta::BetaBashCodeExecutionToolResultBlock,
88
+ Anthropic::Beta::BetaTextEditorCodeExecutionToolResultBlock,
85
89
  Anthropic::Beta::BetaMCPToolUseBlock,
86
90
  Anthropic::Beta::BetaMCPToolResultBlock,
87
91
  Anthropic::Beta::BetaContainerUploadBlock
@@ -71,6 +71,16 @@ module Anthropic
71
71
  :code_execution,
72
72
  Anthropic::Beta::BetaServerToolUseBlock::Name::TaggedSymbol
73
73
  )
74
+ BASH_CODE_EXECUTION =
75
+ T.let(
76
+ :bash_code_execution,
77
+ Anthropic::Beta::BetaServerToolUseBlock::Name::TaggedSymbol
78
+ )
79
+ TEXT_EDITOR_CODE_EXECUTION =
80
+ T.let(
81
+ :text_editor_code_execution,
82
+ Anthropic::Beta::BetaServerToolUseBlock::Name::TaggedSymbol
83
+ )
74
84
 
75
85
  sig do
76
86
  override.returns(
@@ -95,6 +95,16 @@ module Anthropic
95
95
  :code_execution,
96
96
  Anthropic::Beta::BetaServerToolUseBlockParam::Name::TaggedSymbol
97
97
  )
98
+ BASH_CODE_EXECUTION =
99
+ T.let(
100
+ :bash_code_execution,
101
+ Anthropic::Beta::BetaServerToolUseBlockParam::Name::TaggedSymbol
102
+ )
103
+ TEXT_EDITOR_CODE_EXECUTION =
104
+ T.let(
105
+ :text_editor_code_execution,
106
+ Anthropic::Beta::BetaServerToolUseBlockParam::Name::TaggedSymbol
107
+ )
98
108
 
99
109
  sig do
100
110
  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