anthropic 1.4.0 → 1.5.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.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +21 -0
  3. data/README.md +1 -1
  4. data/lib/anthropic/helpers/bedrock/client.rb +34 -4
  5. data/lib/anthropic/internal/transport/base_client.rb +18 -0
  6. data/lib/anthropic/models/citation_search_result_location_param.rb +51 -0
  7. data/lib/anthropic/models/citations_delta.rb +5 -3
  8. data/lib/anthropic/models/citations_search_result_location.rb +51 -0
  9. data/lib/anthropic/models/content_block_param.rb +4 -1
  10. data/lib/anthropic/models/message_param.rb +3 -3
  11. data/lib/anthropic/models/search_result_block_param.rb +51 -0
  12. data/lib/anthropic/models/text_block.rb +2 -2
  13. data/lib/anthropic/models/text_block_param.rb +2 -2
  14. data/lib/anthropic/models/text_citation.rb +3 -1
  15. data/lib/anthropic/models/text_citation_param.rb +3 -1
  16. data/lib/anthropic/models/tool_result_block_param.rb +6 -4
  17. data/lib/anthropic/models.rb +6 -0
  18. data/lib/anthropic/version.rb +1 -1
  19. data/lib/anthropic.rb +3 -0
  20. data/rbi/anthropic/models/citation_search_result_location_param.rbi +74 -0
  21. data/rbi/anthropic/models/citations_delta.rbi +4 -2
  22. data/rbi/anthropic/models/citations_search_result_location.rbi +74 -0
  23. data/rbi/anthropic/models/content_block_param.rbi +1 -0
  24. data/rbi/anthropic/models/search_result_block_param.rbi +77 -0
  25. data/rbi/anthropic/models/text_block.rbi +2 -1
  26. data/rbi/anthropic/models/text_block_param.rbi +6 -3
  27. data/rbi/anthropic/models/text_citation.rbi +2 -1
  28. data/rbi/anthropic/models/text_citation_param.rbi +2 -1
  29. data/rbi/anthropic/models/tool_result_block_param.rbi +5 -1
  30. data/rbi/anthropic/models.rbi +8 -0
  31. data/sig/anthropic/models/citation_search_result_location_param.rbs +50 -0
  32. data/sig/anthropic/models/citations_delta.rbs +1 -0
  33. data/sig/anthropic/models/citations_search_result_location.rbs +50 -0
  34. data/sig/anthropic/models/content_block_param.rbs +1 -0
  35. data/sig/anthropic/models/search_result_block_param.rbs +49 -0
  36. data/sig/anthropic/models/text_citation.rbs +1 -0
  37. data/sig/anthropic/models/text_citation_param.rbs +1 -0
  38. data/sig/anthropic/models/tool_result_block_param.rbs +4 -1
  39. data/sig/anthropic/models.rbs +6 -0
  40. metadata +11 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a3aeac8c8f19023ee694cd9c7ad3e5dd99e0e7048a811454efff82c00fe7a12b
4
- data.tar.gz: 8fd8babb73990354a553654be7613e5c182432e50b81b89080da9e0b450bfb63
3
+ metadata.gz: f7ddefa0c24bda53c10f5055a874b0aad2ad1be2d469a6c6dfb5d22f82e81c30
4
+ data.tar.gz: 1cd0165a763474dd156fe6c7d039d36119756b40e1117aae949df45740b9b5b3
5
5
  SHA512:
