anthropic 1.1.0 → 1.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 40c9c7c712197e8666740804eca676d573e5214f541cf983e0427f76b8eaefe3
4
- data.tar.gz: 2423170ab39925e637cb77782db3883645d0064d4582a87afcd50bd6fec6e7af
3
+ metadata.gz: 13b85406d88291ad8b4617f040286edefe795c4b0400312d0a630dfe30a70bf6
4
+ data.tar.gz: 3467c4167d8db97ecc9bd2dbf049f6795ac7d6474ad8e3b1c1d0414aee1d297e
5
5
  SHA512:
6
- metadata.gz: 503e09fa3681d40df1045b3cc57c29e7e81594f44011e837dd8ea41f0c6c0b7fbe35c4659d9e5d1803f7ec0dc73bfea0c8ebb70249820e8d1854c4a9b8b127d8
7
- data.tar.gz: 810826a076fbc6614429d4ed0ae073e90487a9fb17521375ed174d087c9b1ec865c7d12470ab5c4b77bc3d62cec2016a356a0a5c3e26b4fcce31c5101ba90366
6
+ metadata.gz: d5ea1bd30663111c0cf3d5681469b9186621bf2eb8009f38e3aea031092f5b4a1bf091b484c8bb40b8214977ff29efc19ef03b25ed7479cd69e6c9d528a5f06a
7
+ data.tar.gz: d7afee44eb07c19934d5691b7b2d7e55fbdbcd88b82dc3ae65d71cc4e00ab6093836da1c4158e68f8d0fd48a9520993350abb4c29957785edcd68862cafaa3f8
data/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.1.1 (2025-05-28)
4
+
5
+ Full Changelog: [v1.1.0...v1.1.1](https://github.com/anthropics/anthropic-sdk-ruby/compare/v1.1.0...v1.1.1)
6
+
7
+ ### Bug Fixes
8
+
9
+ * prevent rubocop from mangling `===` to `is_a?` check ([303ad55](https://github.com/anthropics/anthropic-sdk-ruby/commit/303ad550c542c726b2ce8bc3d53e01108af634d5))
10
+ * sorbet types for enums, and make tapioca detection ignore `tapioca dsl` ([fb289a1](https://github.com/anthropics/anthropic-sdk-ruby/commit/fb289a1be37379cea207b024e0fb4503ea174639))
11
+
12
+
13
+ ### Chores
14
+
15
+ * add more examples ([e14665e](https://github.com/anthropics/anthropic-sdk-ruby/commit/e14665e4e236cce4a17de06507d1b855d1d153d2))
16
+ * image example ([#621](https://github.com/anthropics/anthropic-sdk-ruby/issues/621)) ([9bdc648](https://github.com/anthropics/anthropic-sdk-ruby/commit/9bdc6487d77d856c87d658917f53faa6f12bc38f))
17
+ * **internal:** fix release workflows ([fffb4b8](https://github.com/anthropics/anthropic-sdk-ruby/commit/fffb4b8eeff759ac98e9cfb5d778b014336e2956))
18
+ * more examples ([#619](https://github.com/anthropics/anthropic-sdk-ruby/issues/619)) ([e14665e](https://github.com/anthropics/anthropic-sdk-ruby/commit/e14665e4e236cce4a17de06507d1b855d1d153d2))
19
+
3
20
  ## 1.1.0 (2025-05-22)
4
21
 
5
22
  Full Changelog: [v1.0.0...v1.1.0](https://github.com/anthropics/anthropic-sdk-ruby/compare/v1.0.0...v1.1.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.1.0"
18
+ gem "anthropic", "~> 1.1.1"
19
19
  ```
20
20
 
21
21
  <!-- x-release-please-end -->
@@ -62,7 +62,7 @@ module Anthropic
62
62
  begin
63
63
  require("aws-sdk-bedrockruntime")
64
64
  rescue LoadError
65
- raise <<~MSG
65
+ message = <<~MSG
66
66
 
67
67
  In order to access Anthropic models on Bedrock you must require the `aws-sdk-bedrockruntime` gem.
68
68
  You can install it by adding the following to your Gemfile:
@@ -75,6 +75,8 @@ module Anthropic
75
75
 
76
76
  gem install aws-sdk-bedrockruntime
77
77
  MSG
78
+
79
+ raise RuntimeError.new(message)
78
80
  end
79
81
 
80
82
  @aws_region, @aws_credentials = resolve_region_and_credentials(
@@ -49,7 +49,7 @@ module Anthropic
49
49
  begin
50
50
  require("googleauth")
51
51
  rescue LoadError
52
- raise <<~MSG
52
+ message = <<~MSG
53
53
 
54
54
  In order to access Anthropic models on Vertex you must require the `googleauth` gem.
55
55
  You can install it by adding the following to your Gemfile:
@@ -62,6 +62,8 @@ module Anthropic
62
62
 
63
63
  gem install googleauth
64
64
  MSG
65
+
66
+ raise RuntimeError.new(message)
65
67
  end
66
68
 
67
69
  if region.to_s.empty?
@@ -185,7 +187,7 @@ module Anthropic
185
187
  ].include?(request_components[:path]) && request_components[:method] == :post
186
188
 
187
189
  unless body.is_a?(Hash)
188
- raise Anthropic::Error, "Expected json data to be a hash for post /v1/messages"
190
+ raise ArgumentError.new("Expected json data to be a hash for post /v1/messages")
189
191
  end
190
192
 
191
193
  model = body.delete(:model)
@@ -600,11 +600,13 @@ module Anthropic
600
600
  #
601
601
  # @return [Object]
602
602
  def encode_content(headers, body)
603
+ # rubocop:disable Style/CaseEquality
604
+ # rubocop:disable Layout/LineLength
603
605
  content_type = headers["content-type"]
604
606
  case [content_type, body]
605
607
  in [Anthropic::Internal::Util::JSON_CONTENT, Hash | Array | -> { primitive?(_1) }]
606
608
  [headers, JSON.generate(body)]
607
- in [Anthropic::Internal::Util::JSONL_CONTENT, Enumerable] unless body.is_a?(Anthropic::Internal::Type::FileInput)
609
+ in [Anthropic::Internal::Util::JSONL_CONTENT, Enumerable] unless Anthropic::Internal::Type::FileInput === body
608
610
  [headers, body.lazy.map { JSON.generate(_1) }]
609
611
  in [%r{^multipart/form-data}, Hash | Anthropic::Internal::Type::FileInput]
610
612
  boundary, strio = encode_multipart_streaming(body)
@@ -619,6 +621,8 @@ module Anthropic
619
621
  else
620
622
  [headers, body]
621
623
  end
624
+ # rubocop:enable Layout/LineLength
625
+ # rubocop:enable Style/CaseEquality
622
626
  end
623
627
 
624
628
  # @api private
@@ -871,8 +875,12 @@ module Anthropic
871
875
  case type
872
876
  in Anthropic::Internal::Util::SorbetRuntimeSupport
873
877
  type.to_sorbet_type
874
- else
878
+ in Class | Module
875
879
  type
880
+ in true | false
881
+ T::Boolean
882
+ else
883
+ type.class
876
884
  end
877
885
  end
878
886
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Anthropic
4
- VERSION = "1.1.0"
4
+ VERSION = "1.1.1"
5
5
  end
data/lib/anthropic.rb CHANGED
@@ -20,7 +20,9 @@ require "uri"
20
20
 
21
21
  # We already ship the preferred sorbet manifests in the package itself.
22
22
  # `tapioca` currently does not offer us a way to opt out of unnecessary compilation.
23
- if Object.const_defined?(:Tapioca) && caller.chain([$PROGRAM_NAME]).chain(ARGV).grep(/tapioca/)
23
+ if Object.const_defined?(:Tapioca) &&
24
+ caller.chain([$PROGRAM_NAME]).chain(ARGV).any?(/tapioca/) &&
25
+ ARGV.none?(/dsl/)
24
26
  return
25
27
  end
26
28
 
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.1.0
4
+ version: 1.1.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-05-22 00:00:00.000000000 Z
11
+ date: 2025-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: connection_pool