anthropic 1.7.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 (134) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +20 -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/error_response.rb +7 -1
  53. data/lib/anthropic/models/message_count_tokens_params.rb +1 -24
  54. data/lib/anthropic/models/message_create_params.rb +1 -24
  55. data/lib/anthropic/models/messages/batch_create_params.rb +2 -28
  56. data/lib/anthropic/models/tool_use_block.rb +8 -0
  57. data/lib/anthropic/resources/beta/messages.rb +3 -3
  58. data/lib/anthropic/resources/messages.rb +85 -1
  59. data/lib/anthropic/version.rb +1 -1
  60. data/lib/anthropic.rb +29 -0
  61. data/rbi/anthropic/errors.rbi +2 -2
  62. data/rbi/anthropic/helpers/input_schema/array_of.rbi +16 -0
  63. data/rbi/anthropic/helpers/input_schema/base_model.rbi +21 -0
  64. data/rbi/anthropic/helpers/input_schema/boolean.rbi +11 -0
  65. data/rbi/anthropic/helpers/input_schema/enum_of.rbi +30 -0
  66. data/rbi/anthropic/helpers/input_schema/json_schema_converter.rbi +89 -0
  67. data/rbi/anthropic/helpers/input_schema/union_of.rbi +23 -0
  68. data/rbi/anthropic/helpers/structured_output.rbi +16 -0
  69. data/rbi/anthropic/input_schema.rbi +12 -0
  70. data/rbi/anthropic/models/beta/beta_bash_code_execution_output_block.rbi +33 -0
  71. data/rbi/anthropic/models/beta/beta_bash_code_execution_output_block_param.rbi +34 -0
  72. data/rbi/anthropic/models/beta/beta_bash_code_execution_result_block.rbi +72 -0
  73. data/rbi/anthropic/models/beta/beta_bash_code_execution_result_block_param.rbi +77 -0
  74. data/rbi/anthropic/models/beta/beta_bash_code_execution_tool_result_block.rbi +86 -0
  75. data/rbi/anthropic/models/beta/beta_bash_code_execution_tool_result_block_param.rbi +110 -0
  76. data/rbi/anthropic/models/beta/beta_bash_code_execution_tool_result_error.rbi +101 -0
  77. data/rbi/anthropic/models/beta/beta_bash_code_execution_tool_result_error_param.rbi +101 -0
  78. data/rbi/anthropic/models/beta/beta_code_execution_tool_20250825.rbi +72 -0
  79. data/rbi/anthropic/models/beta/beta_content_block.rbi +2 -0
  80. data/rbi/anthropic/models/beta/beta_content_block_param.rbi +2 -0
  81. data/rbi/anthropic/models/beta/beta_message.rbi +2 -0
  82. data/rbi/anthropic/models/beta/beta_raw_content_block_start_event.rbi +4 -0
  83. data/rbi/anthropic/models/beta/beta_server_tool_use_block.rbi +10 -0
  84. data/rbi/anthropic/models/beta/beta_server_tool_use_block_param.rbi +10 -0
  85. data/rbi/anthropic/models/beta/beta_text_editor_code_execution_create_result_block.rbi +41 -0
  86. data/rbi/anthropic/models/beta/beta_text_editor_code_execution_create_result_block_param.rbi +41 -0
  87. data/rbi/anthropic/models/beta/beta_text_editor_code_execution_str_replace_result_block.rbi +73 -0
  88. data/rbi/anthropic/models/beta/beta_text_editor_code_execution_str_replace_result_block_param.rbi +73 -0
  89. data/rbi/anthropic/models/beta/beta_text_editor_code_execution_tool_result_block.rbi +90 -0
  90. data/rbi/anthropic/models/beta/beta_text_editor_code_execution_tool_result_block_param.rbi +118 -0
  91. data/rbi/anthropic/models/beta/beta_text_editor_code_execution_tool_result_error.rbi +110 -0
  92. data/rbi/anthropic/models/beta/beta_text_editor_code_execution_tool_result_error_param.rbi +110 -0
  93. data/rbi/anthropic/models/beta/beta_text_editor_code_execution_view_result_block.rbi +118 -0
  94. data/rbi/anthropic/models/beta/beta_text_editor_code_execution_view_result_block_param.rbi +118 -0
  95. data/rbi/anthropic/models/beta/beta_tool_union.rbi +1 -0
  96. data/rbi/anthropic/models/beta/message_count_tokens_params.rbi +7 -48
  97. data/rbi/anthropic/models/beta/message_create_params.rbi +6 -48
  98. data/rbi/anthropic/models/beta/messages/batch_create_params.rbi +6 -48
  99. data/rbi/anthropic/models/beta_error_response.rbi +10 -2
  100. data/rbi/anthropic/models/error_response.rbi +10 -2
  101. data/rbi/anthropic/models/message_count_tokens_params.rbi +2 -48
  102. data/rbi/anthropic/models/message_create_params.rbi +2 -48
  103. data/rbi/anthropic/models/messages/batch_create_params.rbi +2 -48
  104. data/rbi/anthropic/resources/beta/messages.rbi +6 -72
  105. data/rbi/anthropic/resources/messages.rbi +3 -72
  106. data/sig/anthropic/models/beta/beta_bash_code_execution_output_block.rbs +23 -0
  107. data/sig/anthropic/models/beta/beta_bash_code_execution_output_block_param.rbs +23 -0
  108. data/sig/anthropic/models/beta/beta_bash_code_execution_result_block.rbs +44 -0
  109. data/sig/anthropic/models/beta/beta_bash_code_execution_result_block_param.rbs +44 -0
  110. data/sig/anthropic/models/beta/beta_bash_code_execution_tool_result_block.rbs +44 -0
  111. data/sig/anthropic/models/beta/beta_bash_code_execution_tool_result_block_param.rbs +49 -0
  112. data/sig/anthropic/models/beta/beta_bash_code_execution_tool_result_error.rbs +48 -0
  113. data/sig/anthropic/models/beta/beta_bash_code_execution_tool_result_error_param.rbs +48 -0
  114. data/sig/anthropic/models/beta/beta_code_execution_tool_20250825.rbs +34 -0
  115. data/sig/anthropic/models/beta/beta_content_block.rbs +2 -0
  116. data/sig/anthropic/models/beta/beta_content_block_param.rbs +2 -0
  117. data/sig/anthropic/models/beta/beta_raw_content_block_start_event.rbs +2 -0
  118. data/sig/anthropic/models/beta/beta_server_tool_use_block.rbs +7 -1
  119. data/sig/anthropic/models/beta/beta_server_tool_use_block_param.rbs +7 -1
  120. data/sig/anthropic/models/beta/beta_text_editor_code_execution_create_result_block.rbs +29 -0
  121. data/sig/anthropic/models/beta/beta_text_editor_code_execution_create_result_block_param.rbs +29 -0
  122. data/sig/anthropic/models/beta/beta_text_editor_code_execution_str_replace_result_block.rbs +49 -0
  123. data/sig/anthropic/models/beta/beta_text_editor_code_execution_str_replace_result_block_param.rbs +49 -0
  124. data/sig/anthropic/models/beta/beta_text_editor_code_execution_tool_result_block.rbs +46 -0
  125. data/sig/anthropic/models/beta/beta_text_editor_code_execution_tool_result_block_param.rbs +51 -0
  126. data/sig/anthropic/models/beta/beta_text_editor_code_execution_tool_result_error.rbs +53 -0
  127. data/sig/anthropic/models/beta/beta_text_editor_code_execution_tool_result_error_param.rbs +53 -0
  128. data/sig/anthropic/models/beta/beta_text_editor_code_execution_view_result_block.rbs +61 -0
  129. data/sig/anthropic/models/beta/beta_text_editor_code_execution_view_result_block_param.rbs +61 -0
  130. data/sig/anthropic/models/beta/beta_tool_union.rbs +1 -0
  131. data/sig/anthropic/models/beta/message_count_tokens_params.rbs +1 -0
  132. data/sig/anthropic/models/beta_error_response.rbs +13 -2
  133. data/sig/anthropic/models/error_response.rbs +13 -2
  134. metadata +77 -2