6
- metadata.gz: b47bef5c4483f716d55955a14d6692baacc3cacdee9be3c2470ec89f334f74fdacec4267181e20ac6971f3624c474d6e154579084ed73162d131fd4407621c56
7
- data.tar.gz: d91553e354390a3447f50d1927e60244783ee1070aca2acd28aeaa02e4365bf0926c01ab3d9f8810c7e54219985d43ef5e24d0decfb9a62af5ea7d42880ae970
6
+ metadata.gz: 31550e3c9ed2cdd5231a04b3025964c8771cf97804723ee04f797d4ac89cf3eaa875edde85d5c4ca182b548b4cdd6ce76a01cef3b3be7d0aa04b9802981c8386
7
+ data.tar.gz: 48d79952e98815c703d605653b70706e9de2286f44da9c47a01b13e3fbca1da5876f4f8ccb2cc51dd4a4f4ee7576fe0df994e9d3cbeb29406fc186e96371a681
data/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.5.0 (2025-08-08)
4
+
5
+ Full Changelog: [v1.4.1...v1.5.0](https://github.com/anthropics/anthropic-sdk-ruby/compare/v1.4.1...v1.5.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** search result content blocks ([9a94866](https://github.com/anthropics/anthropic-sdk-ruby/commit/9a9486664e10ce0d02967ab1d5360357ffb72a66))
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * aws bedrock base url ([#673](https://github.com/anthropics/anthropic-sdk-ruby/issues/673)) ([b2996b9](https://github.com/anthropics/anthropic-sdk-ruby/commit/b2996b9349b047c53232ecd63823110ad90c71c3))
15
+
16
+ ## 1.4.1 (2025-08-07)
17
+
18
+ Full Changelog: [v1.4.0...v1.4.1](https://github.com/anthropics/anthropic-sdk-ruby/compare/v1.4.0...v1.4.1)
19
+
20
+ ### Bug Fixes
21
+
22
+ * aws bedrock should sign each request follow retries ([#672](https://github.com/anthropics/anthropic-sdk-ruby/issues/672)) ([df9f4e1](https://github.com/anthropics/anthropic-sdk-ruby/commit/df9f4e1aa7e7211dab3d36dd9093092d20649359))
23
+
3
24
  ## 1.4.0 (2025-08-05)
4
25
 
5
26
  Full Changelog: [v1.3.0...v1.4.0](https://github.com/anthropics/anthropic-sdk-ruby/compare/v1.3.0...v1.4.0)
data/README.md CHANGED
@@ -15,7 +15,7 @@ To use this gem, install via Bundler by adding the following to your application
15
15
  <!-- x-release-please-start-version -->
16
16
 
17
17
  ```ruby
18
- gem "anthropic", "~> 1.4.0"
18
+ gem "anthropic", "~> 1.5.0"
19
19
  ```
20
20
 
21
21
  <!-- x-release-please-end -->
@@ -50,10 +50,10 @@ module Anthropic
50
50
  def initialize(
51
51
  aws_region: nil,
52
52
  base_url: nil,
53
- max_retries: DEFAULT_MAX_RETRIES,
54
- timeout: DEFAULT_TIMEOUT_IN_SECONDS,
55
- initial_retry_delay: DEFAULT_INITIAL_RETRY_DELAY,
56
- max_retry_delay: DEFAULT_MAX_RETRY_DELAY,
53
+ max_retries: self.class::DEFAULT_MAX_RETRIES,
54
+ timeout: self.class::DEFAULT_TIMEOUT_IN_SECONDS,
55
+ initial_retry_delay: self.class::DEFAULT_INITIAL_RETRY_DELAY,
56
+ max_retry_delay: self.class::DEFAULT_MAX_RETRY_DELAY,
57
57
  aws_access_key: nil,
58
58
  aws_secret_key: nil,
59
59
  aws_session_token: nil,
@@ -165,6 +165,36 @@ module Anthropic
165
165
  request_input
166
166
  end
167
167
 
168
+ # @api private
169
+ #
170
+ # Very private API, do not use
171
+ #
172
+ # @param request [Hash{Symbol=>Object}] .
173
+ #
174
+ # @option request [Symbol] :method
175
+ #
176
+ # @option request [URI::Generic] :url
177
+ #
178
+ # @option request [Hash{String=>String}] :headers
179
+ #
180
+ # @option request [Object] :body
181
+ #
182
+ # @return [Hash{Symbol, Object}]
183
+ private def transform_request(request)
184
+ sliced = super.slice(
185
+ :method,
186
+ :url,
187
+ :headers,
188
+ :body
189
+ ).transform_keys(method: :http_method)
190
+ body = StringIO.new(body.to_a.join) if (body = sliced.fetch(:body)).is_a?(Enumerator)
191
+
192
+ signed = @signer.sign_request({**sliced, body: body})
193
+
194
+ headers = Anthropic::Internal::Util.normalized_headers(request.fetch(:headers), signed.headers)
195
+ {**request, headers: headers}
196
+ end
197
+
168
198
  # @param aws_region [String, nil]
169
199
  #
170
200
  # @param aws_secret_key [String, nil]
@@ -341,6 +341,23 @@ module Anthropic
341
341
  (@initial_retry_delay * scale * jitter).clamp(0, @max_retry_delay)
342
342
  end
343
343
 
344
+ # @api private
345
+ #
346
+ # Very private API, do not use
347
+ #
348
+ # @param request [Hash{Symbol=>Object}] .
349
+ #
350
+ # @option request [Symbol] :method
351
+ #
352
+ # @option request [URI::Generic] :url
353
+ #
354
+ # @option request [Hash{String=>String}] :headers
355
+ #
356
+ # @option request [Object] :body
357
+ #
358
+ # @return [Hash{Symbol, Object}]
359
+ private def transform_request(request) = request
360
+
344
361
  # @api private
345
362
  #
346
363
  # @param request [Hash{Symbol=>Object}] .
@@ -366,6 +383,7 @@ module Anthropic
366
383
  # @raise [Anthropic::Errors::APIError]
367
384
  # @return [Array(Integer, Net::HTTPResponse, Enumerable<String>)]
368
385
  def send_request(request, redirect_count:, retry_count:, send_retry_header:)
386
+ request = transform_request(request)
369
387
  url, headers, max_retries, timeout = request.fetch_values(:url, :headers, :max_retries, :timeout)
370
388
  input = {**request.except(:timeout), deadline: Anthropic::Internal::Util.monotonic_secs + timeout}
371
389
 
@@ -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 =
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Anthropic
4
- VERSION = "1.4.0"
4
+ VERSION = "1.5.0"
5
5
  end
data/lib/anthropic.rb CHANGED
@@ -222,6 +222,8 @@ require_relative "anthropic/models/citation_page_location"
222
222
  require_relative "anthropic/models/citation_page_location_param"
223
223
  require_relative "anthropic/models/citations_config_param"
224
224
  require_relative "anthropic/models/citations_delta"
225
+ require_relative "anthropic/models/citation_search_result_location_param"
226
+ require_relative "anthropic/models/citations_search_result_location"
225
227
  require_relative "anthropic/models/citations_web_search_result_location"
226
228
  require_relative "anthropic/models/citation_web_search_result_location_param"
227
229
  require_relative "anthropic/models/completion"
@@ -279,6 +281,7 @@ require_relative "anthropic/models/raw_message_stop_event"
279
281
  require_relative "anthropic/models/raw_message_stream_event"
280
282
  require_relative "anthropic/models/redacted_thinking_block"
281
283
  require_relative "anthropic/models/redacted_thinking_block_param"
284
+ require_relative "anthropic/models/search_result_block_param"
282
285
  require_relative "anthropic/models/server_tool_usage"
283
286
  require_relative "anthropic/models/server_tool_use_block"
284
287
  require_relative "anthropic/models/server_tool_use_block_param"
@@ -0,0 +1,74 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ class CitationSearchResultLocationParam < Anthropic::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(
9
+ Anthropic::CitationSearchResultLocationParam,
10
+ Anthropic::Internal::AnyHash
11
+ )
12
+ end
13
+
14
+ sig { returns(String) }
15
+ attr_accessor :cited_text
16
+
17
+ sig { returns(Integer) }
18
+ attr_accessor :end_block_index
19
+
20
+ sig { returns(Integer) }
21
+ attr_accessor :search_result_index
22
+
23
+ sig { returns(String) }
24
+ attr_accessor :source
25
+
26
+ sig { returns(Integer) }
27
+ attr_accessor :start_block_index
28
+
29
+ sig { returns(T.nilable(String)) }
30
+ attr_accessor :title
31
+
32
+ sig { returns(Symbol) }
33
+ attr_accessor :type
34
+
35
+ sig do
36
+ params(
37
+ cited_text: String,
38
+ end_block_index: Integer,
39
+ search_result_index: Integer,
40
+ source: String,
41
+ start_block_index: Integer,
42
+ title: T.nilable(String),
43
+ type: Symbol
44
+ ).returns(T.attached_class)
45
+ end
46
+ def self.new(
47
+ cited_text:,
48
+ end_block_index:,
49
+ search_result_index:,
50
+ source:,
51
+ start_block_index:,
52
+ title:,
53
+ type: :search_result_location
54
+ )
55
+ end
56
+
57
+ sig do
58
+ override.returns(
59
+ {
60
+ cited_text: String,
61
+ end_block_index: Integer,
62
+ search_result_index: Integer,
63
+ source: String,
64
+ start_block_index: Integer,
65
+ title: T.nilable(String),
66
+ type: Symbol
67
+ }
68
+ )
69
+ end
70
+ def to_hash
71
+ end
72
+ end
73
+ end
74
+ end
@@ -21,7 +21,8 @@ module Anthropic
21
21
  Anthropic::CitationCharLocation::OrHash,
22
22
  Anthropic::CitationPageLocation::OrHash,
23
23
  Anthropic::CitationContentBlockLocation::OrHash,
24
- Anthropic::CitationsWebSearchResultLocation::OrHash
24
+ Anthropic::CitationsWebSearchResultLocation::OrHash,
25
+ Anthropic::CitationsSearchResultLocation::OrHash
25
26
  ),
26
27
  type: Symbol
27
28
  ).returns(T.attached_class)
@@ -49,7 +50,8 @@ module Anthropic
49
50
  Anthropic::CitationCharLocation,
50
51
  Anthropic::CitationPageLocation,
51
52
  Anthropic::CitationContentBlockLocation,
52
- Anthropic::CitationsWebSearchResultLocation
53
+ Anthropic::CitationsWebSearchResultLocation,
54
+ Anthropic::CitationsSearchResultLocation
53
55
  )
54
56
  end
55
57
 
@@ -0,0 +1,74 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ class CitationsSearchResultLocation < Anthropic::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(
9
+ Anthropic::CitationsSearchResultLocation,
10
+ Anthropic::Internal::AnyHash
11
+ )
12
+ end
13
+
14
+ sig { returns(String) }
15
+ attr_accessor :cited_text
16
+
17
+ sig { returns(Integer) }
18
+ attr_accessor :end_block_index
19
+
20
+ sig { returns(Integer) }
21
+ attr_accessor :search_result_index
22
+
23
+ sig { returns(String) }
24
+ attr_accessor :source
25
+
26
+ sig { returns(Integer) }
27
+ attr_accessor :start_block_index
28
+
29
+ sig { returns(T.nilable(String)) }
30
+ attr_accessor :title
31
+
32
+ sig { returns(Symbol) }
33
+ attr_accessor :type
34
+
35
+ sig do
36
+ params(
37
+ cited_text: String,
38
+ end_block_index: Integer,
39
+ search_result_index: Integer,
40
+ source: String,
41
+ start_block_index: Integer,
42
+ title: T.nilable(String),
43
+ type: Symbol
44
+ ).returns(T.attached_class)
45
+ end
46
+ def self.new(
47
+ cited_text:,
48
+ end_block_index:,
49
+ search_result_index:,
50
+ source:,
51
+ start_block_index:,
52
+ title:,
53
+ type: :search_result_location
54
+ )
55
+ end
56
+
57
+ sig do
58
+ override.returns(
59
+ {
60
+ cited_text: String,
61
+ end_block_index: Integer,
62
+ search_result_index: Integer,
63
+ source: String,
64
+ start_block_index: Integer,
65
+ title: T.nilable(String),
66
+ type: Symbol
67
+ }
68
+ )
69
+ end
70
+ def to_hash
71
+ end
72
+ end
73
+ end
74
+ end
@@ -12,6 +12,7 @@ module Anthropic
12
12
  Anthropic::TextBlockParam,
13
13
  Anthropic::ImageBlockParam,
14
14
  Anthropic::DocumentBlockParam,
15
+ Anthropic::SearchResultBlockParam,
15
16
  Anthropic::ThinkingBlockParam,
16
17
  Anthropic::RedactedThinkingBlockParam,
17
18
  Anthropic::ToolUseBlockParam,
@@ -0,0 +1,77 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ class SearchResultBlockParam < Anthropic::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(Anthropic::SearchResultBlockParam, Anthropic::Internal::AnyHash)
9
+ end
10
+
11
+ sig { returns(T::Array[Anthropic::TextBlockParam]) }
12
+ attr_accessor :content
13
+
14
+ sig { returns(String) }
15
+ attr_accessor :source
16
+
17
+ sig { returns(String) }
18
+ attr_accessor :title
19
+
20
+ sig { returns(Symbol) }
21
+ attr_accessor :type
22
+
23
+ # Create a cache control breakpoint at this content block.
24
+ sig { returns(T.nilable(Anthropic::CacheControlEphemeral)) }
25
+ attr_reader :cache_control
26
+
27
+ sig do
28
+ params(
29
+ cache_control: T.nilable(Anthropic::CacheControlEphemeral::OrHash)
30
+ ).void
31
+ end
32
+ attr_writer :cache_control
33
+
34
+ sig { returns(T.nilable(Anthropic::CitationsConfigParam)) }
35
+ attr_reader :citations
36
+
37
+ sig { params(citations: Anthropic::CitationsConfigParam::OrHash).void }
38
+ attr_writer :citations
39
+
40
+ sig do
41
+ params(
42
+ content: T::Array[Anthropic::TextBlockParam::OrHash],
43
+ source: String,
44
+ title: String,
45
+ cache_control: T.nilable(Anthropic::CacheControlEphemeral::OrHash),
46
+ citations: Anthropic::CitationsConfigParam::OrHash,
47
+ type: Symbol
48
+ ).returns(T.attached_class)
49
+ end
50
+ def self.new(
51
+ content:,
52
+ source:,
53
+ title:,
54
+ # Create a cache control breakpoint at this content block.
55
+ cache_control: nil,
56
+ citations: nil,
57
+ type: :search_result
58
+ )
59
+ end
60
+
61
+ sig do
62
+ override.returns(
63
+ {
64
+ content: T::Array[Anthropic::TextBlockParam],
65
+ source: String,
66
+ title: String,
67
+ type: Symbol,
68
+ cache_control: T.nilable(Anthropic::CacheControlEphemeral),
69
+ citations: Anthropic::CitationsConfigParam
70
+ }
71
+ )
72
+ end
73
+ def to_hash
74
+ end
75
+ end
76
+ end
77
+ end
@@ -31,7 +31,8 @@ module Anthropic
31
31
  Anthropic::CitationCharLocation::OrHash,
32
32
  Anthropic::CitationPageLocation::OrHash,
33
33
  Anthropic::CitationContentBlockLocation::OrHash,
34
- Anthropic::CitationsWebSearchResultLocation::OrHash
34
+ Anthropic::CitationsWebSearchResultLocation::OrHash,
35
+ Anthropic::CitationsSearchResultLocation::OrHash
35
36
  )
36
37
  ]
37
38
  ),
@@ -33,7 +33,8 @@ module Anthropic
33
33
  Anthropic::CitationCharLocationParam,
34
34
  Anthropic::CitationPageLocationParam,
35
35
  Anthropic::CitationContentBlockLocationParam,
36
- Anthropic::CitationWebSearchResultLocationParam
36
+ Anthropic::CitationWebSearchResultLocationParam,
37
+ Anthropic::CitationSearchResultLocationParam
37
38
  )
38
39
  ]
