anthropic 1.12.0 → 1.13.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 (60) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +21 -0
  3. data/README.md +1 -1
  4. data/lib/anthropic/helpers/streaming/message_stream.rb +3 -0
  5. data/lib/anthropic/internal/transport/pooled_net_requester.rb +30 -24
  6. data/lib/anthropic/models/beta/beta_all_thinking_turns.rb +19 -0
  7. data/lib/anthropic/models/beta/beta_clear_thinking_20251015_edit.rb +48 -0
  8. data/lib/anthropic/models/beta/beta_clear_thinking_20251015_edit_response.rb +36 -0
  9. data/lib/anthropic/models/beta/beta_context_management_config.rb +17 -3
  10. data/lib/anthropic/models/beta/beta_context_management_response.rb +16 -3
  11. data/lib/anthropic/models/beta/beta_mcp_tool_use_block_param.rb +3 -3
  12. data/lib/anthropic/models/beta/beta_server_tool_use_block_param.rb +3 -3
  13. data/lib/anthropic/models/beta/beta_thinking_turns.rb +25 -0
  14. data/lib/anthropic/models/beta/beta_tool.rb +5 -3
  15. data/lib/anthropic/models/beta/beta_tool_use_block_param.rb +3 -3
  16. data/lib/anthropic/models/model.rb +6 -20
  17. data/lib/anthropic/models/server_tool_use_block_param.rb +3 -3
  18. data/lib/anthropic/models/tool.rb +5 -3
  19. data/lib/anthropic/models/tool_use_block_param.rb +3 -3
  20. data/lib/anthropic/version.rb +1 -1
  21. data/lib/anthropic.rb +4 -0
  22. data/rbi/anthropic/models/beta/beta_all_thinking_turns.rbi +30 -0
  23. data/rbi/anthropic/models/beta/beta_clear_thinking_20251015_edit.rbi +109 -0
  24. data/rbi/anthropic/models/beta/beta_clear_thinking_20251015_edit_response.rbi +61 -0
  25. data/rbi/anthropic/models/beta/beta_context_management_config.rbi +51 -4
  26. data/rbi/anthropic/models/beta/beta_context_management_response.rbi +32 -3
  27. data/rbi/anthropic/models/beta/beta_mcp_tool_use_block.rbi +3 -3
  28. data/rbi/anthropic/models/beta/beta_mcp_tool_use_block_param.rbi +3 -3
  29. data/rbi/anthropic/models/beta/beta_server_tool_use_block.rbi +3 -3
  30. data/rbi/anthropic/models/beta/beta_server_tool_use_block_param.rbi +3 -3
  31. data/rbi/anthropic/models/beta/beta_thinking_turns.rbi +33 -0
  32. data/rbi/anthropic/models/beta/beta_tool.rbi +3 -3
  33. data/rbi/anthropic/models/beta/beta_tool_use_block.rbi +8 -3
  34. data/rbi/anthropic/models/beta/beta_tool_use_block_param.rbi +3 -3
  35. data/rbi/anthropic/models/model.rbi +0 -11
  36. data/rbi/anthropic/models/server_tool_use_block.rbi +8 -3
  37. data/rbi/anthropic/models/server_tool_use_block_param.rbi +3 -3
  38. data/rbi/anthropic/models/tool.rbi +3 -3
  39. data/rbi/anthropic/models/tool_use_block.rbi +8 -3
  40. data/rbi/anthropic/models/tool_use_block_param.rbi +3 -3
  41. data/sig/anthropic/models/beta/beta_all_thinking_turns.rbs +17 -0
  42. data/sig/anthropic/models/beta/beta_clear_thinking_20251015_edit.rbs +44 -0
  43. data/sig/anthropic/models/beta/beta_clear_thinking_20251015_edit_response.rbs +34 -0
  44. data/sig/anthropic/models/beta/beta_context_management_config.rbs +18 -6
  45. data/sig/anthropic/models/beta/beta_context_management_response.rbs +14 -4
  46. data/sig/anthropic/models/beta/beta_mcp_tool_use_block.rbs +4 -4
  47. data/sig/anthropic/models/beta/beta_mcp_tool_use_block_param.rbs +4 -4
  48. data/sig/anthropic/models/beta/beta_server_tool_use_block.rbs +4 -4
  49. data/sig/anthropic/models/beta/beta_server_tool_use_block_param.rbs +4 -4
  50. data/sig/anthropic/models/beta/beta_thinking_turns.rbs +19 -0
  51. data/sig/anthropic/models/beta/beta_tool.rbs +8 -4
  52. data/sig/anthropic/models/beta/beta_tool_use_block.rbs +9 -4
  53. data/sig/anthropic/models/beta/beta_tool_use_block_param.rbs +4 -4
  54. data/sig/anthropic/models/model.rbs +0 -11
  55. data/sig/anthropic/models/server_tool_use_block.rbs +9 -4
  56. data/sig/anthropic/models/server_tool_use_block_param.rbs +4 -4
  57. data/sig/anthropic/models/tool.rbs +8 -4
  58. data/sig/anthropic/models/tool_use_block.rbs +9 -4
  59. data/sig/anthropic/models/tool_use_block_param.rbs +4 -4
  60. metadata +14 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 072bcc8438ad6e02e9f80e615c1945fc13d97c49ba16d41338bfaf864e667ea0