@@ -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
@@ -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
@@ -0,0 +1,118 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ BetaTextEditorCodeExecutionToolResultBlockParam =
6
+ Beta::BetaTextEditorCodeExecutionToolResultBlockParam
7
+
8
+ module Beta
9
+ class BetaTextEditorCodeExecutionToolResultBlockParam < Anthropic::Internal::Type::BaseModel
10
+ OrHash =
11
+ T.type_alias do
12
+ T.any(
13
+ Anthropic::Beta::BetaTextEditorCodeExecutionToolResultBlockParam,
14
+ Anthropic::Internal::AnyHash
15
+ )
16
+ end
17
+
18
+ sig do
19
+ returns(
20
+ T.any(
21
+ Anthropic::Beta::BetaTextEditorCodeExecutionToolResultErrorParam,
22
+ Anthropic::Beta::BetaTextEditorCodeExecutionViewResultBlockParam,
23
+ Anthropic::Beta::BetaTextEditorCodeExecutionCreateResultBlockParam,
24
+ Anthropic::Beta::BetaTextEditorCodeExecutionStrReplaceResultBlockParam
25
+ )
26
+ )
27
+ end
28
+ attr_accessor :content
29
+
30
+ sig { returns(String) }
31
+ attr_accessor :tool_use_id
32
+
33
+ sig { returns(Symbol) }
34
+ attr_accessor :type
35
+
36
+ # Create a cache control breakpoint at this content block.
37
+ sig { returns(T.nilable(Anthropic::Beta::BetaCacheControlEphemeral)) }
38
+ attr_reader :cache_control
39
+
40
+ sig do
41
+ params(
42
+ cache_control:
43
+ T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash)
44
+ ).void
45
+ end
46
+ attr_writer :cache_control
47
+
48
+ sig do
49
+ params(
50
+ content:
51
+ T.any(
52
+ Anthropic::Beta::BetaTextEditorCodeExecutionToolResultErrorParam::OrHash,
53
+ Anthropic::Beta::BetaTextEditorCodeExecutionViewResultBlockParam::OrHash,
54
+ Anthropic::Beta::BetaTextEditorCodeExecutionCreateResultBlockParam::OrHash,
55
+ Anthropic::Beta::BetaTextEditorCodeExecutionStrReplaceResultBlockParam::OrHash
56
+ ),
57
+ tool_use_id: String,
58
+ cache_control:
59
+ T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash),
60
+ type: Symbol
61
+ ).returns(T.attached_class)
62
+ end
63
+ def self.new(
64
+ content:,
65
+ tool_use_id:,
66
+ # Create a cache control breakpoint at this content block.
67
+ cache_control: nil,
68
+ type: :text_editor_code_execution_tool_result
69
+ )
70
+ end
71
+
72
+ sig do
73
+ override.returns(
74
+ {
75
+ content:
76
+ T.any(
77
+ Anthropic::Beta::BetaTextEditorCodeExecutionToolResultErrorParam,
78
+ Anthropic::Beta::BetaTextEditorCodeExecutionViewResultBlockParam,
79
+ Anthropic::Beta::BetaTextEditorCodeExecutionCreateResultBlockParam,
80
+ Anthropic::Beta::BetaTextEditorCodeExecutionStrReplaceResultBlockParam
81
+ ),
82
+ tool_use_id: String,
83
+ type: Symbol,
84
+ cache_control:
85
+ T.nilable(Anthropic::Beta::BetaCacheControlEphemeral)
86
+ }
87
+ )
88
+ end
89
+ def to_hash
90
+ end
91
+
92
+ module Content
93
+ extend Anthropic::Internal::Type::Union
94
+
95
+ Variants =
96
+ T.type_alias do
97
+ T.any(
98
+ Anthropic::Beta::BetaTextEditorCodeExecutionToolResultErrorParam,
99
+ Anthropic::Beta::BetaTextEditorCodeExecutionViewResultBlockParam,
100
+ Anthropic::Beta::BetaTextEditorCodeExecutionCreateResultBlockParam,
101
+ Anthropic::Beta::BetaTextEditorCodeExecutionStrReplaceResultBlockParam
102
+ )
103
+ end
104
+
105
+ sig do
106
+ override.returns(
107
+ T::Array[
108
+ Anthropic::Beta::BetaTextEditorCodeExecutionToolResultBlockParam::Content::Variants
109
+ ]
110
+ )
111
+ end
112
+ def self.variants
113
+ end
114
+ end
115
+ end
116
+ end
117
+ end
118
+ end