39
40
  )
@@ -52,7 +53,8 @@ module Anthropic
52
53
  Anthropic::CitationCharLocationParam::OrHash,
53
54
  Anthropic::CitationPageLocationParam::OrHash,
54
55
  Anthropic::CitationContentBlockLocationParam::OrHash,
55
- Anthropic::CitationWebSearchResultLocationParam::OrHash
56
+ Anthropic::CitationWebSearchResultLocationParam::OrHash,
57
+ Anthropic::CitationSearchResultLocationParam::OrHash
56
58
  )
57
59
  ]
58
60
  ),
@@ -81,7 +83,8 @@ module Anthropic
81
83
  Anthropic::CitationCharLocationParam,
82
84
  Anthropic::CitationPageLocationParam,
83
85
  Anthropic::CitationContentBlockLocationParam,
84
- Anthropic::CitationWebSearchResultLocationParam
86
+ Anthropic::CitationWebSearchResultLocationParam,
87
+ Anthropic::CitationSearchResultLocationParam
85
88
  )
86
89
  ]
87
90
  )
@@ -11,7 +11,8 @@ module Anthropic
11
11
  Anthropic::CitationCharLocation,
12
12
  Anthropic::CitationPageLocation,
13
13
  Anthropic::CitationContentBlockLocation,
