anthropic 1.5.0 → 1.7.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 +4 -4
- data/CHANGELOG.md +29 -0
- data/README.md +1 -1
- data/lib/anthropic/internal/type/array_of.rb +1 -0
- data/lib/anthropic/internal/type/base_model.rb +3 -1
- data/lib/anthropic/internal/type/converter.rb +27 -0
- data/lib/anthropic/internal/type/hash_of.rb +1 -0
- data/lib/anthropic/internal/type/union.rb +9 -7
- data/lib/anthropic/models/anthropic_beta.rb +3 -0
- data/lib/anthropic/models/cache_control_ephemeral.rb +39 -1
- data/lib/anthropic/models/cache_creation.rb +24 -0
- data/lib/anthropic/models/model.rb +6 -0
- data/lib/anthropic/models/usage.rb +9 -1
- data/lib/anthropic/models.rb +2 -0
- data/lib/anthropic/version.rb +1 -1
- data/lib/anthropic.rb +1 -0
- data/rbi/anthropic/internal/type/converter.rbi +54 -0
- data/rbi/anthropic/internal/type/union.rbi +9 -2
- data/rbi/anthropic/models/anthropic_beta.rbi +2 -0
- data/rbi/anthropic/models/cache_control_ephemeral.rbi +68 -3
- data/rbi/anthropic/models/cache_creation.rbi +45 -0
- data/rbi/anthropic/models/usage.rbi +13 -0
- data/rbi/anthropic/models.rbi +2 -0
- data/sig/anthropic/internal/type/converter.rbs +17 -0
- data/sig/anthropic/internal/type/union.rbs +2 -2
- data/sig/anthropic/models/anthropic_beta.rbs +2 -0
- data/sig/anthropic/models/cache_control_ephemeral.rbs +27 -3
- data/sig/anthropic/models/cache_creation.rbs +25 -0
- data/sig/anthropic/models/usage.rbs +5 -0
- data/sig/anthropic/models.rbs +2 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 66fd9539680e78df8e330ac6a5c6efc4848f35c6878eb56ef0b491511562ecf1
|
4
|
+
data.tar.gz: 43ef2cdd7fd4f7d95d889115dbf302edb8355681283aec9b76f80f7b1734ee67
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55fb0db67745e8506eb2a2ae9708908cf72f1f16eb795d1a4279962864d25e5f972b3be3f53cdacb0293ef17c9c8e84a65643158604c1e50de28fc44aaa7e494
|
7
|
+
data.tar.gz: 1d479ce6f1b913816cf60d1778f039d874ce701077d1ed6187c9df5e7ba3ce0254da280753c55607343b64ef62aae72c72540a3e28ce5de49a7117b14e326bca
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,34 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 1.7.0 (2025-08-13)
|
4
|
+
|
5
|
+
Full Changelog: [v1.6.0...v1.7.0](https://github.com/anthropics/anthropic-sdk-ruby/compare/v1.6.0...v1.7.0)
|
6
|
+
|
7
|
+
### Features
|
8
|
+
|
9
|
+
* **api:** makes 1 hour TTL Cache Control generally available ([c2dbf3b](https://github.com/anthropics/anthropic-sdk-ruby/commit/c2dbf3bcc3137b53db4d0a5779a014d4c59609bc))
|
10
|
+
|
11
|
+
|
12
|
+
### Chores
|
13
|
+
|
14
|
+
* deprecate older claude-3-5 sonnet models ([#679](https://github.com/anthropics/anthropic-sdk-ruby/issues/679)) ([4a3fb20](https://github.com/anthropics/anthropic-sdk-ruby/commit/4a3fb2042b20ca34346e2fa914c77713e664b922))
|
15
|
+
|
16
|
+
## 1.6.0 (2025-08-12)
|
17
|
+
|
18
|
+
Full Changelog: [v1.5.0...v1.6.0](https://github.com/anthropics/anthropic-sdk-ruby/compare/v1.5.0...v1.6.0)
|
19
|
+
|
20
|
+
### Features
|
21
|
+
|
22
|
+
* **betas:** add context-1m-2025-08-07 ([5bb5064](https://github.com/anthropics/anthropic-sdk-ruby/commit/5bb506416852bcd0c893c643831ec6e52a2cc79d))
|
23
|
+
|
24
|
+
|
25
|
+
### Chores
|
26
|
+
|
27
|
+
* collect metadata from type DSL ([69114b1](https://github.com/anthropics/anthropic-sdk-ruby/commit/69114b159e3710c467cbb7c55b8b7526cb5ea8e7))
|
28
|
+
* **internal:** update comment in script ([c5bd3b1](https://github.com/anthropics/anthropic-sdk-ruby/commit/c5bd3b144ad399c114e644437820a8785e7399f0))
|
29
|
+
* **internal:** update test skipping reason ([6d7c586](https://github.com/anthropics/anthropic-sdk-ruby/commit/6d7c58606a88e6a34b16f19006e44dbf17d657c0))
|
30
|
+
* update @stainless-api/prism-cli to v5.15.0 ([356427c](https://github.com/anthropics/anthropic-sdk-ruby/commit/356427c4ec83d134dbcccdf27915eee65e5e8daa))
|
31
|
+
|
3
32
|
## 1.5.0 (2025-08-08)
|
4
33
|
|
5
34
|
Full Changelog: [v1.4.1...v1.5.0](https://github.com/anthropics/anthropic-sdk-ruby/compare/v1.4.1...v1.5.0)
|
data/README.md
CHANGED
@@ -148,6 +148,7 @@ module Anthropic
|
|
148
148
|
# @option spec [Boolean] :"nil?"
|
149
149
|
def initialize(type_info, spec = {})
|
150
150
|
@item_type_fn = Anthropic::Internal::Type::Converter.type_info(type_info || spec)
|
151
|
+
@meta = Anthropic::Internal::Type::Converter.meta_info(type_info, spec)
|
151
152
|
@nilable = spec.fetch(:nil?, false)
|
152
153
|
end
|
153
154
|
|
@@ -52,6 +52,7 @@ module Anthropic
|
|
52
52
|
#
|
53
53
|
# @option spec [Boolean] :"nil?"
|
54
54
|
private def add_field(name_sym, required:, type_info:, spec:)
|
55
|
+
meta = Anthropic::Internal::Type::Converter.meta_info(type_info, spec)
|
55
56
|
type_fn, info =
|
56
57
|
case type_info
|
57
58
|
in Proc | Anthropic::Internal::Type::Converter | Class
|
@@ -81,7 +82,8 @@ module Anthropic
|
|
81
82
|
required: required,
|
82
83
|
nilable: nilable,
|
83
84
|
const: const,
|
84
|
-
type_fn: type_fn
|
85
|
+
type_fn: type_fn,
|
86
|
+
meta: meta
|
85
87
|
}
|
86
88
|
|
87
89
|
define_method(setter) do |value|
|
@@ -98,6 +98,33 @@ module Anthropic
|
|
98
98
|
end
|
99
99
|
end
|
100
100
|
|
101
|
+
# @api private
|
102
|
+
#
|
103
|
+
# @param type_info [Hash{Symbol=>Object}, Proc, Anthropic::Internal::Type::Converter, Class] .
|
104
|
+
#
|
105
|
+
# @option type_info [NilClass, TrueClass, FalseClass, Integer, Float, Symbol] :const
|
106
|
+
#
|
107
|
+
# @option type_info [Proc] :enum
|
108
|
+
#
|
109
|
+
# @option type_info [Proc] :union
|
110
|
+
#
|
111
|
+
# @option type_info [Boolean] :"nil?"
|
112
|
+
#
|
113
|
+
# @param spec [Hash{Symbol=>Object}, Proc, Anthropic::Internal::Type::Converter, Class] .
|
114
|
+
#
|
115
|
+
# @option spec [NilClass, TrueClass, FalseClass, Integer, Float, Symbol] :const
|
116
|
+
#
|
117
|
+
# @option spec [Proc] :enum
|
118
|
+
#
|
119
|
+
# @option spec [Proc] :union
|
120
|
+
#
|
121
|
+
# @option spec [Boolean] :"nil?"
|
122
|
+
#
|
123
|
+
# @return [Hash{Symbol=>Object}]
|
124
|
+
def meta_info(type_info, spec)
|
125
|
+
[spec, type_info].grep(Hash).first.to_h.except(:const, :enum, :union, :nil?)
|
126
|
+
end
|
127
|
+
|
101
128
|
# @api private
|
102
129
|
#
|
103
130
|
# @param translate_names [Boolean]
|
@@ -168,6 +168,7 @@ module Anthropic
|
|
168
168
|
# @option spec [Boolean] :"nil?"
|
169
169
|
def initialize(type_info, spec = {})
|
170
170
|
@item_type_fn = Anthropic::Internal::Type::Converter.type_info(type_info || spec)
|
171
|
+
@meta = Anthropic::Internal::Type::Converter.meta_info(type_info, spec)
|
171
172
|
@nilable = spec.fetch(:nil?, false)
|
172
173
|
end
|
173
174
|
|
@@ -37,20 +37,20 @@ module Anthropic
|
|
37
37
|
#
|
38
38
|
# All of the specified variant info for this union.
|
39
39
|
#
|
40
|
-
# @return [Array<Array(Symbol, Proc)>]
|
40
|
+
# @return [Array<Array(Symbol, Proc, Hash{Symbol=>Object})>]
|
41
41
|
private def known_variants = (@known_variants ||= [])
|
42
42
|
|
43
43
|
# @api private
|
44
44
|
#
|
45
|
-
# @return [Array<Array(Symbol, Object)>]
|
45
|
+
# @return [Array<Array(Symbol, Object, Hash{Symbol=>Object})>]
|
46
46
|
protected def derefed_variants
|
47
|
-
known_variants.map { |key, variant_fn| [key, variant_fn.call] }
|
47
|
+
known_variants.map { |key, variant_fn, meta| [key, variant_fn.call, meta] }
|
48
48
|
end
|
49
49
|
|
50
50
|
# All of the specified variants for this union.
|
51
51
|
#
|
52
52
|
# @return [Array<Object>]
|
53
|
-
def variants = derefed_variants.map
|
53
|
+
def variants = derefed_variants.map { _2 }
|
54
54
|
|
55
55
|
# @api private
|
56
56
|
#
|
@@ -76,12 +76,13 @@ module Anthropic
|
|
76
76
|
#
|
77
77
|
# @option spec [Boolean] :"nil?"
|
78
78
|
private def variant(key, spec = nil)
|
79
|
+
meta = Anthropic::Internal::Type::Converter.meta_info(nil, spec)
|
79
80
|
variant_info =
|
80
81
|
case key
|
81
82
|
in Symbol
|
82
|
-
[key, Anthropic::Internal::Type::Converter.type_info(spec)]
|
83
|
+
[key, Anthropic::Internal::Type::Converter.type_info(spec), meta]
|
83
84
|
in Proc | Anthropic::Internal::Type::Converter | Class | Hash
|
84
|
-
[nil, Anthropic::Internal::Type::Converter.type_info(key)]
|
85
|
+
[nil, Anthropic::Internal::Type::Converter.type_info(key), meta]
|
85
86
|
end
|
86
87
|
|
87
88
|
known_variants << variant_info
|
@@ -104,7 +105,8 @@ module Anthropic
|
|
104
105
|
return nil if key == Anthropic::Internal::OMIT
|
105
106
|
|
106
107
|
key = key.to_sym if key.is_a?(String)
|
107
|
-
known_variants.find { |k,| k == key }
|
108
|
+
_, found = known_variants.find { |k,| k == key }
|
109
|
+
found&.call
|
108
110
|
else
|
109
111
|
nil
|
110
112
|
end
|
@@ -35,6 +35,8 @@ module Anthropic
|
|
35
35
|
|
36
36
|
variant const: -> { Anthropic::Models::AnthropicBeta::EXTENDED_CACHE_TTL_2025_04_11 }
|
37
37
|
|
38
|
+
variant const: -> { Anthropic::Models::AnthropicBeta::CONTEXT_1M_2025_08_07 }
|
39
|
+
|
38
40
|
# @!method self.variants
|
39
41
|
# @return [Array(String, Symbol)]
|
40
42
|
|
@@ -58,6 +60,7 @@ module Anthropic
|
|
58
60
|
INTERLEAVED_THINKING_2025_05_14 = :"interleaved-thinking-2025-05-14"
|
59
61
|
CODE_EXECUTION_2025_05_22 = :"code-execution-2025-05-22"
|
60
62
|
EXTENDED_CACHE_TTL_2025_04_11 = :"extended-cache-ttl-2025-04-11"
|
63
|
+
CONTEXT_1M_2025_08_07 = :"context-1m-2025-08-07"
|
61
64
|
|
62
65
|
# @!endgroup
|
63
66
|
end
|
@@ -8,8 +8,46 @@ module Anthropic
|
|
8
8
|
# @return [Symbol, :ephemeral]
|
9
9
|
required :type, const: :ephemeral
|
10
10
|
|
11
|
-
# @!
|
11
|
+
# @!attribute ttl
|
12
|
+
# The time-to-live for the cache control breakpoint.
|
13
|
+
#
|
14
|
+
# This may be one the following values:
|
15
|
+
#
|
16
|
+
# - `5m`: 5 minutes
|
17
|
+
# - `1h`: 1 hour
|
18
|
+
#
|
19
|
+
# Defaults to `5m`.
|
20
|
+
#
|
21
|
+
# @return [Symbol, Anthropic::Models::CacheControlEphemeral::TTL, nil]
|
22
|
+
optional :ttl, enum: -> { Anthropic::CacheControlEphemeral::TTL }
|
23
|
+
|
24
|
+
# @!method initialize(ttl: nil, type: :ephemeral)
|
25
|
+
# Some parameter documentations has been truncated, see
|
26
|
+
# {Anthropic::Models::CacheControlEphemeral} for more details.
|
27
|
+
#
|
28
|
+
# @param ttl [Symbol, Anthropic::Models::CacheControlEphemeral::TTL] The time-to-live for the cache control breakpoint.
|
29
|
+
#
|
12
30
|
# @param type [Symbol, :ephemeral]
|
31
|
+
|
32
|
+
# The time-to-live for the cache control breakpoint.
|
33
|
+
#
|
34
|
+
# This may be one the following values:
|
35
|
+
#
|
36
|
+
# - `5m`: 5 minutes
|
37
|
+
# - `1h`: 1 hour
|
38
|
+
#
|
39
|
+
# Defaults to `5m`.
|
40
|
+
#
|
41
|
+
# @see Anthropic::Models::CacheControlEphemeral#ttl
|
42
|
+
module TTL
|
43
|
+
extend Anthropic::Internal::Type::Enum
|
44
|
+
|
45
|
+
TTL_5M = :"5m"
|
46
|
+
TTL_1H = :"1h"
|
47
|
+
|
48
|
+
# @!method self.values
|
49
|
+
# @return [Array<Symbol>]
|
50
|
+
end
|
13
51
|
end
|
14
52
|
end
|
15
53
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Anthropic
|
4
|
+
module Models
|
5
|
+
class CacheCreation < Anthropic::Internal::Type::BaseModel
|
6
|
+
# @!attribute ephemeral_1h_input_tokens
|
7
|
+
# The number of input tokens used to create the 1 hour cache entry.
|
8
|
+
#
|
9
|
+
# @return [Integer]
|
10
|
+
required :ephemeral_1h_input_tokens, Integer
|
11
|
+
|
12
|
+
# @!attribute ephemeral_5m_input_tokens
|
13
|
+
# The number of input tokens used to create the 5 minute cache entry.
|
14
|
+
#
|
15
|
+
# @return [Integer]
|
16
|
+
required :ephemeral_5m_input_tokens, Integer
|
17
|
+
|
18
|
+
# @!method initialize(ephemeral_1h_input_tokens:, ephemeral_5m_input_tokens:)
|
19
|
+
# @param ephemeral_1h_input_tokens [Integer] The number of input tokens used to create the 1 hour cache entry.
|
20
|
+
#
|
21
|
+
# @param ephemeral_5m_input_tokens [Integer] The number of input tokens used to create the 5 minute cache entry.
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -78,8 +78,14 @@ module Anthropic
|
|
78
78
|
CLAUDE_3_5_SONNET_LATEST = :"claude-3-5-sonnet-latest"
|
79
79
|
|
80
80
|
# Our previous most intelligent model
|
81
|
+
# @deprecated Will reach end-of-life on October 22, 2025. Please migrate to a newer model.
|
82
|
+
# Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more
|
83
|
+
# information.
|
81
84
|
CLAUDE_3_5_SONNET_20241022 = :"claude-3-5-sonnet-20241022"
|
82
85
|
|
86
|
+
# @deprecated Will reach end-of-life on October 22, 2025. Please migrate to a newer model.
|
87
|
+
# Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more
|
88
|
+
# information.
|
83
89
|
CLAUDE_3_5_SONNET_20240620 = :"claude-3-5-sonnet-20240620"
|
84
90
|
|
85
91
|
# Our most capable model
|
@@ -3,6 +3,12 @@
|
|
3
3
|
module Anthropic
|
4
4
|
module Models
|
5
5
|
class Usage < Anthropic::Internal::Type::BaseModel
|
6
|
+
# @!attribute cache_creation
|
7
|
+
# Breakdown of cached tokens by TTL
|
8
|
+
#
|
9
|
+
# @return [Anthropic::Models::CacheCreation, nil]
|
10
|
+
required :cache_creation, -> { Anthropic::CacheCreation }, nil?: true
|
11
|
+
|
6
12
|
# @!attribute cache_creation_input_tokens
|
7
13
|
# The number of input tokens used to create the cache entry.
|
8
14
|
#
|
@@ -39,7 +45,9 @@ module Anthropic
|
|
39
45
|
# @return [Symbol, Anthropic::Models::Usage::ServiceTier, nil]
|
40
46
|
required :service_tier, enum: -> { Anthropic::Usage::ServiceTier }, nil?: true
|
41
47
|
|
42
|
-
# @!method initialize(cache_creation_input_tokens:, cache_read_input_tokens:, input_tokens:, output_tokens:, server_tool_use:, service_tier:)
|
48
|
+
# @!method initialize(cache_creation:, cache_creation_input_tokens:, cache_read_input_tokens:, input_tokens:, output_tokens:, server_tool_use:, service_tier:)
|
49
|
+
# @param cache_creation [Anthropic::Models::CacheCreation, nil] Breakdown of cached tokens by TTL
|
50
|
+
#
|
43
51
|
# @param cache_creation_input_tokens [Integer, nil] The number of input tokens used to create the cache entry.
|
44
52
|
#
|
45
53
|
# @param cache_read_input_tokens [Integer, nil] The number of input tokens read from the cache.
|
data/lib/anthropic/models.rb
CHANGED
@@ -77,6 +77,8 @@ module Anthropic
|
|
77
77
|
|
78
78
|
CacheControlEphemeral = Anthropic::Models::CacheControlEphemeral
|
79
79
|
|
80
|
+
CacheCreation = Anthropic::Models::CacheCreation
|
81
|
+
|
80
82
|
CitationCharLocation = Anthropic::Models::CitationCharLocation
|
81
83
|
|
82
84
|
CitationCharLocationParam = Anthropic::Models::CitationCharLocationParam
|
data/lib/anthropic/version.rb
CHANGED
data/lib/anthropic.rb
CHANGED
@@ -214,6 +214,7 @@ require_relative "anthropic/models/beta_permission_error"
|
|
214
214
|
require_relative "anthropic/models/beta_rate_limit_error"
|
215
215
|
require_relative "anthropic/models/billing_error"
|
216
216
|
require_relative "anthropic/models/cache_control_ephemeral"
|
217
|
+
require_relative "anthropic/models/cache_creation"
|
217
218
|
require_relative "anthropic/models/citation_char_location"
|
218
219
|
require_relative "anthropic/models/citation_char_location_param"
|
219
220
|
require_relative "anthropic/models/citation_content_block_location"
|
@@ -90,6 +90,60 @@ module Anthropic
|
|
90
90
|
def self.type_info(spec)
|
91
91
|
end
|
92
92
|
|
93
|
+
# @api private
|
94
|
+
sig do
|
95
|
+
params(
|
96
|
+
type_info:
|
97
|
+
T.any(
|
98
|
+
{
|
99
|
+
const:
|
100
|
+
T.nilable(
|
101
|
+
T.any(NilClass, T::Boolean, Integer, Float, Symbol)
|
102
|
+
),
|
103
|
+
enum:
|
104
|
+
T.nilable(
|
105
|
+
T.proc.returns(
|
106
|
+
Anthropic::Internal::Type::Converter::Input
|
107
|
+
)
|
108
|
+
),
|
109
|
+
union:
|
110
|
+
T.nilable(
|
111
|
+
T.proc.returns(
|
112
|
+
Anthropic::Internal::Type::Converter::Input
|
113
|
+
)
|
114
|
+
)
|
115
|
+
},
|
116
|
+
T.proc.returns(Anthropic::Internal::Type::Converter::Input),
|
117
|
+
Anthropic::Internal::Type::Converter::Input
|
118
|
+
),
|
119
|
+
spec:
|
120
|
+
T.any(
|
121
|
+
{
|
122
|
+
const:
|
123
|
+
T.nilable(
|
124
|
+
T.any(NilClass, T::Boolean, Integer, Float, Symbol)
|
125
|
+
),
|
126
|
+
enum:
|
127
|
+
T.nilable(
|
128
|
+
T.proc.returns(
|
129
|
+
Anthropic::Internal::Type::Converter::Input
|
130
|
+
)
|
131
|
+
),
|
132
|
+
union:
|
133
|
+
T.nilable(
|
134
|
+
T.proc.returns(
|
135
|
+
Anthropic::Internal::Type::Converter::Input
|
136
|
+
)
|
137
|
+
)
|
138
|
+
},
|
139
|
+
T.proc.returns(Anthropic::Internal::Type::Converter::Input),
|
140
|
+
Anthropic::Internal::Type::Converter::Input
|
141
|
+
)
|
142
|
+
).returns(Anthropic::Internal::AnyHash)
|
143
|
+
end
|
144
|
+
def self.meta_info(type_info, spec)
|
145
|
+
end
|
146
|
+
|
93
147
|
# @api private
|
94
148
|
sig do
|
95
149
|
params(translate_names: T::Boolean).returns(
|
@@ -16,7 +16,8 @@ module Anthropic
|
|
16
16
|
T::Array[
|
17
17
|
[
|
18
18
|
T.nilable(Symbol),
|
19
|
-
T.proc.returns(Anthropic::Internal::Type::Converter::Input)
|
19
|
+
T.proc.returns(Anthropic::Internal::Type::Converter::Input),
|
20
|
+
Anthropic::Internal::AnyHash
|
20
21
|
]
|
21
22
|
]
|
22
23
|
)
|
@@ -25,7 +26,13 @@ module Anthropic
|
|
25
26
|
end
|
26
27
|
|
27
28
|
# @api private
|
28
|
-
sig
|
29
|
+
sig do
|
30
|
+
returns(
|
31
|
+
T::Array[
|
32
|
+
[T.nilable(Symbol), T.anything, Anthropic::Internal::AnyHash]
|
33
|
+
]
|
34
|
+
)
|
35
|
+
end
|
29
36
|
protected def derefed_variants
|
30
37
|
end
|
31
38
|
|
@@ -11,13 +11,78 @@ module Anthropic
|
|
11
11
|
sig { returns(Symbol) }
|
12
12
|
attr_accessor :type
|
13
13
|
|
14
|
-
|
15
|
-
|
14
|
+
# The time-to-live for the cache control breakpoint.
|
15
|
+
#
|
16
|
+
# This may be one the following values:
|
17
|
+
#
|
18
|
+
# - `5m`: 5 minutes
|
19
|
+
# - `1h`: 1 hour
|
20
|
+
#
|
21
|
+
# Defaults to `5m`.
|
22
|
+
sig do
|
23
|
+
returns(T.nilable(Anthropic::CacheControlEphemeral::TTL::OrSymbol))
|
16
24
|
end
|
25
|
+
attr_reader :ttl
|
17
26
|
|
18
|
-
sig {
|
27
|
+
sig { params(ttl: Anthropic::CacheControlEphemeral::TTL::OrSymbol).void }
|
28
|
+
attr_writer :ttl
|
29
|
+
|
30
|
+
sig do
|
31
|
+
params(
|
32
|
+
ttl: Anthropic::CacheControlEphemeral::TTL::OrSymbol,
|
33
|
+
type: Symbol
|
34
|
+
).returns(T.attached_class)
|
35
|
+
end
|
36
|
+
def self.new(
|
37
|
+
# The time-to-live for the cache control breakpoint.
|
38
|
+
#
|
39
|
+
# This may be one the following values:
|
40
|
+
#
|
41
|
+
# - `5m`: 5 minutes
|
42
|
+
# - `1h`: 1 hour
|
43
|
+
#
|
44
|
+
# Defaults to `5m`.
|
45
|
+
ttl: nil,
|
46
|
+
type: :ephemeral
|
47
|
+
)
|
48
|
+
end
|
49
|
+
|
50
|
+
sig do
|
51
|
+
override.returns(
|
52
|
+
{ type: Symbol, ttl: Anthropic::CacheControlEphemeral::TTL::OrSymbol }
|
53
|
+
)
|
54
|
+
end
|
19
55
|
def to_hash
|
20
56
|
end
|
57
|
+
|
58
|
+
# The time-to-live for the cache control breakpoint.
|
59
|
+
#
|
60
|
+
# This may be one the following values:
|
61
|
+
#
|
62
|
+
# - `5m`: 5 minutes
|
63
|
+
# - `1h`: 1 hour
|
64
|
+
#
|
65
|
+
# Defaults to `5m`.
|
66
|
+
module TTL
|
67
|
+
extend Anthropic::Internal::Type::Enum
|
68
|
+
|
69
|
+
TaggedSymbol =
|
70
|
+
T.type_alias { T.all(Symbol, Anthropic::CacheControlEphemeral::TTL) }
|
71
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
72
|
+
|
73
|
+
TTL_5M =
|
74
|
+
T.let(:"5m", Anthropic::CacheControlEphemeral::TTL::TaggedSymbol)
|
75
|
+
TTL_1H =
|
76
|
+
T.let(:"1h", Anthropic::CacheControlEphemeral::TTL::TaggedSymbol)
|
77
|
+
|
78
|
+
sig do
|
79
|
+
override.returns(
|
80
|
+
T::Array[Anthropic::CacheControlEphemeral::TTL::TaggedSymbol]
|
81
|
+
)
|
82
|
+
end
|
83
|
+
def self.values
|
84
|
+
end
|
85
|
+
end
|
21
86
|
end
|
22
87
|
end
|
23
88
|
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module Anthropic
|
4
|
+
module Models
|
5
|
+
class CacheCreation < Anthropic::Internal::Type::BaseModel
|
6
|
+
OrHash =
|
7
|
+
T.type_alias do
|
8
|
+
T.any(Anthropic::CacheCreation, Anthropic::Internal::AnyHash)
|
9
|
+
end
|
10
|
+
|
11
|
+
# The number of input tokens used to create the 1 hour cache entry.
|
12
|
+
sig { returns(Integer) }
|
13
|
+
attr_accessor :ephemeral_1h_input_tokens
|
14
|
+
|
15
|
+
# The number of input tokens used to create the 5 minute cache entry.
|
16
|
+
sig { returns(Integer) }
|
17
|
+
attr_accessor :ephemeral_5m_input_tokens
|
18
|
+
|
19
|
+
sig do
|
20
|
+
params(
|
21
|
+
ephemeral_1h_input_tokens: Integer,
|
22
|
+
ephemeral_5m_input_tokens: Integer
|
23
|
+
).returns(T.attached_class)
|
24
|
+
end
|
25
|
+
def self.new(
|
26
|
+
# The number of input tokens used to create the 1 hour cache entry.
|
27
|
+
ephemeral_1h_input_tokens:,
|
28
|
+
# The number of input tokens used to create the 5 minute cache entry.
|
29
|
+
ephemeral_5m_input_tokens:
|
30
|
+
)
|
31
|
+
end
|
32
|
+
|
33
|
+
sig do
|
34
|
+
override.returns(
|
35
|
+
{
|
36
|
+
ephemeral_1h_input_tokens: Integer,
|
37
|
+
ephemeral_5m_input_tokens: Integer
|
38
|
+
}
|
39
|
+
)
|
40
|
+
end
|
41
|
+
def to_hash
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -6,6 +6,15 @@ module Anthropic
|
|
6
6
|
OrHash =
|
7
7
|
T.type_alias { T.any(Anthropic::Usage, Anthropic::Internal::AnyHash) }
|
8
8
|
|
9
|
+
# Breakdown of cached tokens by TTL
|
10
|
+
sig { returns(T.nilable(Anthropic::CacheCreation)) }
|
11
|
+
attr_reader :cache_creation
|
12
|
+
|
13
|
+
sig do
|
14
|
+
params(cache_creation: T.nilable(Anthropic::CacheCreation::OrHash)).void
|
15
|
+
end
|
16
|
+
attr_writer :cache_creation
|
17
|
+
|
9
18
|
# The number of input tokens used to create the cache entry.
|
10
19
|
sig { returns(T.nilable(Integer)) }
|
11
20
|
attr_accessor :cache_creation_input_tokens
|
@@ -39,6 +48,7 @@ module Anthropic
|
|
39
48
|
|
40
49
|
sig do
|
41
50
|
params(
|
51
|
+
cache_creation: T.nilable(Anthropic::CacheCreation::OrHash),
|
42
52
|
cache_creation_input_tokens: T.nilable(Integer),
|
43
53
|
cache_read_input_tokens: T.nilable(Integer),
|
44
54
|
input_tokens: Integer,
|
@@ -48,6 +58,8 @@ module Anthropic
|
|
48
58
|
).returns(T.attached_class)
|
49
59
|
end
|
50
60
|
def self.new(
|
61
|
+
# Breakdown of cached tokens by TTL
|
62
|
+
cache_creation:,
|
51
63
|
# The number of input tokens used to create the cache entry.
|
52
64
|
cache_creation_input_tokens:,
|
53
65
|
# The number of input tokens read from the cache.
|
@@ -66,6 +78,7 @@ module Anthropic
|
|
66
78
|
sig do
|
67
79
|
override.returns(
|
68
80
|
{
|
81
|
+
cache_creation: T.nilable(Anthropic::CacheCreation),
|
69
82
|
cache_creation_input_tokens: T.nilable(Integer),
|
70
83
|
cache_read_input_tokens: T.nilable(Integer),
|
71
84
|
input_tokens: Integer,
|
data/rbi/anthropic/models.rbi
CHANGED
@@ -39,6 +39,8 @@ module Anthropic
|
|
39
39
|
|
40
40
|
CacheControlEphemeral = Anthropic::Models::CacheControlEphemeral
|
41
41
|
|
42
|
+
CacheCreation = Anthropic::Models::CacheCreation
|
43
|
+
|
42
44
|
CitationCharLocation = Anthropic::Models::CitationCharLocation
|
43
45
|
|
44
46
|
CitationCharLocationParam = Anthropic::Models::CitationCharLocationParam
|
@@ -39,6 +39,23 @@ module Anthropic
|
|
39
39
|
| Anthropic::Internal::Type::Converter::input spec
|
40
40
|
) -> (^-> top)
|
41
41
|
|
42
|
+
def self.meta_info: (
|
43
|
+
{
|
44
|
+
const: (nil | bool | Integer | Float | Symbol)?,
|
45
|
+
enum: ^-> Anthropic::Internal::Type::Converter::input?,
|
46
|
+
union: ^-> Anthropic::Internal::Type::Converter::input?
|
47
|
+
}
|
48
|
+
| ^-> Anthropic::Internal::Type::Converter::input
|
49
|
+
| Anthropic::Internal::Type::Converter::input type_info,
|
50
|
+
{
|
51
|
+
const: (nil | bool | Integer | Float | Symbol)?,
|
52
|
+
enum: ^-> Anthropic::Internal::Type::Converter::input?,
|
53
|
+
union: ^-> Anthropic::Internal::Type::Converter::input?
|
54
|
+
}
|
55
|
+
| ^-> Anthropic::Internal::Type::Converter::input
|
56
|
+
| Anthropic::Internal::Type::Converter::input spec
|
57
|
+
) -> ::Hash[Symbol, top]
|
58
|
+
|
42
59
|
def self.new_coerce_state: (
|
43
60
|
?translate_names: bool
|
44
61
|
) -> Anthropic::Internal::Type::Converter::coerce_state
|
@@ -5,9 +5,9 @@ module Anthropic
|
|
5
5
|
include Anthropic::Internal::Type::Converter
|
6
6
|
include Anthropic::Internal::Util::SorbetRuntimeSupport
|
7
7
|
|
8
|
-
private def self.known_variants: -> ::Array[[Symbol?, (^-> Anthropic::Internal::Type::Converter::input)]]
|
8
|
+
private def self.known_variants: -> ::Array[[Symbol?, (^-> Anthropic::Internal::Type::Converter::input), ::Hash[Symbol, top]]]
|
9
9
|
|
10
|
-
def self.derefed_variants: -> ::Array[[Symbol?, top]]
|
10
|
+
def self.derefed_variants: -> ::Array[[Symbol?, top, ::Hash[Symbol, top]]]
|
11
11
|
|
12
12
|
def self.variants: -> ::Array[top]
|
13
13
|
|
@@ -16,6 +16,7 @@ module Anthropic
|
|
16
16
|
| :"interleaved-thinking-2025-05-14"
|
17
17
|
| :"code-execution-2025-05-22"
|
18
18
|
| :"extended-cache-ttl-2025-04-11"
|
19
|
+
| :"context-1m-2025-08-07"
|
19
20
|
|
20
21
|
module AnthropicBeta
|
21
22
|
extend Anthropic::Internal::Type::Union
|
@@ -36,6 +37,7 @@ module Anthropic
|
|
36
37
|
INTERLEAVED_THINKING_2025_05_14: :"interleaved-thinking-2025-05-14"
|
37
38
|
CODE_EXECUTION_2025_05_22: :"code-execution-2025-05-22"
|
38
39
|
EXTENDED_CACHE_TTL_2025_04_11: :"extended-cache-ttl-2025-04-11"
|
40
|
+
CONTEXT_1M_2025_08_07: :"context-1m-2025-08-07"
|
39
41
|
end
|
40
42
|
end
|
41
43
|
end
|
@@ -1,13 +1,37 @@
|
|
1
1
|
module Anthropic
|
2
2
|
module Models
|
3
|
-
type cache_control_ephemeral =
|
3
|
+
type cache_control_ephemeral =
|
4
|
+
{ type: :ephemeral, ttl: Anthropic::Models::CacheControlEphemeral::ttl }
|
4
5
|
|
5
6
|
class CacheControlEphemeral < Anthropic::Internal::Type::BaseModel
|
6
7
|
attr_accessor type: :ephemeral
|
7
8
|
|
8
|
-
|
9
|
+
attr_reader ttl: Anthropic::Models::CacheControlEphemeral::ttl?
|
9
10
|
|
10
|
-
def
|
11
|
+
def ttl=: (
|
12
|
+
Anthropic::Models::CacheControlEphemeral::ttl
|
13
|
+
) -> Anthropic::Models::CacheControlEphemeral::ttl
|
14
|
+
|
15
|
+
def initialize: (
|
16
|
+
?ttl: Anthropic::Models::CacheControlEphemeral::ttl,
|
17
|
+
?type: :ephemeral
|
18
|
+
) -> void
|
19
|
+
|
20
|
+
def to_hash: -> {
|
21
|
+
type: :ephemeral,
|
22
|
+
ttl: Anthropic::Models::CacheControlEphemeral::ttl
|
23
|
+
}
|
24
|
+
|
25
|
+
type ttl = :"5m" | :"1h"
|
26
|
+
|
27
|
+
module TTL
|
28
|
+
extend Anthropic::Internal::Type::Enum
|
29
|
+
|
30
|
+
TTL_5M: :"5m"
|
31
|
+
TTL_1H: :"1h"
|
32
|
+
|
33
|
+
def self?.values: -> ::Array[Anthropic::Models::CacheControlEphemeral::ttl]
|
34
|
+
end
|
11
35
|
end
|
12
36
|
end
|
13
37
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Anthropic
|
2
|
+
module Models
|
3
|
+
type cache_creation =
|
4
|
+
{
|
5
|
+
:ephemeral_1h_input_tokens => Integer,
|
6
|
+
:ephemeral_5m_input_tokens => Integer
|
7
|
+
}
|
8
|
+
|
9
|
+
class CacheCreation < Anthropic::Internal::Type::BaseModel
|
10
|
+
attr_accessor ephemeral_1h_input_tokens: Integer
|
11
|
+
|
12
|
+
attr_accessor ephemeral_5m_input_tokens: Integer
|
13
|
+
|
14
|
+
def initialize: (
|
15
|
+
ephemeral_1h_input_tokens: Integer,
|
16
|
+
ephemeral_5m_input_tokens: Integer
|
17
|
+
) -> void
|
18
|
+
|
19
|
+
def to_hash: -> {
|
20
|
+
:ephemeral_1h_input_tokens => Integer,
|
21
|
+
:ephemeral_5m_input_tokens => Integer
|
22
|
+
}
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -2,6 +2,7 @@ module Anthropic
|
|
2
2
|
module Models
|
3
3
|
type usage =
|
4
4
|
{
|
5
|
+
cache_creation: Anthropic::CacheCreation?,
|
5
6
|
cache_creation_input_tokens: Integer?,
|
6
7
|
cache_read_input_tokens: Integer?,
|
7
8
|
input_tokens: Integer,
|
@@ -11,6 +12,8 @@ module Anthropic
|
|
11
12
|
}
|
12
13
|
|
13
14
|
class Usage < Anthropic::Internal::Type::BaseModel
|
15
|
+
attr_accessor cache_creation: Anthropic::CacheCreation?
|
16
|
+
|
14
17
|
attr_accessor cache_creation_input_tokens: Integer?
|
15
18
|
|
16
19
|
attr_accessor cache_read_input_tokens: Integer?
|
@@ -24,6 +27,7 @@ module Anthropic
|
|
24
27
|
attr_accessor service_tier: Anthropic::Models::Usage::service_tier?
|
25
28
|
|
26
29
|
def initialize: (
|
30
|
+
cache_creation: Anthropic::CacheCreation?,
|
27
31
|
cache_creation_input_tokens: Integer?,
|
28
32
|
cache_read_input_tokens: Integer?,
|
29
33
|
input_tokens: Integer,
|
@@ -33,6 +37,7 @@ module Anthropic
|
|
33
37
|
) -> void
|
34
38
|
|
35
39
|
def to_hash: -> {
|
40
|
+
cache_creation: Anthropic::CacheCreation?,
|
36
41
|
cache_creation_input_tokens: Integer?,
|
37
42
|
cache_read_input_tokens: Integer?,
|
38
43
|
input_tokens: Integer,
|
data/sig/anthropic/models.rbs
CHANGED
@@ -37,6 +37,8 @@ module Anthropic
|
|
37
37
|
|
38
38
|
class CacheControlEphemeral = Anthropic::Models::CacheControlEphemeral
|
39
39
|
|
40
|
+
class CacheCreation = Anthropic::Models::CacheCreation
|
41
|
+
|
40
42
|
class CitationCharLocation = Anthropic::Models::CitationCharLocation
|
41
43
|
|
42
44
|
class CitationCharLocationParam = Anthropic::Models::CitationCharLocationParam
|
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
|
+
version: 1.7.0
|
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-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: connection_pool
|
@@ -221,6 +221,7 @@ files:
|
|
221
221
|
- lib/anthropic/models/beta_rate_limit_error.rb
|
222
222
|
- lib/anthropic/models/billing_error.rb
|
223
223
|
- lib/anthropic/models/cache_control_ephemeral.rb
|
224
|
+
- lib/anthropic/models/cache_creation.rb
|
224
225
|
- lib/anthropic/models/citation_char_location.rb
|
225
226
|
- lib/anthropic/models/citation_char_location_param.rb
|
226
227
|
- lib/anthropic/models/citation_content_block_location.rb
|
@@ -529,6 +530,7 @@ files:
|
|
529
530
|
- rbi/anthropic/models/beta_rate_limit_error.rbi
|
530
531
|
- rbi/anthropic/models/billing_error.rbi
|
531
532
|
- rbi/anthropic/models/cache_control_ephemeral.rbi
|
533
|
+
- rbi/anthropic/models/cache_creation.rbi
|
532
534
|
- rbi/anthropic/models/citation_char_location.rbi
|
533
535
|
- rbi/anthropic/models/citation_char_location_param.rbi
|
534
536
|
- rbi/anthropic/models/citation_content_block_location.rbi
|
@@ -836,6 +838,7 @@ files:
|
|
836
838
|
- sig/anthropic/models/beta_rate_limit_error.rbs
|
837
839
|
- sig/anthropic/models/billing_error.rbs
|
838
840
|
- sig/anthropic/models/cache_control_ephemeral.rbs
|
841
|
+
- sig/anthropic/models/cache_creation.rbs
|
839
842
|
- sig/anthropic/models/citation_char_location.rbs
|
840
843
|
- sig/anthropic/models/citation_char_location_param.rbs
|
841
844
|
- sig/anthropic/models/citation_content_block_location.rbs
|