anthropic 1.4.1 → 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 +29 -0
- data/README.md +1 -1
- data/lib/anthropic/helpers/bedrock/client.rb +55 -2
- data/lib/anthropic/internal/transport/base_client.rb +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/citation_search_result_location_param.rb +51 -0
- data/lib/anthropic/models/citations_delta.rb +5 -3
- data/lib/anthropic/models/citations_search_result_location.rb +51 -0
- data/lib/anthropic/models/content_block_param.rb +4 -1
- data/lib/anthropic/models/message_param.rb +3 -3
- data/lib/anthropic/models/search_result_block_param.rb +51 -0
- data/lib/anthropic/models/text_block.rb +2 -2
- data/lib/anthropic/models/text_block_param.rb +2 -2
- data/lib/anthropic/models/text_citation.rb +3 -1
- data/lib/anthropic/models/text_citation_param.rb +3 -1
- data/lib/anthropic/models/tool_result_block_param.rb +6 -4
- data/lib/anthropic/models.rb +6 -0
- data/lib/anthropic/version.rb +1 -1
- data/lib/anthropic.rb +3 -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/citation_search_result_location_param.rbi +74 -0
- data/rbi/anthropic/models/citations_delta.rbi +4 -2
- data/rbi/anthropic/models/citations_search_result_location.rbi +74 -0
- data/rbi/anthropic/models/content_block_param.rbi +1 -0
- data/rbi/anthropic/models/search_result_block_param.rbi +77 -0
- data/rbi/anthropic/models/text_block.rbi +2 -1
- data/rbi/anthropic/models/text_block_param.rbi +6 -3
- data/rbi/anthropic/models/text_citation.rbi +2 -1
- data/rbi/anthropic/models/text_citation_param.rbi +2 -1
- data/rbi/anthropic/models/tool_result_block_param.rbi +5 -1
- data/rbi/anthropic/models.rbi +8 -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/citation_search_result_location_param.rbs +50 -0
- data/sig/anthropic/models/citations_delta.rbs +1 -0
- data/sig/anthropic/models/citations_search_result_location.rbs +50 -0
- data/sig/anthropic/models/content_block_param.rbs +1 -0
- data/sig/anthropic/models/search_result_block_param.rbs +49 -0
- data/sig/anthropic/models/text_citation.rbs +1 -0
- data/sig/anthropic/models/text_citation_param.rbs +1 -0
- data/sig/anthropic/models/tool_result_block_param.rbs +4 -1
- data/sig/anthropic/models.rbs +6 -0
- metadata +11 -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,34 @@
|
|
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
|
+
|
19
|
+
## 1.5.0 (2025-08-08)
|
20
|
+
|
21
|
+
Full Changelog: [v1.4.1...v1.5.0](https://github.com/anthropics/anthropic-sdk-ruby/compare/v1.4.1...v1.5.0)
|
22
|
+
|
23
|
+
### Features
|
24
|
+
|
25
|
+
* **api:** search result content blocks ([9a94866](https://github.com/anthropics/anthropic-sdk-ruby/commit/9a9486664e10ce0d02967ab1d5360357ffb72a66))
|
26
|
+
|
27
|
+
|
28
|
+
### Bug Fixes
|
29
|
+
|
30
|
+
* aws bedrock base url ([#673](https://github.com/anthropics/anthropic-sdk-ruby/issues/673)) ([b2996b9](https://github.com/anthropics/anthropic-sdk-ruby/commit/b2996b9349b047c53232ecd63823110ad90c71c3))
|
31
|
+
|
3
32
|
## 1.4.1 (2025-08-07)
|
4
33
|
|
5
34
|
Full Changelog: [v1.4.0...v1.4.1](https://github.com/anthropics/anthropic-sdk-ruby/compare/v1.4.0...v1.4.1)
|
data/README.md
CHANGED
@@ -111,6 +111,60 @@ module Anthropic
|
|
111
111
|
@beta = Anthropic::Resources::Beta.new(client: self)
|
112
112
|
end
|
113
113
|
|
114
|
+
# @api private
|
115
|
+
#
|
116
|
+
# @param req [Hash{Symbol=>Object}] .
|
117
|
+
#
|
118
|
+
# @option req [Symbol] :method
|
119
|
+
#
|
120
|
+
# @option req [String, Array<String>] :path
|
121
|
+
#
|
122
|
+
# @option req [Hash{String=>Array<String>, String, nil}, nil] :query
|
123
|
+
#
|
124
|
+
# @option req [Hash{String=>String, Integer, Array<String, Integer, nil>, nil}, nil] :headers
|
125
|
+
#
|
126
|
+
# @option req [Object, nil] :body
|
127
|
+
#
|
128
|
+
# @option req [Symbol, Integer, Array<Symbol, Integer>, Proc, nil] :unwrap
|
129
|
+
#
|
130
|
+
# @option req [Class<Anthropic::Internal::Type::BasePage>, nil] :page
|
131
|
+
#
|
132
|
+
# @option req [Class<Anthropic::Internal::Type::BaseStream>, nil] :stream
|
133
|
+
#
|
134
|
+
# @option req [Anthropic::Internal::Type::Converter, Class, nil] :model
|
135
|
+
#
|
136
|
+
# @param opts [Hash{Symbol=>Object}] .
|
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
|
+
)
|
162
|
+
|
163
|
+
request_input[:headers].merge!(signed_request.headers)
|
164
|
+
|
165
|
+
request_input
|
166
|
+
end
|
167
|
+
|
114
168
|
# @api private
|
115
169
|
#
|
116
170
|
# Very private API, do not use
|
@@ -126,8 +180,7 @@ module Anthropic
|
|
126
180
|
# @option request [Object] :body
|
127
181
|
#
|
128
182
|
# @return [Hash{Symbol, Object}]
|
129
|
-
|
130
|
-
fit_req_to_bedrock_specs!(request)
|
183
|
+
private def transform_request(request)
|
131
184
|
sliced = super.slice(
|
132
185
|
:method,
|
133
186
|
:url,
|
@@ -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
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Anthropic
|
4
|
+
module Models
|
5
|
+
class CitationSearchResultLocationParam < Anthropic::Internal::Type::BaseModel
|
6
|
+
# @!attribute cited_text
|
7
|
+
#
|
8
|
+
# @return [String]
|
9
|
+
required :cited_text, String
|
10
|
+
|
11
|
+
# @!attribute end_block_index
|
12
|
+
#
|
13
|
+
# @return [Integer]
|
14
|
+
required :end_block_index, Integer
|
15
|
+
|
16
|
+
# @!attribute search_result_index
|
17
|
+
#
|
18
|
+
# @return [Integer]
|
19
|
+
required :search_result_index, Integer
|
20
|
+
|
21
|
+
# @!attribute source
|
22
|
+
#
|
23
|
+
# @return [String]
|
24
|
+
required :source, String
|
25
|
+
|
26
|
+
# @!attribute start_block_index
|
27
|
+
#
|
28
|
+
# @return [Integer]
|
29
|
+
required :start_block_index, Integer
|
30
|
+
|
31
|
+
# @!attribute title
|
32
|
+
#
|
33
|
+
# @return [String, nil]
|
34
|
+
required :title, String, nil?: true
|
35
|
+
|
36
|
+
# @!attribute type
|
37
|
+
#
|
38
|
+
# @return [Symbol, :search_result_location]
|
39
|
+
required :type, const: :search_result_location
|
40
|
+
|
41
|
+
# @!method initialize(cited_text:, end_block_index:, search_result_index:, source:, start_block_index:, title:, type: :search_result_location)
|
42
|
+
# @param cited_text [String]
|
43
|
+
# @param end_block_index [Integer]
|
44
|
+
# @param search_result_index [Integer]
|
45
|
+
# @param source [String]
|
46
|
+
# @param start_block_index [Integer]
|
47
|
+
# @param title [String, nil]
|
48
|
+
# @param type [Symbol, :search_result_location]
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -5,7 +5,7 @@ module Anthropic
|
|
5
5
|
class CitationsDelta < Anthropic::Internal::Type::BaseModel
|
6
6
|
# @!attribute citation
|
7
7
|
#
|
8
|
-
# @return [Anthropic::Models::CitationCharLocation, Anthropic::Models::CitationPageLocation, Anthropic::Models::CitationContentBlockLocation, Anthropic::Models::CitationsWebSearchResultLocation]
|
8
|
+
# @return [Anthropic::Models::CitationCharLocation, Anthropic::Models::CitationPageLocation, Anthropic::Models::CitationContentBlockLocation, Anthropic::Models::CitationsWebSearchResultLocation, Anthropic::Models::CitationsSearchResultLocation]
|
9
9
|
required :citation, union: -> { Anthropic::CitationsDelta::Citation }
|
10
10
|
|
11
11
|
# @!attribute type
|
@@ -14,7 +14,7 @@ module Anthropic
|
|
14
14
|
required :type, const: :citations_delta
|
15
15
|
|
16
16
|
# @!method initialize(citation:, type: :citations_delta)
|
17
|
-
# @param citation [Anthropic::Models::CitationCharLocation, Anthropic::Models::CitationPageLocation, Anthropic::Models::CitationContentBlockLocation, Anthropic::Models::CitationsWebSearchResultLocation]
|
17
|
+
# @param citation [Anthropic::Models::CitationCharLocation, Anthropic::Models::CitationPageLocation, Anthropic::Models::CitationContentBlockLocation, Anthropic::Models::CitationsWebSearchResultLocation, Anthropic::Models::CitationsSearchResultLocation]
|
18
18
|
# @param type [Symbol, :citations_delta]
|
19
19
|
|
20
20
|
# @see Anthropic::Models::CitationsDelta#citation
|
@@ -31,8 +31,10 @@ module Anthropic
|
|
31
31
|
|
32
32
|
variant :web_search_result_location, -> { Anthropic::CitationsWebSearchResultLocation }
|
33
33
|
|
34
|
+
variant :search_result_location, -> { Anthropic::CitationsSearchResultLocation }
|
35
|
+
|
34
36
|
# @!method self.variants
|
35
|
-
# @return [Array(Anthropic::Models::CitationCharLocation, Anthropic::Models::CitationPageLocation, Anthropic::Models::CitationContentBlockLocation, Anthropic::Models::CitationsWebSearchResultLocation)]
|
37
|
+
# @return [Array(Anthropic::Models::CitationCharLocation, Anthropic::Models::CitationPageLocation, Anthropic::Models::CitationContentBlockLocation, Anthropic::Models::CitationsWebSearchResultLocation, Anthropic::Models::CitationsSearchResultLocation)]
|
36
38
|
end
|
37
39
|
end
|
38
40
|
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Anthropic
|
4
|
+
module Models
|
5
|
+
class CitationsSearchResultLocation < Anthropic::Internal::Type::BaseModel
|
6
|
+
# @!attribute cited_text
|
7
|
+
#
|
8
|
+
# @return [String]
|
9
|
+
required :cited_text, String
|
10
|
+
|
11
|
+
# @!attribute end_block_index
|
12
|
+
#
|
13
|
+
# @return [Integer]
|
14
|
+
required :end_block_index, Integer
|
15
|
+
|
16
|
+
# @!attribute search_result_index
|
17
|
+
#
|
18
|
+
# @return [Integer]
|
19
|
+
required :search_result_index, Integer
|
20
|
+
|
21
|
+
# @!attribute source
|
22
|
+
#
|
23
|
+
# @return [String]
|
24
|
+
required :source, String
|
25
|
+
|
26
|
+
# @!attribute start_block_index
|
27
|
+
#
|
28
|
+
# @return [Integer]
|
29
|
+
required :start_block_index, Integer
|
30
|
+
|
31
|
+
# @!attribute title
|
32
|
+
#
|
33
|
+
# @return [String, nil]
|
34
|
+
required :title, String, nil?: true
|
35
|
+
|
36
|
+
# @!attribute type
|
37
|
+
#
|
38
|
+
# @return [Symbol, :search_result_location]
|
39
|
+
required :type, const: :search_result_location
|
40
|
+
|
41
|
+
# @!method initialize(cited_text:, end_block_index:, search_result_index:, source:, start_block_index:, title:, type: :search_result_location)
|
42
|
+
# @param cited_text [String]
|
43
|
+
# @param end_block_index [Integer]
|
44
|
+
# @param search_result_index [Integer]
|
45
|
+
# @param source [String]
|
46
|
+
# @param start_block_index [Integer]
|
47
|
+
# @param title [String, nil]
|
48
|
+
# @param type [Symbol, :search_result_location]
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -17,6 +17,9 @@ module Anthropic
|
|
17
17
|
# Document content, either specified directly as base64 data, as text, or as a reference via a URL.
|
18
18
|
variant :document, -> { Anthropic::DocumentBlockParam }
|
19
19
|
|
20
|
+
# A search result block containing source, title, and content from search operations.
|
21
|
+
variant :search_result, -> { Anthropic::SearchResultBlockParam }
|
22
|
+
|
20
23
|
# A block specifying internal thinking by the model.
|
21
24
|
variant :thinking, -> { Anthropic::ThinkingBlockParam }
|
22
25
|
|
@@ -34,7 +37,7 @@ module Anthropic
|
|
34
37
|
variant :web_search_tool_result, -> { Anthropic::WebSearchToolResultBlockParam }
|
35
38
|
|
36
39
|
# @!method self.variants
|
37
|
-
# @return [Array(Anthropic::Models::TextBlockParam, Anthropic::Models::ImageBlockParam, Anthropic::Models::DocumentBlockParam, Anthropic::Models::ThinkingBlockParam, Anthropic::Models::RedactedThinkingBlockParam, Anthropic::Models::ToolUseBlockParam, Anthropic::Models::ToolResultBlockParam, Anthropic::Models::ServerToolUseBlockParam, Anthropic::Models::WebSearchToolResultBlockParam)]
|
40
|
+
# @return [Array(Anthropic::Models::TextBlockParam, Anthropic::Models::ImageBlockParam, Anthropic::Models::DocumentBlockParam, Anthropic::Models::SearchResultBlockParam, Anthropic::Models::ThinkingBlockParam, Anthropic::Models::RedactedThinkingBlockParam, Anthropic::Models::ToolUseBlockParam, Anthropic::Models::ToolResultBlockParam, Anthropic::Models::ServerToolUseBlockParam, Anthropic::Models::WebSearchToolResultBlockParam)]
|
38
41
|
end
|
39
42
|
end
|
40
43
|
end
|
@@ -5,7 +5,7 @@ module Anthropic
|
|
5
5
|
class MessageParam < Anthropic::Internal::Type::BaseModel
|
6
6
|
# @!attribute content
|
7
7
|
#
|
8
|
-
# @return [String, Array<Anthropic::Models::TextBlockParam, Anthropic::Models::ImageBlockParam, Anthropic::Models::DocumentBlockParam, Anthropic::Models::ThinkingBlockParam, Anthropic::Models::RedactedThinkingBlockParam, Anthropic::Models::ToolUseBlockParam, Anthropic::Models::ToolResultBlockParam, Anthropic::Models::ServerToolUseBlockParam, Anthropic::Models::WebSearchToolResultBlockParam>]
|
8
|
+
# @return [String, Array<Anthropic::Models::TextBlockParam, Anthropic::Models::ImageBlockParam, Anthropic::Models::DocumentBlockParam, Anthropic::Models::SearchResultBlockParam, Anthropic::Models::ThinkingBlockParam, Anthropic::Models::RedactedThinkingBlockParam, Anthropic::Models::ToolUseBlockParam, Anthropic::Models::ToolResultBlockParam, Anthropic::Models::ServerToolUseBlockParam, Anthropic::Models::WebSearchToolResultBlockParam>]
|
9
9
|
required :content, union: -> { Anthropic::MessageParam::Content }
|
10
10
|
|
11
11
|
# @!attribute role
|
@@ -14,7 +14,7 @@ module Anthropic
|
|
14
14
|
required :role, enum: -> { Anthropic::MessageParam::Role }
|
15
15
|
|
16
16
|
# @!method initialize(content:, role:)
|
17
|
-
# @param content [String, Array<Anthropic::Models::TextBlockParam, Anthropic::Models::ImageBlockParam, Anthropic::Models::DocumentBlockParam, Anthropic::Models::ThinkingBlockParam, Anthropic::Models::RedactedThinkingBlockParam, Anthropic::Models::ToolUseBlockParam, Anthropic::Models::ToolResultBlockParam, Anthropic::Models::ServerToolUseBlockParam, Anthropic::Models::WebSearchToolResultBlockParam>]
|
17
|
+
# @param content [String, Array<Anthropic::Models::TextBlockParam, Anthropic::Models::ImageBlockParam, Anthropic::Models::DocumentBlockParam, Anthropic::Models::SearchResultBlockParam, Anthropic::Models::ThinkingBlockParam, Anthropic::Models::RedactedThinkingBlockParam, Anthropic::Models::ToolUseBlockParam, Anthropic::Models::ToolResultBlockParam, Anthropic::Models::ServerToolUseBlockParam, Anthropic::Models::WebSearchToolResultBlockParam>]
|
18
18
|
# @param role [Symbol, Anthropic::Models::MessageParam::Role]
|
19
19
|
|
20
20
|
# @see Anthropic::Models::MessageParam#content
|
@@ -26,7 +26,7 @@ module Anthropic
|
|
26
26
|
variant -> { Anthropic::Models::MessageParam::Content::ContentBlockParamArray }
|
27
27
|
|
28
28
|
# @!method self.variants
|
29
|
-
# @return [Array(String, Array<Anthropic::Models::TextBlockParam, Anthropic::Models::ImageBlockParam, Anthropic::Models::DocumentBlockParam, Anthropic::Models::ThinkingBlockParam, Anthropic::Models::RedactedThinkingBlockParam, Anthropic::Models::ToolUseBlockParam, Anthropic::Models::ToolResultBlockParam, Anthropic::Models::ServerToolUseBlockParam, Anthropic::Models::WebSearchToolResultBlockParam>)]
|
29
|
+
# @return [Array(String, Array<Anthropic::Models::TextBlockParam, Anthropic::Models::ImageBlockParam, Anthropic::Models::DocumentBlockParam, Anthropic::Models::SearchResultBlockParam, Anthropic::Models::ThinkingBlockParam, Anthropic::Models::RedactedThinkingBlockParam, Anthropic::Models::ToolUseBlockParam, Anthropic::Models::ToolResultBlockParam, Anthropic::Models::ServerToolUseBlockParam, Anthropic::Models::WebSearchToolResultBlockParam>)]
|
30
30
|
|
31
31
|
# @type [Anthropic::Internal::Type::Converter]
|
32
32
|
ContentBlockParamArray = Anthropic::Internal::Type::ArrayOf[union: -> {
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Anthropic
|
4
|
+
module Models
|
5
|
+
class SearchResultBlockParam < Anthropic::Internal::Type::BaseModel
|
6
|
+
# @!attribute content
|
7
|
+
#
|
8
|
+
# @return [Array<Anthropic::Models::TextBlockParam>]
|
9
|
+
required :content, -> { Anthropic::Internal::Type::ArrayOf[Anthropic::TextBlockParam] }
|
10
|
+
|
11
|
+
# @!attribute source
|
12
|
+
#
|
13
|
+
# @return [String]
|
14
|
+
required :source, String
|
15
|
+
|
16
|
+
# @!attribute title
|
17
|
+
#
|
18
|
+
# @return [String]
|
19
|
+
required :title, String
|
20
|
+
|
21
|
+
# @!attribute type
|
22
|
+
#
|
23
|
+
# @return [Symbol, :search_result]
|
24
|
+
required :type, const: :search_result
|
25
|
+
|
26
|
+
# @!attribute cache_control
|
27
|
+
# Create a cache control breakpoint at this content block.
|
28
|
+
#
|
29
|
+
# @return [Anthropic::Models::CacheControlEphemeral, nil]
|
30
|
+
optional :cache_control, -> { Anthropic::CacheControlEphemeral }, nil?: true
|
31
|
+
|
32
|
+
# @!attribute citations
|
33
|
+
#
|
34
|
+
# @return [Anthropic::Models::CitationsConfigParam, nil]
|
35
|
+
optional :citations, -> { Anthropic::CitationsConfigParam }
|
36
|
+
|
37
|
+
# @!method initialize(content:, source:, title:, cache_control: nil, citations: nil, type: :search_result)
|
38
|
+
# @param content [Array<Anthropic::Models::TextBlockParam>]
|
39
|
+
#
|
40
|
+
# @param source [String]
|
41
|
+
#
|
42
|
+
# @param title [String]
|
43
|
+
#
|
44
|
+
# @param cache_control [Anthropic::Models::CacheControlEphemeral, nil] Create a cache control breakpoint at this content block.
|
45
|
+
#
|
46
|
+
# @param citations [Anthropic::Models::CitationsConfigParam]
|
47
|
+
#
|
48
|
+
# @param type [Symbol, :search_result]
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -10,7 +10,7 @@ module Anthropic
|
|
10
10
|
# Citing a PDF results in `page_location`, plain text results in `char_location`,
|
11
11
|
# and content document results in `content_block_location`.
|
12
12
|
#
|
13
|
-
# @return [Array<Anthropic::Models::CitationCharLocation, Anthropic::Models::CitationPageLocation, Anthropic::Models::CitationContentBlockLocation, Anthropic::Models::CitationsWebSearchResultLocation>, nil]
|
13
|
+
# @return [Array<Anthropic::Models::CitationCharLocation, Anthropic::Models::CitationPageLocation, Anthropic::Models::CitationContentBlockLocation, Anthropic::Models::CitationsWebSearchResultLocation, Anthropic::Models::CitationsSearchResultLocation>, nil]
|
14
14
|
required :citations,
|
15
15
|
-> {
|
16
16
|
Anthropic::Internal::Type::ArrayOf[union: Anthropic::TextCitation]
|
@@ -31,7 +31,7 @@ module Anthropic
|
|
31
31
|
# Some parameter documentations has been truncated, see
|
32
32
|
# {Anthropic::Models::TextBlock} for more details.
|
33
33
|
#
|
34
|
-
# @param citations [Array<Anthropic::Models::CitationCharLocation, Anthropic::Models::CitationPageLocation, Anthropic::Models::CitationContentBlockLocation, Anthropic::Models::CitationsWebSearchResultLocation>, nil] Citations supporting the text block.
|
34
|
+
# @param citations [Array<Anthropic::Models::CitationCharLocation, Anthropic::Models::CitationPageLocation, Anthropic::Models::CitationContentBlockLocation, Anthropic::Models::CitationsWebSearchResultLocation, Anthropic::Models::CitationsSearchResultLocation>, nil] Citations supporting the text block.
|
35
35
|
#
|
36
36
|
# @param text [String]
|
37
37
|
#
|
@@ -21,7 +21,7 @@ module Anthropic
|
|
21
21
|
|
22
22
|
# @!attribute citations
|
23
23
|
#
|
24
|
-
# @return [Array<Anthropic::Models::CitationCharLocationParam, Anthropic::Models::CitationPageLocationParam, Anthropic::Models::CitationContentBlockLocationParam, Anthropic::Models::CitationWebSearchResultLocationParam>, nil]
|
24
|
+
# @return [Array<Anthropic::Models::CitationCharLocationParam, Anthropic::Models::CitationPageLocationParam, Anthropic::Models::CitationContentBlockLocationParam, Anthropic::Models::CitationWebSearchResultLocationParam, Anthropic::Models::CitationSearchResultLocationParam>, nil]
|
25
25
|
optional :citations,
|
26
26
|
-> { Anthropic::Internal::Type::ArrayOf[union: Anthropic::TextCitationParam] },
|
27
27
|
nil?: true
|
@@ -31,7 +31,7 @@ module Anthropic
|
|
31
31
|
#
|
32
32
|
# @param cache_control [Anthropic::Models::CacheControlEphemeral, nil] Create a cache control breakpoint at this content block.
|
33
33
|
#
|
34
|
-
# @param citations [Array<Anthropic::Models::CitationCharLocationParam, Anthropic::Models::CitationPageLocationParam, Anthropic::Models::CitationContentBlockLocationParam, Anthropic::Models::CitationWebSearchResultLocationParam>, nil]
|
34
|
+
# @param citations [Array<Anthropic::Models::CitationCharLocationParam, Anthropic::Models::CitationPageLocationParam, Anthropic::Models::CitationContentBlockLocationParam, Anthropic::Models::CitationWebSearchResultLocationParam, Anthropic::Models::CitationSearchResultLocationParam>, nil]
|
35
35
|
#
|
36
36
|
# @param type [Symbol, :text]
|
37
37
|
end
|
@@ -15,8 +15,10 @@ module Anthropic
|
|
15
15
|
|
16
16
|
variant :web_search_result_location, -> { Anthropic::CitationsWebSearchResultLocation }
|
17
17
|
|
18
|
+
variant :search_result_location, -> { Anthropic::CitationsSearchResultLocation }
|
19
|
+
|
18
20
|
# @!method self.variants
|
19
|
-
# @return [Array(Anthropic::Models::CitationCharLocation, Anthropic::Models::CitationPageLocation, Anthropic::Models::CitationContentBlockLocation, Anthropic::Models::CitationsWebSearchResultLocation)]
|
21
|
+
# @return [Array(Anthropic::Models::CitationCharLocation, Anthropic::Models::CitationPageLocation, Anthropic::Models::CitationContentBlockLocation, Anthropic::Models::CitationsWebSearchResultLocation, Anthropic::Models::CitationsSearchResultLocation)]
|
20
22
|
end
|
21
23
|
end
|
22
24
|
end
|
@@ -15,8 +15,10 @@ module Anthropic
|
|
15
15
|
|
16
16
|
variant :web_search_result_location, -> { Anthropic::CitationWebSearchResultLocationParam }
|
17
17
|
|
18
|
+
variant :search_result_location, -> { Anthropic::CitationSearchResultLocationParam }
|
19
|
+
|
18
20
|
# @!method self.variants
|
19
|
-
# @return [Array(Anthropic::Models::CitationCharLocationParam, Anthropic::Models::CitationPageLocationParam, Anthropic::Models::CitationContentBlockLocationParam, Anthropic::Models::CitationWebSearchResultLocationParam)]
|
21
|
+
# @return [Array(Anthropic::Models::CitationCharLocationParam, Anthropic::Models::CitationPageLocationParam, Anthropic::Models::CitationContentBlockLocationParam, Anthropic::Models::CitationWebSearchResultLocationParam, Anthropic::Models::CitationSearchResultLocationParam)]
|
20
22
|
end
|
21
23
|
end
|
22
24
|
end
|
@@ -21,7 +21,7 @@ module Anthropic
|
|
21
21
|
|
22
22
|
# @!attribute content
|
23
23
|
#
|
24
|
-
# @return [String, Array<Anthropic::Models::TextBlockParam, Anthropic::Models::ImageBlockParam>, nil]
|
24
|
+
# @return [String, Array<Anthropic::Models::TextBlockParam, Anthropic::Models::ImageBlockParam, Anthropic::Models::SearchResultBlockParam>, nil]
|
25
25
|
optional :content, union: -> { Anthropic::ToolResultBlockParam::Content }
|
26
26
|
|
27
27
|
# @!attribute is_error
|
@@ -34,7 +34,7 @@ module Anthropic
|
|
34
34
|
#
|
35
35
|
# @param cache_control [Anthropic::Models::CacheControlEphemeral, nil] Create a cache control breakpoint at this content block.
|
36
36
|
#
|
37
|
-
# @param content [String, Array<Anthropic::Models::TextBlockParam, Anthropic::Models::ImageBlockParam>]
|
37
|
+
# @param content [String, Array<Anthropic::Models::TextBlockParam, Anthropic::Models::ImageBlockParam, Anthropic::Models::SearchResultBlockParam>]
|
38
38
|
#
|
39
39
|
# @param is_error [Boolean]
|
40
40
|
#
|
@@ -57,12 +57,14 @@ module Anthropic
|
|
57
57
|
|
58
58
|
variant :image, -> { Anthropic::ImageBlockParam }
|
59
59
|
|
60
|
+
variant :search_result, -> { Anthropic::SearchResultBlockParam }
|
61
|
+
|
60
62
|
# @!method self.variants
|
61
|
-
# @return [Array(Anthropic::Models::TextBlockParam, Anthropic::Models::ImageBlockParam)]
|
63
|
+
# @return [Array(Anthropic::Models::TextBlockParam, Anthropic::Models::ImageBlockParam, Anthropic::Models::SearchResultBlockParam)]
|
62
64
|
end
|
63
65
|
|
64
66
|
# @!method self.variants
|
65
|
-
# @return [Array(String, Array<Anthropic::Models::TextBlockParam, Anthropic::Models::ImageBlockParam>)]
|
67
|
+
# @return [Array(String, Array<Anthropic::Models::TextBlockParam, Anthropic::Models::ImageBlockParam, Anthropic::Models::SearchResultBlockParam>)]
|
66
68
|
|
67
69
|
# @type [Anthropic::Internal::Type::Converter]
|
68
70
|
ContentArray =
|
data/lib/anthropic/models.rb
CHANGED
@@ -93,6 +93,10 @@ module Anthropic
|
|
93
93
|
|
94
94
|
CitationsDelta = Anthropic::Models::CitationsDelta
|
95
95
|
|
96
|
+
CitationSearchResultLocationParam = Anthropic::Models::CitationSearchResultLocationParam
|
97
|
+
|
98
|
+
CitationsSearchResultLocation = Anthropic::Models::CitationsSearchResultLocation
|
99
|
+
|
96
100
|
CitationsWebSearchResultLocation = Anthropic::Models::CitationsWebSearchResultLocation
|
97
101
|
|
98
102
|
CitationWebSearchResultLocationParam = Anthropic::Models::CitationWebSearchResultLocationParam
|
@@ -179,6 +183,8 @@ module Anthropic
|
|
179
183
|
|
180
184
|
RedactedThinkingBlockParam = Anthropic::Models::RedactedThinkingBlockParam
|
181
185
|
|
186
|
+
SearchResultBlockParam = Anthropic::Models::SearchResultBlockParam
|
187
|
+
|
182
188
|
ServerToolUsage = Anthropic::Models::ServerToolUsage
|
183
189
|
|
184
190
|
ServerToolUseBlock = Anthropic::Models::ServerToolUseBlock
|
data/lib/anthropic/version.rb
CHANGED