14
- Anthropic::CitationsWebSearchResultLocation
14
+ Anthropic::CitationsWebSearchResultLocation,
15
+ Anthropic::CitationsSearchResultLocation
15
16
  )
16
17
  end
17
18
 
@@ -11,7 +11,8 @@ module Anthropic
11
11
  Anthropic::CitationCharLocationParam,
12
12
  Anthropic::CitationPageLocationParam,
13
13
  Anthropic::CitationContentBlockLocationParam,
14
- Anthropic::CitationWebSearchResultLocationParam
14
+ Anthropic::CitationWebSearchResultLocationParam,
15
+ Anthropic::CitationSearchResultLocationParam
15
16
  )
16
17
  end
17
18
 
@@ -92,7 +92,11 @@ module Anthropic
92
92
 
93
93
  Variants =
94
94
  T.type_alias do
95
- T.any(Anthropic::TextBlockParam, Anthropic::ImageBlockParam)
95
+ T.any(
96
+ Anthropic::TextBlockParam,
97
+ Anthropic::ImageBlockParam,
98
+ Anthropic::SearchResultBlockParam
99
+ )
96
100
  end
97
101
 
98
102
  sig do
@@ -56,6 +56,12 @@ module Anthropic
56
56
 
57
57
  CitationsDelta = Anthropic::Models::CitationsDelta
