anthropic 1.25.0 → 1.26.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5bfde8fb8238b702db1198ffaaa13365d3274c4222f67795ef642cdf3400071b
4
- data.tar.gz: 971877b395273eca3fbadf30a18b30b94adb797b423ef0ed0a05e9bb53e487bb
3
+ metadata.gz: 8765d87a8f2c333c114221a23ca51b9562d6364e6585bb517660192974a193d4
4
+ data.tar.gz: dfcba061b31eb9a056a0b0cbfe5a0f96b93277a52162d3945f2615d26eea81a4
5
5
  SHA512:
6
- metadata.gz: 991b93e8ddf7187a7b08598ca4f5b3b374f680337f1efb2a7ad5160e3ff0f2da5271320177a0abcf169e61a2502a56553d994449a1f493beebe80a49b0c3ed40
7
- data.tar.gz: b4778e9aec53cc412a43baadd0c382c130e3e16bc72f260eed7927bb0d04cd8707eec9582030abda572ccf104ce7537382bea6b771668354bcadad5ec0f78b2e
6
+ metadata.gz: 04b8f406fe7f06a6d9bc6331030486a1283d099c0e19eb2975fd7a987f911280a7a6e13d277d4d412fd478fa98a3316c114a9ff3cf98c0fb4c028b9d218f8592
7
+ data.tar.gz: 727738003e679d0fd5ca540fc918e85f8eccfb67a8f47d45996aaec6ddb58d14ec5ceed23df33197aafb7a779730019cdc27b2ec61aaacb4e549dcd9957905b9
data/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.26.0 (2026-03-31)
4
+
5
+ Full Changelog: [v1.25.0...v1.26.0](https://github.com/anthropics/anthropic-sdk-ruby/compare/v1.25.0...v1.26.0)
6
+
7
+ ### Features
8
+
9
+ * add .type field to APIStatusError for uniform error identification ([#847](https://github.com/anthropics/anthropic-sdk-ruby/issues/847)) ([4c57783](https://github.com/anthropics/anthropic-sdk-ruby/commit/4c577837697516dc339100fe52be915afe544102))
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * **internal:** correct multipart form field name encoding ([0fed236](https://github.com/anthropics/anthropic-sdk-ruby/commit/0fed236eabd481a034739c6f7abab75bc3a875c2))
15
+ * variable name typo ([550b1ed](https://github.com/anthropics/anthropic-sdk-ruby/commit/550b1ed8af220d6749040c44f608b0b6b8910aaf))
16
+
17
+
18
+ ### Chores
19
+
20
+ * **ci:** run builds on CI even if only spec metadata changed ([8faa86f](https://github.com/anthropics/anthropic-sdk-ruby/commit/8faa86f76c7fbc80082ac07768e14af831566f62))
21
+ * **ci:** skip lint on metadata-only changes ([16064d4](https://github.com/anthropics/anthropic-sdk-ruby/commit/16064d40c434ba29c0943c6dd0402c0b58fcbb3d))
22
+ * **ci:** support opting out of skipping builds on metadata-only commits ([e184024](https://github.com/anthropics/anthropic-sdk-ruby/commit/e18402452192c17170a6933ab0bb060a7e0ba073))
23
+ * **internal:** update gitignore ([5f3d363](https://github.com/anthropics/anthropic-sdk-ruby/commit/5f3d363e741a966fa6ec3e04ed675eab27aedd77))
24
+ * **tests:** bump steady to v0.19.4 ([4a17d4d](https://github.com/anthropics/anthropic-sdk-ruby/commit/4a17d4deff2d696f78c9c503f99dcbd9c7146153))
25
+ * **tests:** bump steady to v0.19.5 ([a4bcfd7](https://github.com/anthropics/anthropic-sdk-ruby/commit/a4bcfd76f9384c02bfb074ed57de8aba2face020))
26
+ * **tests:** bump steady to v0.19.6 ([e34f523](https://github.com/anthropics/anthropic-sdk-ruby/commit/e34f5236c9d2aa6fa78c7562af7f89aa70fe373b))
27
+ * **tests:** bump steady to v0.19.7 ([577310d](https://github.com/anthropics/anthropic-sdk-ruby/commit/577310d77b14972f657d5946b661298cadbff31a))
28
+ * **tests:** bump steady to v0.20.1 ([dcf51d2](https://github.com/anthropics/anthropic-sdk-ruby/commit/dcf51d293d46d719c0fe09b4410dcb5445adcabc))
29
+ * **tests:** bump steady to v0.20.2 ([5c52306](https://github.com/anthropics/anthropic-sdk-ruby/commit/5c523068dadf801f50b1d39d53bbcce07a5d0722))
30
+
3
31
  ## 1.25.0 (2026-03-18)
4
32
 
5
33
  Full Changelog: [v1.24.0...v1.25.0](https://github.com/anthropics/anthropic-sdk-ruby/compare/v1.24.0...v1.25.0)
data/README.md CHANGED
@@ -15,7 +15,7 @@ Add to your application's Gemfile:
15
15
  <!-- x-release-please-start-version -->
16
16
 
17
17
  ```ruby
18
- gem "anthropic", "~> 1.25.0"
18
+ gem "anthropic", "~> 1.26.0"
19
19
  ```
20
20
 
21
21
  <!-- x-release-please-end -->
@@ -121,6 +121,9 @@ module Anthropic
121
121
  end
122
122
 
123
123
  class APIStatusError < Anthropic::Errors::APIError
124
+ # @return [Anthropic::ErrorType::TaggedSymbol, nil]
125
+ attr_reader :type
126
+
124
127
  # @api private
125
128
  #
126
129
  # @param url [URI::Generic]
@@ -133,6 +136,9 @@ module Anthropic
133
136
  #
134
137
  # @return [self]
135
138
  def self.for(url:, status:, headers:, body:, request:, response:, message: nil)
139
+ error_type = body.dig(:error, :type) if body.is_a?(Hash)
140
+ error_type = error_type.to_sym if error_type.is_a?(String)
141
+
136
142
  kwargs =
137
143
  {
138
144
  url: url,
@@ -141,7 +147,8 @@ module Anthropic
141
147
  body: body,
142
148
  request: request,
143
149
  response: response,
144
- message: message
150
+ message: message,
151
+ type: error_type
145
152
  }
146
153
 
147
154
  case status
@@ -179,7 +186,9 @@ module Anthropic
179
186
  # @param request [nil]
180
187
  # @param response [nil]
181
188
  # @param message [String, nil]
182
- def initialize(url:, status:, headers:, body:, request:, response:, message: nil)
189
+ # @param type [Anthropic::ErrorType::TaggedSymbol, nil]
190
+ def initialize(url:, status:, headers:, body:, request:, response:, message: nil, type: nil)
191
+ @type = type
183
192
  message ||= {url: url.to_s, status: status, body: body}
184
193
  super(
185
194
  url: url,
@@ -157,7 +157,7 @@ module Anthropic
157
157
  in Hash | nil => coerced
158
158
  coerced
159
159
  else
160
- message = "Expected a #{Hash} or #{Anthropic::Internal::Type::BaseModel}, got #{data.inspect}"
160
+ message = "Expected a #{Hash} or #{Anthropic::Internal::Type::BaseModel}, got #{input.inspect}"
161
161
  raise ArgumentError.new(message)
162
162
  end
163
163
  end
@@ -571,8 +571,7 @@ module Anthropic
571
571
  y << "Content-Disposition: form-data"
572
572
 
573
573
  unless key.nil?
574
- name = ERB::Util.url_encode(key.to_s)
575
- y << "; name=\"#{name}\""
574
+ y << "; name=\"#{key}\""
576
575
  end
577
576
 
578
577
  case val
@@ -47,6 +47,8 @@ module Anthropic
47
47
 
48
48
  variant const: -> { Anthropic::Models::AnthropicBeta::FAST_MODE_2026_02_01 }
49
49
 
50
+ variant const: -> { Anthropic::Models::AnthropicBeta::OUTPUT_300K_2026_03_24 }
51
+
50
52
  # @!method self.variants
51
53
  # @return [Array(String, Symbol)]
52
54
 
@@ -76,6 +78,7 @@ module Anthropic
76
78
  MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26 = :"model-context-window-exceeded-2025-08-26"
77
79
  SKILLS_2025_10_02 = :"skills-2025-10-02"
78
80
  FAST_MODE_2026_02_01 = :"fast-mode-2026-02-01"
81
+ OUTPUT_300K_2026_03_24 = :"output-300k-2026-03-24"
79
82
 
80
83
  # @!endgroup
81
84
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Anthropic
4
- VERSION = "1.25.0"
4
+ VERSION = "1.26.0"
5
5
  end
@@ -120,6 +120,9 @@ module Anthropic
120
120
  end
121
121
 
122
122
  class APIStatusError < Anthropic::Errors::APIError
123
+ sig { returns(T.nilable(Anthropic::ErrorType::TaggedSymbol)) }
124
+ attr_reader :type
125
+
123
126
  # @api private
124
127
  sig do
125
128
  params(
@@ -155,7 +158,8 @@ module Anthropic
155
158
  body: T.nilable(Object),
156
159
  request: NilClass,
157
160
  response: NilClass,
158
- message: T.nilable(String)
161
+ message: T.nilable(String),
162
+ type: T.nilable(Anthropic::ErrorType::TaggedSymbol)
159
163
  ).returns(T.attached_class)
160
164
  end
161
165
  def self.new(
@@ -165,7 +169,8 @@ module Anthropic
165
169
  body:,
166
170
  request:,
167
171
  response:,
168
- message: nil
172
+ message: nil,
173
+ type: nil
169
174
  )
170
175
  end
171
176
  end
@@ -91,6 +91,8 @@ module Anthropic
91
91
  T.let(:"skills-2025-10-02", Anthropic::AnthropicBeta::TaggedSymbol)
92
92
  FAST_MODE_2026_02_01 =
93
93
  T.let(:"fast-mode-2026-02-01", Anthropic::AnthropicBeta::TaggedSymbol)
94
+ OUTPUT_300K_2026_03_24 =
95
+ T.let(:"output-300k-2026-03-24", Anthropic::AnthropicBeta::TaggedSymbol)
94
96
  end
95
97
  end
96
98
  end
@@ -61,6 +61,8 @@ module Anthropic
61
61
  end
62
62
 
63
63
  class APIStatusError < Anthropic::Errors::APIError
64
+ attr_reader type: Anthropic::Models::error_type?
65
+
64
66
  def self.for: (
65
67
  url: URI::Generic,
66
68
  status: Integer,
@@ -78,7 +80,8 @@ module Anthropic
78
80
  body: Object?,
79
81
  request: nil,
80
82
  response: nil,
81
- ?message: String?
83
+ ?message: String?,
84
+ ?type: Anthropic::Models::error_type?
82
85
  ) -> void
83
86
  end
84
87
 
@@ -22,6 +22,7 @@ module Anthropic
22
22
  | :"model-context-window-exceeded-2025-08-26"
23
23
  | :"skills-2025-10-02"
24
24
  | :"fast-mode-2026-02-01"
25
+ | :"output-300k-2026-03-24"
25
26
 
26
27
  module AnthropicBeta
27
28
  extend Anthropic::Internal::Type::Union
@@ -48,6 +49,7 @@ module Anthropic
48
49
  MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26: :"model-context-window-exceeded-2025-08-26"
49
50
  SKILLS_2025_10_02: :"skills-2025-10-02"
50
51
  FAST_MODE_2026_02_01: :"fast-mode-2026-02-01"
52
+ OUTPUT_300K_2026_03_24: :"output-300k-2026-03-24"
51
53
  end
52
54
  end
53
55
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anthropic
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.25.0
4
+ version: 1.26.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anthropic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-03-18 00:00:00.000000000 Z
11
+ date: 2026-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cgi