anthropic 1.56.0 → 1.56.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: 58294c110c5b712622ddf3921622929576a73ec5c08cb4316f5c34f6dfcf6d2a
4
- data.tar.gz: 665f92b3d88328dff5a61a02481f3d11a05b207d2928a2e8d29e18041ee95db3
3
+ metadata.gz: 9583338a96c3616a34e9dc7fe46ecc9ba4f2cef3d50c7cb371db782eabf34ff8
4
+ data.tar.gz: 40d68b130a8b6a2765995108d91957ed343cefaf270089ba2afe0d51994dec97
5
5
  SHA512:
6
- metadata.gz: 68c7f02ba359316458ef143f503a1986f144390541b4723c2e7e24694d7183eb76b17581a36c06de13fca3421e50fa82b9a32d05879785b2676bee4f3c6d58e6
7
- data.tar.gz: d0fcf027e0eec3331b01c392f857f55a9098a8b7e16b9fa9a6188dff9a9d3474c72bdbcd250dd5e853c151c42e300b828c691bd5e39e4c0863b5e7e39c5fb753
6
+ metadata.gz: fa1b3ad725608f505dba695652766fee310e95b2458d63c360d3a605d48cab076f92ecdc284d3b3c9c47237dcb1e01694f3add4d66b66183d643533997252cce
7
+ data.tar.gz: 12f4ed88e2fd361227ac919075b7929ca85ccaa7b400931ecb00cfc921da4b7467a6b40ff0144258664ea5c8fb0c9772537e82980146125b8ddf01f3154fc5c6
data/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.56.1 (2026-07-21)
4
+
5
+ Full Changelog: [v1.56.0...v1.56.1](https://github.com/anthropics/anthropic-sdk-ruby/compare/v1.56.0...v1.56.1)
6
+
7
+ ### Bug Fixes
8
+
9
+ * **internal:** encode Time query params as RFC 3339 ([#133](https://github.com/anthropics/anthropic-sdk-ruby/issues/133)) ([47d18e9](https://github.com/anthropics/anthropic-sdk-ruby/commit/47d18e91defcd8fba90ea98790c5e3981dfa607e))
10
+
11
+
12
+ ### Chores
13
+
14
+ * **api:** add support for new refusal category ([318ae5f](https://github.com/anthropics/anthropic-sdk-ruby/commit/318ae5f9a349aa9e33c20b8032f808b133553532))
15
+ * **client:** docs updates ([d2c06e7](https://github.com/anthropics/anthropic-sdk-ruby/commit/d2c06e73bec2832215bc2769143f61a68794a388))
16
+ * **docs:** small updates ([fbc6e77](https://github.com/anthropics/anthropic-sdk-ruby/commit/fbc6e775736217cacf11429aca6212ffa0f13c8b))
17
+ * **docs:** small updates ([32597cd](https://github.com/anthropics/anthropic-sdk-ruby/commit/32597cdf5094a3f8561c64fadb62c97c1eeb9e64))
18
+ * **internal:** codegen related update ([2116b5a](https://github.com/anthropics/anthropic-sdk-ruby/commit/2116b5aeb4dc01bcdb8548826c61f6e2a350a6a0))
19
+
3
20
  ## 1.56.0 (2026-07-16)
4
21
 
5
22
  Full Changelog: [v1.55.0...v1.56.0](https://github.com/anthropics/anthropic-sdk-ruby/compare/v1.55.0...v1.56.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.56.0"
18
+ gem "anthropic", "~> 1.56.1"
19
19
  ```
20
20
 
21
21
  <!-- x-release-please-end -->
@@ -570,9 +570,24 @@ module Anthropic
570
570
  write_query_param_element!(collection, "#{key}[#{name}]", value)
571
571
  end
572
572
  in Array
573
- collection["#{key}[]"] = element.map(&:to_s)
573
+ collection["#{key}[]"] = element.map { query_param_string(_1) }
574
574
  else
575
- collection[key] = element.to_s
575
+ collection[key] = query_param_string(element)
576
+ end
577
+ end
578
+
579
+ # @api private
580
+ #
581
+ # @param element [Object]
582
+ #
583
+ # @return [String]
584
+ private def query_param_string(element)
585
+ case element
586
+ in Time
587
+ # `Time#to_s` is not a wire format — date-time params must encode as RFC 3339.
588
+ element.iso8601
589
+ else
590
+ element.to_s
576
591
  end
577
592
  end
578
593
 
@@ -28,11 +28,21 @@ module Anthropic
28
28
  module Category
29
29
  extend Anthropic::Internal::Type::Enum
30
30
 
31
+ # The request could enable cyber harm, such as malware or exploit development. Benign cybersecurity work can also trigger this category.
31
32
  CYBER = :cyber
33
+
34
+ # The request could enable biological harm, such as dangerous lab methods. Beneficial life sciences work can also trigger this category.
32
35
  BIO = :bio
36
+
37
+ # The request could assist the development of competing AI models, which is restricted under [Anthropic's commercial terms](https://www.anthropic.com/legal/commercial-terms). Benign machine learning work can also trigger this category.
33
38
  FRONTIER_LLM = :frontier_llm
39
+
40
+ # The request asks the model to reproduce its internal reasoning in the response text. To get reasoning in a structured form instead, use [adaptive thinking](https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking).
34
41
  REASONING_EXTRACTION = :reasoning_extraction
35
42
 
43
+ # The request could be related to an area that was determined as harmful. Benign work might sometimes trigger this category.
44
+ GENERAL_HARMS = :general_harms
45
+
36
46
  # @!method self.values
37
47
  # @return [Array<Symbol>]
38
48
  end
@@ -104,11 +104,21 @@ module Anthropic
104
104
  module Category
105
105
  extend Anthropic::Internal::Type::Enum
106
106
 
107
+ # The request could enable cyber harm, such as malware or exploit development. Benign cybersecurity work can also trigger this category.
107
108
  CYBER = :cyber
109
+
110
+ # The request could enable biological harm, such as dangerous lab methods. Beneficial life sciences work can also trigger this category.
108
111
  BIO = :bio
112
+
113
+ # The request could assist the development of competing AI models, which is restricted under [Anthropic's commercial terms](https://www.anthropic.com/legal/commercial-terms). Benign machine learning work can also trigger this category.
109
114
  FRONTIER_LLM = :frontier_llm
115
+
116
+ # The request asks the model to reproduce its internal reasoning in the response text. To get reasoning in a structured form instead, use [adaptive thinking](https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking).
110
117
  REASONING_EXTRACTION = :reasoning_extraction
111
118
 
119
+ # The request could be related to an area that was determined as harmful. Benign work might sometimes trigger this category.
120
+ GENERAL_HARMS = :general_harms
121
+
112
122
  # @!method self.values
113
123
  # @return [Array<Symbol>]
114
124
  end
@@ -11,8 +11,8 @@ module Anthropic
11
11
  required :type, enum: -> { Anthropic::Beta::Sessions::BetaManagedAgentsSessionRetriesExhausted::Type }
12
12
 
13
13
  # @!method initialize(type:)
14
- # The turn ended because the retry budget was exhausted (`max_iterations` hit or
15
- # an error escalated to `retry_status: 'exhausted'`).
14
+ # The turn ended because repeated errors exhausted the retry budget or an error
15
+ # escalated to `retry_status: 'exhausted'`.
16
16
  #
17
17
  # @param type [Symbol, Anthropic::Models::Beta::Sessions::BetaManagedAgentsSessionRetriesExhausted::Type]
18
18
 
@@ -54,7 +54,7 @@ module Anthropic
54
54
  # The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running.
55
55
  variant :requires_action, -> { Anthropic::Beta::Sessions::BetaManagedAgentsSessionRequiresAction }
56
56
 
57
- # The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`).
57
+ # The turn ended because repeated errors exhausted the retry budget or an error escalated to `retry_status: 'exhausted'`.
58
58
  variant :retries_exhausted, -> { Anthropic::Beta::Sessions::BetaManagedAgentsSessionRetriesExhausted }
59
59
 
60
60
  # @!method self.variants
@@ -72,7 +72,7 @@ module Anthropic
72
72
  # The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running.
73
73
  variant :requires_action, -> { Anthropic::Beta::Sessions::BetaManagedAgentsSessionRequiresAction }
74
74
 
75
- # The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`).
75
+ # The turn ended because repeated errors exhausted the retry budget or an error escalated to `retry_status: 'exhausted'`.
76
76
  variant :retries_exhausted, -> { Anthropic::Beta::Sessions::BetaManagedAgentsSessionRetriesExhausted }
77
77
 
78
78
  # @!method self.variants
@@ -41,11 +41,21 @@ module Anthropic
41
41
  module Category
42
42
  extend Anthropic::Internal::Type::Enum
43
43
 
44
+ # The request could enable cyber harm, such as malware or exploit development. Benign cybersecurity work can also trigger this category.
44
45
  CYBER = :cyber
46
+
47
+ # The request could enable biological harm, such as dangerous lab methods. Beneficial life sciences work can also trigger this category.
45
48
  BIO = :bio
49
+
50
+ # The request could assist the development of competing AI models, which is restricted under [Anthropic's commercial terms](https://www.anthropic.com/legal/commercial-terms). Benign machine learning work can also trigger this category.
46
51
  FRONTIER_LLM = :frontier_llm
52
+
53
+ # The request asks the model to reproduce its internal reasoning in the response text. To get reasoning in a structured form instead, use [adaptive thinking](https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking).
47
54
  REASONING_EXTRACTION = :reasoning_extraction
48
55
 
56
+ # The request could be related to an area that was determined as harmful. Benign work might sometimes trigger this category.
57
+ GENERAL_HARMS = :general_harms
58
+
49
59
  # @!method self.values
50
60
  # @return [Array<Symbol>]
51
61
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Anthropic
4
- VERSION = "1.56.0"
4
+ VERSION = "1.56.1"
5
5
  end
@@ -334,6 +334,11 @@ module Anthropic
334
334
  private def write_query_param_element!(collection, key, element)
335
335
  end
336
336
 
337
+ # @api private
338
+ sig { params(element: T.anything).returns(String) }
339
+ private def query_param_string(element)
340
+ end
341
+
337
342
  # @api private
338
343
  sig do
339
344
  params(
@@ -71,27 +71,41 @@ module Anthropic
71
71
  end
72
72
  OrSymbol = T.type_alias { T.any(Symbol, String) }
73
73
 
74
+ # The request could enable cyber harm, such as malware or exploit development. Benign cybersecurity work can also trigger this category.
74
75
  CYBER =
75
76
  T.let(
76
77
  :cyber,
77
78
  Anthropic::Beta::BetaFallbackRefusalTrigger::Category::TaggedSymbol
78
79
  )
80
+
81
+ # The request could enable biological harm, such as dangerous lab methods. Beneficial life sciences work can also trigger this category.
79
82
  BIO =
80
83
  T.let(
81
84
  :bio,
82
85
  Anthropic::Beta::BetaFallbackRefusalTrigger::Category::TaggedSymbol
83
86
  )
87
+
88
+ # The request could assist the development of competing AI models, which is restricted under [Anthropic's commercial terms](https://www.anthropic.com/legal/commercial-terms). Benign machine learning work can also trigger this category.
84
89
  FRONTIER_LLM =
85
90
  T.let(
86
91
  :frontier_llm,
87
92
  Anthropic::Beta::BetaFallbackRefusalTrigger::Category::TaggedSymbol
88
93
  )
94
+
95
+ # The request asks the model to reproduce its internal reasoning in the response text. To get reasoning in a structured form instead, use [adaptive thinking](https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking).
89
96
  REASONING_EXTRACTION =
90
97
  T.let(
91
98
  :reasoning_extraction,
92
99
  Anthropic::Beta::BetaFallbackRefusalTrigger::Category::TaggedSymbol
93
100
  )
94
101
 
102
+ # The request could be related to an area that was determined as harmful. Benign work might sometimes trigger this category.
103
+ GENERAL_HARMS =
104
+ T.let(
105
+ :general_harms,
106
+ Anthropic::Beta::BetaFallbackRefusalTrigger::Category::TaggedSymbol
107
+ )
108
+
95
109
  sig do
96
110
  override.returns(
97
111
  T::Array[
@@ -182,27 +182,41 @@ module Anthropic
182
182
  end
183
183
  OrSymbol = T.type_alias { T.any(Symbol, String) }
184
184
 
185
+ # The request could enable cyber harm, such as malware or exploit development. Benign cybersecurity work can also trigger this category.
185
186
  CYBER =
186
187
  T.let(
187
188
  :cyber,
188
189
  Anthropic::Beta::BetaRefusalStopDetails::Category::TaggedSymbol
189
190
  )
191
+
192
+ # The request could enable biological harm, such as dangerous lab methods. Beneficial life sciences work can also trigger this category.
190
193
  BIO =
191
194
  T.let(
192
195
  :bio,
193
196
  Anthropic::Beta::BetaRefusalStopDetails::Category::TaggedSymbol
194
197
  )
198
+
199
+ # The request could assist the development of competing AI models, which is restricted under [Anthropic's commercial terms](https://www.anthropic.com/legal/commercial-terms). Benign machine learning work can also trigger this category.
195
200
  FRONTIER_LLM =
196
201
  T.let(
197
202
  :frontier_llm,
198
203
  Anthropic::Beta::BetaRefusalStopDetails::Category::TaggedSymbol
199
204
  )
205
+
206
+ # The request asks the model to reproduce its internal reasoning in the response text. To get reasoning in a structured form instead, use [adaptive thinking](https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking).
200
207
  REASONING_EXTRACTION =
201
208
  T.let(
202
209
  :reasoning_extraction,
203
210
  Anthropic::Beta::BetaRefusalStopDetails::Category::TaggedSymbol
204
211
  )
205
212
 
213
+ # The request could be related to an area that was determined as harmful. Benign work might sometimes trigger this category.
214
+ GENERAL_HARMS =
215
+ T.let(
216
+ :general_harms,
217
+ Anthropic::Beta::BetaRefusalStopDetails::Category::TaggedSymbol
218
+ )
219
+
206
220
  sig do
207
221
  override.returns(
208
222
  T::Array[
@@ -20,8 +20,8 @@ module Anthropic
20
20
  end
21
21
  attr_accessor :type
22
22
 
23
- # The turn ended because the retry budget was exhausted (`max_iterations` hit or
24
- # an error escalated to `retry_status: 'exhausted'`).
23
+ # The turn ended because repeated errors exhausted the retry budget or an error
24
+ # escalated to `retry_status: 'exhausted'`.
25
25
  sig do
26
26
  params(
27
27
  type:
@@ -70,20 +70,34 @@ module Anthropic
70
70
  end
71
71
  OrSymbol = T.type_alias { T.any(Symbol, String) }
72
72
 
73
+ # The request could enable cyber harm, such as malware or exploit development. Benign cybersecurity work can also trigger this category.
73
74
  CYBER =
74
75
  T.let(:cyber, Anthropic::RefusalStopDetails::Category::TaggedSymbol)
76
+
77
+ # The request could enable biological harm, such as dangerous lab methods. Beneficial life sciences work can also trigger this category.
75
78
  BIO = T.let(:bio, Anthropic::RefusalStopDetails::Category::TaggedSymbol)
79
+
80
+ # The request could assist the development of competing AI models, which is restricted under [Anthropic's commercial terms](https://www.anthropic.com/legal/commercial-terms). Benign machine learning work can also trigger this category.
76
81
  FRONTIER_LLM =
77
82
  T.let(
78
83
  :frontier_llm,
79
84
  Anthropic::RefusalStopDetails::Category::TaggedSymbol
80
85
  )
86
+
87
+ # The request asks the model to reproduce its internal reasoning in the response text. To get reasoning in a structured form instead, use [adaptive thinking](https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking).
81
88
  REASONING_EXTRACTION =
82
89
  T.let(
83
90
  :reasoning_extraction,
84
91
  Anthropic::RefusalStopDetails::Category::TaggedSymbol
85
92
  )
86
93
 
94
+ # The request could be related to an area that was determined as harmful. Benign work might sometimes trigger this category.
95
+ GENERAL_HARMS =
96
+ T.let(
97
+ :general_harms,
98
+ Anthropic::RefusalStopDetails::Category::TaggedSymbol
99
+ )
100
+
87
101
  sig do
88
102
  override.returns(
89
103
  T::Array[Anthropic::RefusalStopDetails::Category::TaggedSymbol]
@@ -122,6 +122,8 @@ module Anthropic
122
122
  top element
123
123
  ) -> nil
124
124
 
125
+ private def query_param_string: (top element) -> String
126
+
125
127
  def self?.write_multipart_content: (
126
128
  Enumerator::Yielder y,
127
129
  val: top,
@@ -24,16 +24,27 @@ module Anthropic
24
24
  type: :refusal
25
25
  }
26
26
 
27
- type category = :cyber | :bio | :frontier_llm | :reasoning_extraction
27
+ type category =
28
+ :cyber | :bio | :frontier_llm | :reasoning_extraction | :general_harms
28
29
 
29
30
  module Category
30
31
  extend Anthropic::Internal::Type::Enum
31
32
 
33
+ # The request could enable cyber harm, such as malware or exploit development. Benign cybersecurity work can also trigger this category.
32
34
  CYBER: :cyber
35
+
36
+ # The request could enable biological harm, such as dangerous lab methods. Beneficial life sciences work can also trigger this category.
33
37
  BIO: :bio
38
+
39
+ # The request could assist the development of competing AI models, which is restricted under [Anthropic's commercial terms](https://www.anthropic.com/legal/commercial-terms). Benign machine learning work can also trigger this category.
34
40
  FRONTIER_LLM: :frontier_llm
41
+
42
+ # The request asks the model to reproduce its internal reasoning in the response text. To get reasoning in a structured form instead, use [adaptive thinking](https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking).
35
43
  REASONING_EXTRACTION: :reasoning_extraction
36
44
 
45
+ # The request could be related to an area that was determined as harmful. Benign work might sometimes trigger this category.
46
+ GENERAL_HARMS: :general_harms
47
+
37
48
  def self?.values: -> ::Array[Anthropic::Models::Beta::BetaFallbackRefusalTrigger::category]
38
49
  end
39
50
  end
@@ -44,16 +44,27 @@ module Anthropic
44
44
  type: :refusal
45
45
  }
46
46
 
47
- type category = :cyber | :bio | :frontier_llm | :reasoning_extraction
47
+ type category =
48
+ :cyber | :bio | :frontier_llm | :reasoning_extraction | :general_harms
48
49
 
49
50
  module Category
50
51
  extend Anthropic::Internal::Type::Enum
51
52
 
53
+ # The request could enable cyber harm, such as malware or exploit development. Benign cybersecurity work can also trigger this category.
52
54
  CYBER: :cyber
55
+
56
+ # The request could enable biological harm, such as dangerous lab methods. Beneficial life sciences work can also trigger this category.
53
57
  BIO: :bio
58
+
59
+ # The request could assist the development of competing AI models, which is restricted under [Anthropic's commercial terms](https://www.anthropic.com/legal/commercial-terms). Benign machine learning work can also trigger this category.
54
60
  FRONTIER_LLM: :frontier_llm
61
+
62
+ # The request asks the model to reproduce its internal reasoning in the response text. To get reasoning in a structured form instead, use [adaptive thinking](https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking).
55
63
  REASONING_EXTRACTION: :reasoning_extraction
56
64
 
65
+ # The request could be related to an area that was determined as harmful. Benign work might sometimes trigger this category.
66
+ GENERAL_HARMS: :general_harms
67
+
57
68
  def self?.values: -> ::Array[Anthropic::Models::Beta::BetaRefusalStopDetails::category]
58
69
  end
59
70
  end
@@ -26,16 +26,27 @@ module Anthropic
26
26
  type: :refusal
27
27
  }
28
28
 
29
- type category = :cyber | :bio | :frontier_llm | :reasoning_extraction
29
+ type category =
30
+ :cyber | :bio | :frontier_llm | :reasoning_extraction | :general_harms
30
31
 
31
32
  module Category
32
33
  extend Anthropic::Internal::Type::Enum
33
34
 
35
+ # The request could enable cyber harm, such as malware or exploit development. Benign cybersecurity work can also trigger this category.
34
36
  CYBER: :cyber
37
+
38
+ # The request could enable biological harm, such as dangerous lab methods. Beneficial life sciences work can also trigger this category.
35
39
  BIO: :bio
40
+
41
+ # The request could assist the development of competing AI models, which is restricted under [Anthropic's commercial terms](https://www.anthropic.com/legal/commercial-terms). Benign machine learning work can also trigger this category.
36
42
  FRONTIER_LLM: :frontier_llm
43
+
44
+ # The request asks the model to reproduce its internal reasoning in the response text. To get reasoning in a structured form instead, use [adaptive thinking](https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking).
37
45
  REASONING_EXTRACTION: :reasoning_extraction
38
46
 
47
+ # The request could be related to an area that was determined as harmful. Benign work might sometimes trigger this category.
48
+ GENERAL_HARMS: :general_harms
49
+
39
50
  def self?.values: -> ::Array[Anthropic::Models::RefusalStopDetails::category]
40
51
  end
41
52
  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.56.0
4
+ version: 1.56.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anthropic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-07-16 00:00:00.000000000 Z
11
+ date: 2026-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cgi