4
- data.tar.gz: ade33da13ed3771ed37e71159e48b46524099ac289c0015018ac49aae05f3ad2
3
+ metadata.gz: 402cad94c15427670184c0922d15aa743631c9cf0178a2bd7d1a54fd515e138a
4
+ data.tar.gz: 89e7ff9f5a7072a3380a749286be91d0da71eb0067310ab558086496cd9264f3
5
5
  SHA512:
6
- metadata.gz: 9cd69a70298a17a881e76419ad4f19348cd09e3c0eb30564635e1944839e4cc95d6aaae0c4614bea8e171c39c24302b10d3470362159b4364422c343eb91ba77
7
- data.tar.gz: 4fd63f93dd2cbcf68a158c90848b0cc1ed2e55e30ea92e18a48a1c45649095a9dd4cf9686e76573e0592ffa1bf74a00362c0ad2a0146b63b0d31f7943c17815e
6
+ metadata.gz: 9439dd79ab1f200590ea63e60e27f444a51566fb75988b8b6a32cde0d20d404dd7e85b5bd77d94c21ec0ff77684df53f59d610063bb834e222ec1d267490d0f1
7
+ data.tar.gz: 998aca515a29223d30c4bd7f3c240e99c476a354eb40a3b2131feb62404893e3428ecf47d72bb188ff847af5f56125b87ec27bce90b03f69fb2cc8dc5d6d0ac5
data/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.13.0 (2025-10-29)
4
+
5
+ Full Changelog: [v1.12.0...v1.13.0](https://github.com/anthropics/anthropic-sdk-ruby/compare/v1.12.0...v1.13.0)
6
+
7
+ ### Features
8
+
9
+ * add headers and status method to MessageStream ([#727](https://github.com/anthropics/anthropic-sdk-ruby/issues/727)) ([71fe5d0](https://github.com/anthropics/anthropic-sdk-ruby/commit/71fe5d072d3ba174383b7469c94375273d454ed3))
10
+ * **api:** add ability to clear thinking in context management ([c597009](https://github.com/anthropics/anthropic-sdk-ruby/commit/c5970096e8e35cc4cf04db328dd7a0f36f10de2a))
11
+ * handle thread interrupts in the core HTTP client ([ed4243d](https://github.com/anthropics/anthropic-sdk-ruby/commit/ed4243de16f67db3aa1cf2a01e671a481a96074e))
12
+
13
+
14
+ ### Bug Fixes
15
+
16
+ * **client:** remove duplicate model ([3652886](https://github.com/anthropics/anthropic-sdk-ruby/commit/36528863de526228434352fab00d28bdc365ade8))
17
+
18
+
19
+ ### Chores
20
+
21
+ * **api:** mark older sonnet models as deprecated ([071c146](https://github.com/anthropics/anthropic-sdk-ruby/commit/071c14698878c7d4bccac73f91ea48d6ffcf8c55))
22
+ * **internal:** refactor message stream header and status retrieval ([#731](https://github.com/anthropics/anthropic-sdk-ruby/issues/731)) ([f763a1d](https://github.com/anthropics/anthropic-sdk-ruby/commit/f763a1df50369391ec235890d24ef01181f493df))
23
+
3
24
  ## 1.12.0 (2025-10-16)
4
25
 
5
26
  Full Changelog: [v1.11.0...v1.12.0](https://github.com/anthropics/anthropic-sdk-ruby/compare/v1.11.0...v1.12.0)
data/README.md CHANGED
@@ -15,7 +15,7 @@ To use this gem, install via Bundler by adding the following to your application
15
15
  <!-- x-release-please-start-version -->
16
16
 
17
17
  ```ruby
18
- gem "anthropic", "~> 1.12.0"
18
+ gem "anthropic", "~> 1.13.0"
19
19
  ```
20
20
 
21
21
  <!-- x-release-please-end -->
@@ -271,6 +271,9 @@ module Anthropic
271
271
  @tool_models = tool_models
272
272
  # Lazy enumerable that transforms raw events into consumable events.
273
273
  @iterator = iterator
274
+ @status = raw_stream.status
275
+ @headers = raw_stream.headers
276
+ @model = raw_stream.instance_variable_get(:@model)
274
277
  end
275
278
  end
276
279
  end
@@ -128,40 +128,48 @@ module Anthropic
128
128
  url, deadline = request.fetch_values(:url, :deadline)
129
129
 
130
130
  req = nil
131
- eof = false
132
131
  finished = false
133
- closing = nil
134
132
 
135
133
  # rubocop:disable Metrics/BlockLength
136
134
  enum = Enumerator.new do |y|
137
135
  next if finished
138
136
 
139
137
  with_pool(url, deadline: deadline) do |conn|
140
- req, closing = self.class.build_request(request) do
141
- self.class.calibrate_socket_timeout(conn, deadline)
142
- end
143
-
144
- self.class.calibrate_socket_timeout(conn, deadline)
145
- unless conn.started?
146
- conn.keep_alive_timeout = self.class::KEEP_ALIVE_TIMEOUT
147
- conn.start
148
- end
138
+ eof = false
139
+ closing = nil
140
+ ::Thread.handle_interrupt(Object => :never) do
141
+ ::Thread.handle_interrupt(Object => :immediate) do
142
+ req, closing = self.class.build_request(request) do
143
+ self.class.calibrate_socket_timeout(conn, deadline)
144
+ end
149
145
 
150
- self.class.calibrate_socket_timeout(conn, deadline)
151
- conn.request(req) do |rsp|
152
- y << [req, rsp]
153
- break if finished
154
-
155
- rsp.read_body do |bytes|
156
- y << bytes.force_encoding(Encoding::BINARY)
157
- break if finished
146
+ self.class.calibrate_socket_timeout(conn, deadline)
147
+ unless conn.started?
148
+ conn.keep_alive_timeout = self.class::KEEP_ALIVE_TIMEOUT
149
+ conn.start
150
+ end
158
151
 
159
152
  self.class.calibrate_socket_timeout(conn, deadline)
153
+ conn.request(req) do |rsp|
154
+ y << [req, rsp]
155
+ break if finished
156
+
157
+ rsp.read_body do |bytes|
158
+ y << bytes.force_encoding(Encoding::BINARY)
159
+ break if finished
160
+
161
+ self.class.calibrate_socket_timeout(conn, deadline)
162
+ end
163
+ eof = true
164
+ end
165
+ end
166
+ ensure
167
+ begin
168
+ conn.finish if !eof && conn&.started?
169
+ ensure
170
+ closing&.call
160
171
  end
161
- eof = true
162
172
  end
163
- ensure
164
- conn.finish if !eof && conn&.started?
165
173
  end
166
174
  rescue Timeout::Error
167
175
  raise Anthropic::Errors::APITimeoutError.new(url: url, request: req)
@@ -174,8 +182,6 @@ module Anthropic
174
182
  body = Anthropic::Internal::Util.fused_enum(enum, external: true) do
175
183
  finished = true
176
184
  loop { enum.next }
177
- ensure
178
- closing&.call
179
185
  end
180
186
  [Integer(response.code), response, body]
181
187
  end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Anthropic
4
+ module Models
5
+ module Beta
6
+ class BetaAllThinkingTurns < Anthropic::Internal::Type::BaseModel
7
+ # @!attribute type
8
+ #
9
+ # @return [Symbol, :all]
10
+ required :type, const: :all
11
+
12
+ # @!method initialize(type: :all)
13
+ # @param type [Symbol, :all]
14
+ end
15
+ end
16
+
17
+ BetaAllThinkingTurns = Beta::BetaAllThinkingTurns
18
+ end
19
+ end
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Anthropic
4
+ module Models
5
+ module Beta
6
+ class BetaClearThinking20251015Edit < Anthropic::Internal::Type::BaseModel
7
+ # @!attribute type
8
+ #
9
+ # @return [Symbol, :clear_thinking_20251015]
10
+ required :type, const: :clear_thinking_20251015
11
+
12
+ # @!attribute keep
13
+ # Number of most recent assistant turns to keep thinking blocks for. Older turns
14
+ # will have their thinking blocks removed.
15
+ #
16
+ # @return [Anthropic::Models::Beta::BetaThinkingTurns, Anthropic::Models::Beta::BetaAllThinkingTurns, Symbol, :all, nil]
17
+ optional :keep, union: -> { Anthropic::Beta::BetaClearThinking20251015Edit::Keep }
18
+
19
+ # @!method initialize(keep: nil, type: :clear_thinking_20251015)
20
+ # Some parameter documentations has been truncated, see
21
+ # {Anthropic::Models::Beta::BetaClearThinking20251015Edit} for more details.
22
+ #
23
+ # @param keep [Anthropic::Models::Beta::BetaThinkingTurns, Anthropic::Models::Beta::BetaAllThinkingTurns, Symbol, :all] Number of most recent assistant turns to keep thinking blocks for. Older turns w
24
+ #
25
+ # @param type [Symbol, :clear_thinking_20251015]
26
+
27
+ # Number of most recent assistant turns to keep thinking blocks for. Older turns
28
+ # will have their thinking blocks removed.
29
+ #
30
+ # @see Anthropic::Models::Beta::BetaClearThinking20251015Edit#keep
31
+ module Keep
32
+ extend Anthropic::Internal::Type::Union
33
+
34
+ variant -> { Anthropic::Beta::BetaThinkingTurns }
35
+
36
+ variant -> { Anthropic::Beta::BetaAllThinkingTurns }
37
+
38
+ variant const: :all
39
+
40
+ # @!method self.variants
41
+ # @return [Array(Anthropic::Models::Beta::BetaThinkingTurns, Anthropic::Models::Beta::BetaAllThinkingTurns, Symbol, :all)]
42
+ end
43
+ end
44
+ end
45
+
46
+ BetaClearThinking20251015Edit = Beta::BetaClearThinking20251015Edit
47
+ end
48
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Anthropic
4
+ module Models
5
+ module Beta
6
+ class BetaClearThinking20251015EditResponse < Anthropic::Internal::Type::BaseModel
7
+ # @!attribute cleared_input_tokens
8
+ # Number of input tokens cleared by this edit.
9
+ #
10
+ # @return [Integer]
11
+ required :cleared_input_tokens, Integer
12
+
13
+ # @!attribute cleared_thinking_turns
14
+ # Number of thinking turns that were cleared.
15
+ #
16
+ # @return [Integer]
17
+ required :cleared_thinking_turns, Integer
18
+
19
+ # @!attribute type
20
+ # The type of context management edit applied.
21
+ #
22
+ # @return [Symbol, :clear_thinking_20251015]
23
+ required :type, const: :clear_thinking_20251015
24
+
25
+ # @!method initialize(cleared_input_tokens:, cleared_thinking_turns:, type: :clear_thinking_20251015)
26
+ # @param cleared_input_tokens [Integer] Number of input tokens cleared by this edit.
27
+ #
28
+ # @param cleared_thinking_turns [Integer] Number of thinking turns that were cleared.
29
+ #
30
+ # @param type [Symbol, :clear_thinking_20251015] The type of context management edit applied.
31
+ end
32
+ end
33
+
34
+ BetaClearThinking20251015EditResponse = Beta::BetaClearThinking20251015EditResponse
35
+ end
36
+ end
@@ -7,11 +7,25 @@ module Anthropic
7
7
  # @!attribute edits
8
8
  # List of context management edits to apply
9
9
  #
10
- # @return [Array<Anthropic::Models::Beta::BetaClearToolUses20250919Edit>, nil]
11
- optional :edits, -> { Anthropic::Internal::Type::ArrayOf[Anthropic::Beta::BetaClearToolUses20250919Edit] }
10
+ # @return [Array<Anthropic::Models::Beta::BetaClearToolUses20250919Edit, Anthropic::Models::Beta::BetaClearThinking20251015Edit>, nil]
11
+ optional :edits,
12
+ -> { Anthropic::Internal::Type::ArrayOf[union: Anthropic::Beta::BetaContextManagementConfig::Edit] }
12
13
 
13
14
  # @!method initialize(edits: nil)
14
- # @param edits [Array<Anthropic::Models::Beta::BetaClearToolUses20250919Edit>] List of context management edits to apply
15
+ # @param edits [Array<Anthropic::Models::Beta::BetaClearToolUses20250919Edit, Anthropic::Models::Beta::BetaClearThinking20251015Edit>] List of context management edits to apply
16
+
17
+ module Edit
18
+ extend Anthropic::Internal::Type::Union
19
+
20
+ discriminator :type
21
+
22
+ variant :clear_tool_uses_20250919, -> { Anthropic::Beta::BetaClearToolUses20250919Edit }
23
+
24
+ variant :clear_thinking_20251015, -> { Anthropic::Beta::BetaClearThinking20251015Edit }
25
+
26
+ # @!method self.variants
27
+ # @return [Array(Anthropic::Models::Beta::BetaClearToolUses20250919Edit, Anthropic::Models::Beta::BetaClearThinking20251015Edit)]
28
+ end
15
29
  end
16
30
  end
17
31
 
@@ -7,12 +7,25 @@ module Anthropic
7
7
  # @!attribute applied_edits
8
8
  # List of context management edits that were applied.
9
9
  #
10
- # @return [Array<Anthropic::Models::Beta::BetaClearToolUses20250919EditResponse>]
10
+ # @return [Array<Anthropic::Models::Beta::BetaClearToolUses20250919EditResponse, Anthropic::Models::Beta::BetaClearThinking20251015EditResponse>]
11
11
  required :applied_edits,
12
- -> { Anthropic::Internal::Type::ArrayOf[Anthropic::Beta::BetaClearToolUses20250919EditResponse] }
12
+ -> { Anthropic::Internal::Type::ArrayOf[union: Anthropic::Beta::BetaContextManagementResponse::AppliedEdit] }
13
13
 
14
14
  # @!method initialize(applied_edits:)
15
- # @param applied_edits [Array<Anthropic::Models::Beta::BetaClearToolUses20250919EditResponse>] List of context management edits that were applied.
15
+ # @param applied_edits [Array<Anthropic::Models::Beta::BetaClearToolUses20250919EditResponse, Anthropic::Models::Beta::BetaClearThinking20251015EditResponse>] List of context management edits that were applied.
16
+
17
+ module AppliedEdit
18
+ extend Anthropic::Internal::Type::Union
19
+
20
+ discriminator :type
21
+
22
+ variant :clear_tool_uses_20250919, -> { Anthropic::Beta::BetaClearToolUses20250919EditResponse }
23
+
24
+ variant :clear_thinking_20251015, -> { Anthropic::Beta::BetaClearThinking20251015EditResponse }
25
+
26
+ # @!method self.variants
27
+ # @return [Array(Anthropic::Models::Beta::BetaClearToolUses20250919EditResponse, Anthropic::Models::Beta::BetaClearThinking20251015EditResponse)]
28
+ end
16
29
  end
17
30
  end
18
31
 
@@ -11,8 +11,8 @@ module Anthropic
11
11
 
12
12
  # @!attribute input
13
13
  #
14
- # @return [Object]
15
- required :input, Anthropic::Internal::Type::Unknown
14
+ # @return [Hash{Symbol=>Object}]
15
+ required :input, Anthropic::Internal::Type::HashOf[Anthropic::Internal::Type::Unknown]
16
16
 
17
17
  # @!attribute name
18
18
  #
@@ -39,7 +39,7 @@ module Anthropic
39
39
  # @!method initialize(id:, input:, name:, server_name:, cache_control: nil, type: :mcp_tool_use)
40
40
  # @param id [String]
41
41
  #
42
- # @param input [Object]
42
+ # @param input [Hash{Symbol=>Object}]
43
43
  #
44
44
  # @param name [String]
45
45
  #
@@ -11,8 +11,8 @@ module Anthropic
11
11
 
12
12
  # @!attribute input
13
13
  #
14
- # @return [Object]
15
- required :input, Anthropic::Internal::Type::Unknown
14
+ # @return [Hash{Symbol=>Object}]
15
+ required :input, Anthropic::Internal::Type::HashOf[Anthropic::Internal::Type::Unknown]
16
16
 
17
17
  # @!attribute name
18
18
  #
@@ -33,7 +33,7 @@ module Anthropic
33
33
  # @!method initialize(id:, input:, name:, cache_control: nil, type: :server_tool_use)
34
34
  # @param id [String]
35
35
  #
36
- # @param input [Object]
36
+ # @param input [Hash{Symbol=>Object}]
37
37
  #
38
38
  # @param name [Symbol, Anthropic::Models::Beta::BetaServerToolUseBlockParam::Name]
39
39
  #
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Anthropic
4
+ module Models
5
+ module Beta
6
+ class BetaThinkingTurns < Anthropic::Internal::Type::BaseModel
7
+ # @!attribute type
8
+ #
9
+ # @return [Symbol, :thinking_turns]
10
+ required :type, const: :thinking_turns
11
+
12
+ # @!attribute value
13
+ #
14
+ # @return [Integer]
15
+ required :value, Integer
16
+
17
+ # @!method initialize(value:, type: :thinking_turns)
18
+ # @param value [Integer]
19
+ # @param type [Symbol, :thinking_turns]
20
+ end
21
+ end
22
+
23
+ BetaThinkingTurns = Beta::BetaThinkingTurns
24
+ end
25
+ end
@@ -66,8 +66,10 @@ module Anthropic
66
66
 
67
67
  # @!attribute properties
68
68
  #
69
- # @return [Object, nil]
70
- optional :properties, Anthropic::Internal::Type::Unknown, nil?: true
69
+ # @return [Hash{Symbol=>Object}, nil]
70
+ optional :properties,
71
+ Anthropic::Internal::Type::HashOf[Anthropic::Internal::Type::Unknown],
72
+ nil?: true
71
73
 
72
74
  # @!attribute required
73
75
  #
@@ -80,7 +82,7 @@ module Anthropic
80
82
  # This defines the shape of the `input` that your tool accepts and that the model
81
83
  # will produce.
82
84
  #
83
- # @param properties [Object, nil]
85
+ # @param properties [Hash{Symbol=>Object}, nil]
84
86
  # @param required [Array<String>, nil]
85
87
  # @param type [Symbol, :object]
86
88
  end
@@ -11,8 +11,8 @@ module Anthropic
11
11
 
12
12
  # @!attribute input
13
13
  #
14
- # @return [Object]
15
- required :input, Anthropic::Internal::Type::Unknown
14
+ # @return [Hash{Symbol=>Object}]
15
+ required :input, Anthropic::Internal::Type::HashOf[Anthropic::Internal::Type::Unknown]
16
16
 
17
17
  # @!attribute name
18
18
  #
@@ -33,7 +33,7 @@ module Anthropic
33
33
  # @!method initialize(id:, input:, name:, cache_control: nil, type: :tool_use)
34
34
  # @param id [String]
35
35
  #
36
- # @param input [Object]
36
+ # @param input [Hash{Symbol=>Object}]
37
37
  #
38
38
  # @param name [String]
39
39
  #
@@ -30,12 +30,6 @@ module Anthropic
30
30
 
31
31
  variant const: -> { Anthropic::Models::Model::CLAUDE_SONNET_4_5_20250929 }
32
32
 
33
- variant const: -> { Anthropic::Models::Model::CLAUDE_3_5_SONNET_LATEST }
34
-
35
- variant const: -> { Anthropic::Models::Model::CLAUDE_3_5_SONNET_20241022 }
36
-
37
- variant const: -> { Anthropic::Models::Model::CLAUDE_3_5_SONNET_20240620 }
38
-
39
33
  variant const: -> { Anthropic::Models::Model::CLAUDE_OPUS_4_0 }
40
34
 
41
35
  variant const: -> { Anthropic::Models::Model::CLAUDE_OPUS_4_20250514 }
@@ -62,9 +56,15 @@ module Anthropic
62
56
  # @!group
63
57
 
64
58
  # High-performance model with early extended thinking
59
+ # @deprecated Will reach end-of-life on February 19th, 2026. Please migrate to a newer model.
60
+ # Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more
61
+ # information.
65
62
  CLAUDE_3_7_SONNET_LATEST = :"claude-3-7-sonnet-latest"
66
63
 
67
64
  # High-performance model with early extended thinking
65
+ # @deprecated Will reach end-of-life on February 19th, 2026. Please migrate to a newer model.
66
+ # Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more
67
+ # information.
68
68
  CLAUDE_3_7_SONNET_20250219 = :"claude-3-7-sonnet-20250219"
69
69
 
70
70
  # Fastest and most compact model for near-instant responsiveness
@@ -94,20 +94,6 @@ module Anthropic
94
94
  # Our best model for real-world agents and coding
95
95
  CLAUDE_SONNET_4_5_20250929 = :"claude-sonnet-4-5-20250929"
96
96
 
97
- # Our previous most intelligent model
98
- CLAUDE_3_5_SONNET_LATEST = :"claude-3-5-sonnet-latest"
99
-
100
- # Our previous most intelligent model
101
- # @deprecated Will reach end-of-life on October 22, 2025. Please migrate to a newer model.
102
- # Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more
103
- # information.
104
- CLAUDE_3_5_SONNET_20241022 = :"claude-3-5-sonnet-20241022"
105
-
106
- # @deprecated Will reach end-of-life on October 22, 2025. Please migrate to a newer model.
107
- # Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more
108
- # information.
109
- CLAUDE_3_5_SONNET_20240620 = :"claude-3-5-sonnet-20240620"
110
-
111
97
  # Our most capable model
112
98
  CLAUDE_OPUS_4_0 = :"claude-opus-4-0"
113
99
 
@@ -10,8 +10,8 @@ module Anthropic
10
10
 
11
11
  # @!attribute input
12
12
  #
13
- # @return [Object]
14
- required :input, Anthropic::Internal::Type::Unknown
13
+ # @return [Hash{Symbol=>Object}]
14
+ required :input, Anthropic::Internal::Type::HashOf[Anthropic::Internal::Type::Unknown]
15
15
 
16
16
  # @!attribute name
17
17
  #
@@ -32,7 +32,7 @@ module Anthropic
32
32
  # @!method initialize(id:, input:, cache_control: nil, name: :web_search, type: :server_tool_use)
33
33
  # @param id [String]
34
34
  #
35
- # @param input [Object]
35
+ # @param input [Hash{Symbol=>Object}]
36
36
  #
37
37
  # @param cache_control [Anthropic::Models::CacheControlEphemeral, nil] Create a cache control breakpoint at this content block.
38
38
  #
@@ -65,8 +65,10 @@ module Anthropic
65
65
 
66
66
  # @!attribute properties
67
67
  #
68
- # @return [Object, nil]
69
- optional :properties, Anthropic::Internal::Type::Unknown, nil?: true
68
+ # @return [Hash{Symbol=>Object}, nil]
69
+ optional :properties,
70
+ Anthropic::Internal::Type::HashOf[Anthropic::Internal::Type::Unknown],
71
+ nil?: true
70
72
 
71
73
  # @!attribute required
72
74
  #
@@ -79,7 +81,7 @@ module Anthropic
79
81
  # This defines the shape of the `input` that your tool accepts and that the model
80
82
  # will produce.
81
83
  #
82
- # @param properties [Object, nil]
84
+ # @param properties [Hash{Symbol=>Object}, nil]
83
85
  # @param required [Array<String>, nil]
84
86
  # @param type [Symbol, :object]
85
87
  end
@@ -10,8 +10,8 @@ module Anthropic
10
10
 
11
11
  # @!attribute input
12
12
  #
13
- # @return [Object]
14
- required :input, Anthropic::Internal::Type::Unknown
13
+ # @return [Hash{Symbol=>Object}]
14
+ required :input, Anthropic::Internal::Type::HashOf[Anthropic::Internal::Type::Unknown]
15
15
 
16
16
  # @!attribute name
17
17
  #
@@ -32,7 +32,7 @@ module Anthropic
32
32
  # @!method initialize(id:, input:, name:, cache_control: nil, type: :tool_use)
33
33
  # @param id [String]
34
34
  #
35
- # @param input [Object]
35
+ # @param input [Hash{Symbol=>Object}]
36
36
  #
37
37
  # @param name [String]
38
38
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Anthropic
4
- VERSION = "1.12.0"
4
+ VERSION = "1.13.0"
5
5
  end
data/lib/anthropic.rb CHANGED
@@ -66,6 +66,7 @@ require_relative "anthropic/models/api_error_object"
66
66
  require_relative "anthropic/models/authentication_error"
67
67
  require_relative "anthropic/models/base64_image_source"
68
68
  require_relative "anthropic/models/base64_pdf_source"
69
+ require_relative "anthropic/models/beta/beta_all_thinking_turns"
69
70
  require_relative "anthropic/models/beta/beta_base64_image_source"
70
71
  require_relative "anthropic/models/beta/beta_base64_pdf_block"
71
72
  require_relative "anthropic/models/beta/beta_base64_pdf_source"
@@ -92,6 +93,8 @@ require_relative "anthropic/models/beta/beta_citation_search_result_location"
92
93
  require_relative "anthropic/models/beta/beta_citation_search_result_location_param"
93
94
  require_relative "anthropic/models/beta/beta_citations_web_search_result_location"
94
95
  require_relative "anthropic/models/beta/beta_citation_web_search_result_location_param"
96
+ require_relative "anthropic/models/beta/beta_clear_thinking_20251015_edit"
97
+ require_relative "anthropic/models/beta/beta_clear_thinking_20251015_edit_response"
95
98
  require_relative "anthropic/models/beta/beta_clear_tool_uses_20250919_edit"
96
99
  require_relative "anthropic/models/beta/beta_clear_tool_uses_20250919_edit_response"
97
100
  require_relative "anthropic/models/beta/beta_code_execution_output_block"
@@ -185,6 +188,7 @@ require_relative "anthropic/models/beta/beta_thinking_config_disabled"
185
188
  require_relative "anthropic/models/beta/beta_thinking_config_enabled"
186
189
  require_relative "anthropic/models/beta/beta_thinking_config_param"
187
190
  require_relative "anthropic/models/beta/beta_thinking_delta"
191
+ require_relative "anthropic/models/beta/beta_thinking_turns"
188
192
  require_relative "anthropic/models/beta/beta_tool"
189
193
  require_relative "anthropic/models/beta/beta_tool_bash_20241022"
190
194
  require_relative "anthropic/models/beta/beta_tool_bash_20250124"
@@ -0,0 +1,30 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ BetaAllThinkingTurns = Beta::BetaAllThinkingTurns
6
+
7
+ module Beta
8
+ class BetaAllThinkingTurns < Anthropic::Internal::Type::BaseModel
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(
12
+ Anthropic::Beta::BetaAllThinkingTurns,
13
+ Anthropic::Internal::AnyHash
14
+ )
15
+ end
16
+
17
+ sig { returns(Symbol) }
18
+ attr_accessor :type
19
+
20
+ sig { params(type: Symbol).returns(T.attached_class) }
21
+ def self.new(type: :all)
22
+ end
23
+
24
+ sig { override.returns({ type: Symbol }) }
25
+ def to_hash
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end