58
58
 
59
+ CitationSearchResultLocationParam =
60
+ Anthropic::Models::CitationSearchResultLocationParam
61
+
62
+ CitationsSearchResultLocation =
63
+ Anthropic::Models::CitationsSearchResultLocation
64
+
59
65
  CitationsWebSearchResultLocation =
60
66
  Anthropic::Models::CitationsWebSearchResultLocation
61
67
 
@@ -144,6 +150,8 @@ module Anthropic
144
150
 
145
151
  RedactedThinkingBlockParam = Anthropic::Models::RedactedThinkingBlockParam
146
152
 
153
+ SearchResultBlockParam = Anthropic::Models::SearchResultBlockParam
154
+
147
155
  ServerToolUsage = Anthropic::Models::ServerToolUsage
148
156
 
149
157
  ServerToolUseBlock = Anthropic::Models::ServerToolUseBlock
@@ -0,0 +1,50 @@
1
+ module Anthropic
2
+ module Models
3
+ type citation_search_result_location_param =
4
+ {
5
+ cited_text: String,
6
+ end_block_index: Integer,
7
+ search_result_index: Integer,
8
+ source: String,
9
+ start_block_index: Integer,
10
+ title: String?,
11
+ type: :search_result_location
12
+ }
13
+
14
+ class CitationSearchResultLocationParam < Anthropic::Internal::Type::BaseModel
15
+ attr_accessor cited_text: String
16
+
17
+ attr_accessor end_block_index: Integer
18
+
19
+ attr_accessor search_result_index: Integer
20
+
21
+ attr_accessor source: String
22
+
23
+ attr_accessor start_block_index: Integer
24
+
25
+ attr_accessor title: String?
26
+
27
+ attr_accessor type: :search_result_location
28
+
29
+ def initialize: (
30
+ cited_text: String,
31
+ end_block_index: Integer,
32
+ search_result_index: Integer,
33
+ source: String,
34
+ start_block_index: Integer,
35
+ title: String?,
36
+ ?type: :search_result_location
37
+ ) -> void
38
+
39
+ def to_hash: -> {
40
+ cited_text: String,
41
+ end_block_index: Integer,
42
+ search_result_index: Integer,
43
+ source: String,
44
+ start_block_index: Integer,
45
+ title: String?,
46
+ type: :search_result_location
47
+ }
48
+ end
49
+ end
50
+ end
@@ -26,6 +26,7 @@ module Anthropic
26
26
  | Anthropic::CitationPageLocation
