anthropic 1.5.0 → 1.6.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 +16 -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/version.rb +1 -1
- 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/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
- 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: 7ddce47b08338bf4a2eb932fddbcc85b24d713f50b3ce167d459b39fa644f4ce
|
4
|
+
data.tar.gz: a2512742b5e084705306598a0f46c71abd407f0ad364bfd7f294fd22226ee91f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67bbb70c8f49c7b42226f47ace877d55dba4b8544d8d2ec26bd669114fa78f77ad2a3445d40bc35acaab70e342f37621d0ee92a29a4b80b21ecd34666a4b3da1
|
7
|
+
data.tar.gz: 140d00ea5c494d0330c26f3345422b8f8efc4d7d31e8e206271dc02598e6c63387749ed4bb140b93e64eaf66bd85bb3f78b25f6767fc50d973b05e2d85f16da6
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,21 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 1.6.0 (2025-08-12)
|
4
|
+
|
5
|
+
Full Changelog: [v1.5.0...v1.6.0](https://github.com/anthropics/anthropic-sdk-ruby/compare/v1.5.0...v1.6.0)
|
6
|
+
|
7
|
+
### Features
|
8
|
+
|
9
|
+
* **betas:** add context-1m-2025-08-07 ([5bb5064](https://github.com/anthropics/anthropic-sdk-ruby/commit/5bb506416852bcd0c893c643831ec6e52a2cc79d))
|
10
|
+
|
11
|
+
|
12
|
+
### Chores
|
13
|
+
|
14
|
+
* collect metadata from type DSL ([69114b1](https://github.com/anthropics/anthropic-sdk-ruby/commit/69114b159e3710c467cbb7c55b8b7526cb5ea8e7))
|
15
|
+
* **internal:** update comment in script ([c5bd3b1](https://github.com/anthropics/anthropic-sdk-ruby/commit/c5bd3b144ad399c114e644437820a8785e7399f0))
|
16
|
+
* **internal:** update test skipping reason ([6d7c586](https://github.com/anthropics/anthropic-sdk-ruby/commit/6d7c58606a88e6a34b16f19006e44dbf17d657c0))
|
17
|
+
* update @stainless-api/prism-cli to v5.15.0 ([356427c](https://github.com/anthropics/anthropic-sdk-ruby/commit/356427c4ec83d134dbcccdf27915eee65e5e8daa))
|
18
|
+
|
3
19
|
## 1.5.0 (2025-08-08)
|
4
20
|
|
5
21
|
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
|
data/lib/anthropic/version.rb
CHANGED
@@ -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
|
|
@@ -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
|
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.6.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-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: connection_pool
|