anthropic 1.4.0 → 1.4.1
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 +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +1 -1
- data/lib/anthropic/helpers/bedrock/client.rb +23 -46
- data/lib/anthropic/internal/transport/base_client.rb +18 -0
- data/lib/anthropic/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5dccfd318c0bef10694a1aa969a9d5bb6e5f0783fb3e64a0beb395622f26f5b5
|
4
|
+
data.tar.gz: 60de84ff4313a79ce191da92d5afda97111f133e90031e823d1a8951357145be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6adf3c9d40f3554544c8e7ec818c47273fc2bc1c4b0afdbc9f0f7f04c316850ec4886d6974ba3fdb91e8d9090c39a41685db95ed40e14e4be071ebd777878a2
|
7
|
+
data.tar.gz: 6f37c51597136d2038d5a648d26811e41b32e0d9ffb7acbc873852748895d8e999a882bd44439223108137d3f4ed588dbbd39900d109d075c6584d9c7897a4de
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 1.4.1 (2025-08-07)
|
4
|
+
|
5
|
+
Full Changelog: [v1.4.0...v1.4.1](https://github.com/anthropics/anthropic-sdk-ruby/compare/v1.4.0...v1.4.1)
|
6
|
+
|
7
|
+
### Bug Fixes
|
8
|
+
|
9
|
+
* aws bedrock should sign each request follow retries ([#672](https://github.com/anthropics/anthropic-sdk-ruby/issues/672)) ([df9f4e1](https://github.com/anthropics/anthropic-sdk-ruby/commit/df9f4e1aa7e7211dab3d36dd9093092d20649359))
|
10
|
+
|
3
11
|
## 1.4.0 (2025-08-05)
|
4
12
|
|
5
13
|
Full Changelog: [v1.3.0...v1.4.0](https://github.com/anthropics/anthropic-sdk-ruby/compare/v1.3.0...v1.4.0)
|
data/README.md
CHANGED
@@ -50,10 +50,10 @@ module Anthropic
|
|
50
50
|
def initialize(
|
51
51
|
aws_region: nil,
|
52
52
|
base_url: nil,
|
53
|
-
max_retries: DEFAULT_MAX_RETRIES,
|
54
|
-
timeout: DEFAULT_TIMEOUT_IN_SECONDS,
|
55
|
-
initial_retry_delay: DEFAULT_INITIAL_RETRY_DELAY,
|
56
|
-
max_retry_delay: DEFAULT_MAX_RETRY_DELAY,
|
53
|
+
max_retries: self.class::DEFAULT_MAX_RETRIES,
|
54
|
+
timeout: self.class::DEFAULT_TIMEOUT_IN_SECONDS,
|
55
|
+
initial_retry_delay: self.class::DEFAULT_INITIAL_RETRY_DELAY,
|
56
|
+
max_retry_delay: self.class::DEFAULT_MAX_RETRY_DELAY,
|
57
57
|
aws_access_key: nil,
|
58
58
|
aws_secret_key: nil,
|
59
59
|
aws_session_token: nil,
|
@@ -113,56 +113,33 @@ module Anthropic
|
|
113
113
|
|
114
114
|
# @api private
|
115
115
|
#
|
116
|
-
#
|
116
|
+
# Very private API, do not use
|
117
117
|
#
|
118
|
-
#
|
118
|
+
# @param request [Hash{Symbol=>Object}] .
|
119
119
|
#
|
120
|
-
# @option
|
120
|
+
# @option request [Symbol] :method
|
121
121
|
#
|
122
|
-
# @option
|
122
|
+
# @option request [URI::Generic] :url
|
123
123
|
#
|
124
|
-
# @option
|
124
|
+
# @option request [Hash{String=>String}] :headers
|
125
125
|
#
|
126
|
-
# @option
|
126
|
+
# @option request [Object] :body
|
127
127
|
#
|
128
|
-
#
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
# @option opts [String, nil] :idempotency_key
|
139
|
-
#
|
140
|
-
# @option opts [Hash{String=>Array<String>, String, nil}, nil] :extra_query
|
141
|
-
#
|
142
|
-
# @option opts [Hash{String=>String, nil}, nil] :extra_headers
|
143
|
-
#
|
144
|
-
# @option opts [Object, nil] :extra_body
|
145
|
-
#
|
146
|
-
# @option opts [Integer, nil] :max_retries
|
147
|
-
#
|
148
|
-
# @option opts [Float, nil] :timeout
|
149
|
-
#
|
150
|
-
# @return [Hash{Symbol=>Object}]
|
151
|
-
private def build_request(req, opts)
|
152
|
-
fit_req_to_bedrock_specs!(req)
|
153
|
-
|
154
|
-
request_input = super
|
155
|
-
|
156
|
-
signed_request = @signer.sign_request(
|
157
|
-
http_method: request_input[:method],
|
158
|
-
url: request_input[:url],
|
159
|
-
headers: request_input[:headers],
|
160
|
-
body: request_input[:body]
|
161
|
-
)
|
128
|
+
# @return [Hash{Symbol, Object}]
|
129
|
+
protected def transform_request(request)
|
130
|
+
fit_req_to_bedrock_specs!(request)
|
131
|
+
sliced = super.slice(
|
132
|
+
:method,
|
133
|
+
:url,
|
134
|
+
:headers,
|
135
|
+
:body
|
136
|
+
).transform_keys(method: :http_method)
|
137
|
+
body = StringIO.new(body.to_a.join) if (body = sliced.fetch(:body)).is_a?(Enumerator)
|
162
138
|
|
163
|
-
|
139
|
+
signed = @signer.sign_request({**sliced, body: body})
|
164
140
|
|
165
|
-
|
141
|
+
headers = Anthropic::Internal::Util.normalized_headers(request.fetch(:headers), signed.headers)
|
142
|
+
{**request, headers: headers}
|
166
143
|
end
|
167
144
|
|
168
145
|
# @param aws_region [String, nil]
|
@@ -341,6 +341,23 @@ module Anthropic
|
|
341
341
|
(@initial_retry_delay * scale * jitter).clamp(0, @max_retry_delay)
|
342
342
|
end
|
343
343
|
|
344
|
+
# @api private
|
345
|
+
#
|
346
|
+
# Very private API, do not use
|
347
|
+
#
|
348
|
+
# @param request [Hash{Symbol=>Object}] .
|
349
|
+
#
|
350
|
+
# @option request [Symbol] :method
|
351
|
+
#
|
352
|
+
# @option request [URI::Generic] :url
|
353
|
+
#
|
354
|
+
# @option request [Hash{String=>String}] :headers
|
355
|
+
#
|
356
|
+
# @option request [Object] :body
|
357
|
+
#
|
358
|
+
# @return [Hash{Symbol, Object}]
|
359
|
+
protected def transform_request(request) = request
|
360
|
+
|
344
361
|
# @api private
|
345
362
|
#
|
346
363
|
# @param request [Hash{Symbol=>Object}] .
|
@@ -366,6 +383,7 @@ module Anthropic
|
|
366
383
|
# @raise [Anthropic::Errors::APIError]
|
367
384
|
# @return [Array(Integer, Net::HTTPResponse, Enumerable<String>)]
|
368
385
|
def send_request(request, redirect_count:, retry_count:, send_retry_header:)
|
386
|
+
request = transform_request(request)
|
369
387
|
url, headers, max_retries, timeout = request.fetch_values(:url, :headers, :max_retries, :timeout)
|
370
388
|
input = {**request.except(:timeout), deadline: Anthropic::Internal::Util.monotonic_secs + timeout}
|
371
389
|
|
data/lib/anthropic/version.rb
CHANGED
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.4.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anthropic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-08-
|
11
|
+
date: 2025-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: connection_pool
|