27
27
  | Anthropic::CitationContentBlockLocation
28
28
  | Anthropic::CitationsWebSearchResultLocation
29
+ | Anthropic::CitationsSearchResultLocation
29
30
 
30
31
  module Citation
31
32
  extend Anthropic::Internal::Type::Union
@@ -0,0 +1,50 @@
1
+ module Anthropic
2
+ module Models
3
+ type citations_search_result_location =
4
+ {
5
+ cited_text: String,
6
+ end_block_index: Integer,
7
+ search_result_index: Integer,
8
+ source: String,
9
+ start_block_index: Integer,
10
+ title: String?,
11
+ type: :search_result_location
12
+ }
13
+
14
+ class CitationsSearchResultLocation < Anthropic::Internal::Type::BaseModel
15
+ attr_accessor cited_text: String
16
+
17
+ attr_accessor end_block_index: Integer
18
+
19
+ attr_accessor search_result_index: Integer
20
+
21
+ attr_accessor source: String
22
+
23
+ attr_accessor start_block_index: Integer
24
+
25
+ attr_accessor title: String?
26
+
27
+ attr_accessor type: :search_result_location
28
+
29
+ def initialize: (
30
+ cited_text: String,
31
+ end_block_index: Integer,
32
+ search_result_index: Integer,
33
+ source: String,
34
+ start_block_index: Integer,
35
+ title: String?,
36
+ ?type: :search_result_location
37
+ ) -> void
38
+
39
+ def to_hash: -> {
40
+ cited_text: String,
41
+ end_block_index: Integer,
42
+ search_result_index: Integer,
43
+ source: String,
44
+ start_block_index: Integer,
45
+ title: String?,
46
+ type: :search_result_location
47
+ }
48
+ end
49
+ end
50
+ end
@@ -4,6 +4,7 @@ module Anthropic
4
4
  Anthropic::TextBlockParam
5
5
  | Anthropic::ImageBlockParam
6
6
  | Anthropic::DocumentBlockParam
7
+ | Anthropic::SearchResultBlockParam
7
8
  | Anthropic::ThinkingBlockParam
8
9
  | Anthropic::RedactedThinkingBlockParam
9
10
  | Anthropic::ToolUseBlockParam
@@ -0,0 +1,49 @@
1
+ module Anthropic
2
+ module Models
3
+ type search_result_block_param =
4
+ {
5
+ content: ::Array[Anthropic::TextBlockParam],
6
+ source: String,
7
+ title: String,
8
+ type: :search_result,
9
+ cache_control: Anthropic::CacheControlEphemeral?,
10
+ citations: Anthropic::CitationsConfigParam
11
+ }
12
+
13
+ class SearchResultBlockParam < Anthropic::Internal::Type::BaseModel
14
+ attr_accessor content: ::Array[Anthropic::TextBlockParam]
15
+
16
+ attr_accessor source: String
17
+
18
+ attr_accessor title: String
19
+
20
+ attr_accessor type: :search_result
21
+
22
+ attr_accessor cache_control: Anthropic::CacheControlEphemeral?
23
+
24
+ attr_reader citations: Anthropic::CitationsConfigParam?
25
+
26
+ def citations=: (
27
+ Anthropic::CitationsConfigParam
28
+ ) -> Anthropic::CitationsConfigParam
29
+
30
+ def initialize: (
31
+ content: ::Array[Anthropic::TextBlockParam],
32
+ source: String,
33
+ title: String,
34
+ ?cache_control: Anthropic::CacheControlEphemeral?,
35
+ ?citations: Anthropic::CitationsConfigParam,
36
+ ?type: :search_result
37
+ ) -> void
38
+
39
+ def to_hash: -> {
40
+ content: ::Array[Anthropic::TextBlockParam],
41
+ source: String,
42
+ title: String,
43
+ type: :search_result,
44
+ cache_control: Anthropic::CacheControlEphemeral?,
45
+ citations: Anthropic::CitationsConfigParam
46
+ }
47
+ end
48
+ end
49
+ end
@@ -5,6 +5,7 @@ module Anthropic
5
5
  | Anthropic::CitationPageLocation
6
6
  | Anthropic::CitationContentBlockLocation
7
7
  | Anthropic::CitationsWebSearchResultLocation
8
+ | Anthropic::CitationsSearchResultLocation
8
9
 
9
10
  module TextCitation
10
11
  extend Anthropic::Internal::Type::Union
@@ -5,6 +5,7 @@ module Anthropic
5
5
  | Anthropic::CitationPageLocationParam
6
6
  | Anthropic::CitationContentBlockLocationParam
7
7
  | Anthropic::CitationWebSearchResultLocationParam
8
+ | Anthropic::CitationSearchResultLocationParam
8
9
 
9
10
  module TextCitationParam
10
11
  extend Anthropic::Internal::Type::Union
@@ -49,7 +49,10 @@ module Anthropic
49
49
  module Content
50
50
  extend Anthropic::Internal::Type::Union
51
51
 
52
- type content = Anthropic::TextBlockParam | Anthropic::ImageBlockParam
52
+ type content =
53
+ Anthropic::TextBlockParam
54
+ | Anthropic::ImageBlockParam
55
+ | Anthropic::SearchResultBlockParam
53
56
 
54
57
  module Content
55
58
  extend Anthropic::Internal::Type::Union
@@ -53,6 +53,10 @@ module Anthropic
53
53
 
54
54
  class CitationsDelta = Anthropic::Models::CitationsDelta
55
55
 
56
+ class CitationSearchResultLocationParam = Anthropic::Models::CitationSearchResultLocationParam
57
+
58
+ class CitationsSearchResultLocation = Anthropic::Models::CitationsSearchResultLocation
59
+
56
60
  class CitationsWebSearchResultLocation = Anthropic::Models::CitationsWebSearchResultLocation
57
61
 
58
62
  class CitationWebSearchResultLocationParam = Anthropic::Models::CitationWebSearchResultLocationParam
@@ -139,6 +143,8 @@ module Anthropic
139
143
 
140
144
  class RedactedThinkingBlockParam = Anthropic::Models::RedactedThinkingBlockParam
141
145
 
146
+ class SearchResultBlockParam = Anthropic::Models::SearchResultBlockParam
147
+
142
148
  class ServerToolUsage = Anthropic::Models::ServerToolUsage
143
149
 
144
150
  class ServerToolUseBlock = Anthropic::Models::ServerToolUseBlock
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.0
4
+ version: 1.5.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-05 00:00:00.000000000 Z
11
+ date: 2025-08-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: connection_pool
@@ -227,9 +227,11 @@ files:
227
227
  - lib/anthropic/models/citation_content_block_location_param.rb
228
228
  - lib/anthropic/models/citation_page_location.rb
229
229
  - lib/anthropic/models/citation_page_location_param.rb
230
+ - lib/anthropic/models/citation_search_result_location_param.rb
230
231
  - lib/anthropic/models/citation_web_search_result_location_param.rb
231
232
  - lib/anthropic/models/citations_config_param.rb
232
233
  - lib/anthropic/models/citations_delta.rb
234
+ - lib/anthropic/models/citations_search_result_location.rb
233
235
  - lib/anthropic/models/citations_web_search_result_location.rb
234
236
  - lib/anthropic/models/completion.rb
235
237
  - lib/anthropic/models/completion_create_params.rb
@@ -286,6 +288,7 @@ files:
286
288
  - lib/anthropic/models/raw_message_stream_event.rb
287
289
  - lib/anthropic/models/redacted_thinking_block.rb
288
290
  - lib/anthropic/models/redacted_thinking_block_param.rb
291
+ - lib/anthropic/models/search_result_block_param.rb
289
292
  - lib/anthropic/models/server_tool_usage.rb
290
293
  - lib/anthropic/models/server_tool_use_block.rb
291
294
  - lib/anthropic/models/server_tool_use_block_param.rb
@@ -532,9 +535,11 @@ files:
532
535
  - rbi/anthropic/models/citation_content_block_location_param.rbi
533
536
  - rbi/anthropic/models/citation_page_location.rbi
534
537
  - rbi/anthropic/models/citation_page_location_param.rbi
538
+ - rbi/anthropic/models/citation_search_result_location_param.rbi
535
539
  - rbi/anthropic/models/citation_web_search_result_location_param.rbi
536
540
  - rbi/anthropic/models/citations_config_param.rbi
537
541
  - rbi/anthropic/models/citations_delta.rbi
542
+ - rbi/anthropic/models/citations_search_result_location.rbi
538
543
  - rbi/anthropic/models/citations_web_search_result_location.rbi
539
544
  - rbi/anthropic/models/completion.rbi
540
545
  - rbi/anthropic/models/completion_create_params.rbi
@@ -591,6 +596,7 @@ files:
591
596
  - rbi/anthropic/models/raw_message_stream_event.rbi
592
597
  - rbi/anthropic/models/redacted_thinking_block.rbi
593
598
  - rbi/anthropic/models/redacted_thinking_block_param.rbi
599
+ - rbi/anthropic/models/search_result_block_param.rbi
594
600
  - rbi/anthropic/models/server_tool_usage.rbi
595
601
  - rbi/anthropic/models/server_tool_use_block.rbi
596
602
  - rbi/anthropic/models/server_tool_use_block_param.rbi
@@ -836,9 +842,11 @@ files:
836
842
  - sig/anthropic/models/citation_content_block_location_param.rbs
837
843
  - sig/anthropic/models/citation_page_location.rbs
838
844
  - sig/anthropic/models/citation_page_location_param.rbs
845
+ - sig/anthropic/models/citation_search_result_location_param.rbs
839
846
  - sig/anthropic/models/citation_web_search_result_location_param.rbs
840
847
  - sig/anthropic/models/citations_config_param.rbs
841
848
  - sig/anthropic/models/citations_delta.rbs
849
+ - sig/anthropic/models/citations_search_result_location.rbs
842
850
  - sig/anthropic/models/citations_web_search_result_location.rbs
843
851
  - sig/anthropic/models/completion.rbs
844
852
  - sig/anthropic/models/completion_create_params.rbs
@@ -895,6 +903,7 @@ files:
895
903
  - sig/anthropic/models/raw_message_stream_event.rbs
896
904
  - sig/anthropic/models/redacted_thinking_block.rbs
897
905
  - sig/anthropic/models/redacted_thinking_block_param.rbs
906
+ - sig/anthropic/models/search_result_block_param.rbs
898
907
  - sig/anthropic/models/server_tool_usage.rbs
899
908
  - sig/anthropic/models/server_tool_use_block.rbs
900
909
  - sig/anthropic/models/server_tool_use_block_param.rbs