anthropic 1.1.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.
Files changed (197) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +123 -0
  3. data/README.md +32 -16
  4. data/lib/anthropic/client.rb +5 -2
  5. data/lib/anthropic/errors.rb +22 -0
  6. data/lib/anthropic/helpers/bedrock/client.rb +34 -4
  7. data/lib/anthropic/helpers/streaming/events.rb +141 -0
  8. data/lib/anthropic/helpers/streaming/message_stream.rb +238 -0
  9. data/lib/anthropic/helpers/streaming.rb +37 -0
  10. data/lib/anthropic/helpers/vertex/client.rb +4 -1
  11. data/lib/anthropic/internal/stream.rb +4 -2
  12. data/lib/anthropic/internal/transport/base_client.rb +29 -3
  13. data/lib/anthropic/internal/type/array_of.rb +7 -1
  14. data/lib/anthropic/internal/type/base_model.rb +80 -24
  15. data/lib/anthropic/internal/type/base_stream.rb +3 -1
  16. data/lib/anthropic/internal/type/boolean.rb +7 -1
  17. data/lib/anthropic/internal/type/converter.rb +69 -34
  18. data/lib/anthropic/internal/type/enum.rb +16 -5
  19. data/lib/anthropic/internal/type/file_input.rb +6 -1
  20. data/lib/anthropic/internal/type/hash_of.rb +7 -1
  21. data/lib/anthropic/internal/type/union.rb +26 -16
  22. data/lib/anthropic/internal/type/unknown.rb +7 -1
  23. data/lib/anthropic/internal/util.rb +8 -9
  24. data/lib/anthropic/models/anthropic_beta.rb +3 -0
  25. data/lib/anthropic/models/beta/beta_base64_pdf_block.rb +1 -65
  26. data/lib/anthropic/models/beta/beta_citation_char_location.rb +7 -1
  27. data/lib/anthropic/models/beta/beta_citation_content_block_location.rb +7 -1
  28. data/lib/anthropic/models/beta/beta_citation_page_location.rb +7 -1
  29. data/lib/anthropic/models/beta/beta_citation_search_result_location.rb +55 -0
  30. data/lib/anthropic/models/beta/beta_citation_search_result_location_param.rb +55 -0
  31. data/lib/anthropic/models/beta/beta_citations_delta.rb +5 -3
  32. data/lib/anthropic/models/beta/beta_content_block.rb +5 -5
  33. data/lib/anthropic/models/beta/beta_content_block_param.rb +20 -17
  34. data/lib/anthropic/models/beta/beta_message.rb +6 -2
  35. data/lib/anthropic/models/beta/beta_message_param.rb +3 -3
  36. data/lib/anthropic/models/beta/beta_raw_content_block_start_event.rb +7 -7
  37. data/lib/anthropic/models/beta/beta_request_document_block.rb +75 -0
  38. data/lib/anthropic/models/beta/beta_search_result_block_param.rb +55 -0
  39. data/lib/anthropic/models/beta/beta_text_block.rb +2 -2
  40. data/lib/anthropic/models/beta/beta_text_block_param.rb +2 -2
  41. data/lib/anthropic/models/beta/beta_text_citation.rb +3 -1
  42. data/lib/anthropic/models/beta/beta_text_citation_param.rb +3 -1
  43. data/lib/anthropic/models/beta/beta_tool.rb +7 -1
  44. data/lib/anthropic/models/beta/beta_tool_result_block_param.rb +6 -4
  45. data/lib/anthropic/models/beta/beta_tool_text_editor_20250728.rb +49 -0
  46. data/lib/anthropic/models/beta/beta_tool_union.rb +9 -7
  47. data/lib/anthropic/models/beta/message_count_tokens_params.rb +18 -10
  48. data/lib/anthropic/models/beta/message_create_params.rb +9 -3
  49. data/lib/anthropic/models/beta/messages/batch_create_params.rb +9 -3
  50. data/lib/anthropic/models/citation_char_location.rb +7 -1
  51. data/lib/anthropic/models/citation_content_block_location.rb +7 -1
  52. data/lib/anthropic/models/citation_page_location.rb +7 -1
  53. data/lib/anthropic/models/citation_search_result_location_param.rb +51 -0
  54. data/lib/anthropic/models/citations_delta.rb +5 -3
  55. data/lib/anthropic/models/citations_search_result_location.rb +51 -0
  56. data/lib/anthropic/models/content_block.rb +5 -5
  57. data/lib/anthropic/models/content_block_param.rb +14 -11
  58. data/lib/anthropic/models/message.rb +6 -2
  59. data/lib/anthropic/models/message_count_tokens_params.rb +9 -3
  60. data/lib/anthropic/models/message_count_tokens_tool.rb +5 -1
  61. data/lib/anthropic/models/message_create_params.rb +9 -3
  62. data/lib/anthropic/models/message_param.rb +3 -3
  63. data/lib/anthropic/models/messages/batch_create_params.rb +9 -3
  64. data/lib/anthropic/models/model.rb +10 -21
  65. data/lib/anthropic/models/raw_content_block_start_event.rb +7 -7
  66. data/lib/anthropic/models/search_result_block_param.rb +51 -0
  67. data/lib/anthropic/models/text_block.rb +2 -2
  68. data/lib/anthropic/models/text_block_param.rb +2 -2
  69. data/lib/anthropic/models/text_citation.rb +3 -1
  70. data/lib/anthropic/models/text_citation_param.rb +3 -1
  71. data/lib/anthropic/models/tool.rb +7 -1
  72. data/lib/anthropic/models/tool_result_block_param.rb +6 -4
  73. data/lib/anthropic/models/tool_text_editor_20250429.rb +36 -0
  74. data/lib/anthropic/models/tool_text_editor_20250728.rb +45 -0
  75. data/lib/anthropic/models/tool_union.rb +5 -1
  76. data/lib/anthropic/models/tool_use_block.rb +6 -0
  77. data/lib/anthropic/models.rb +14 -4
  78. data/lib/anthropic/resources/beta/messages.rb +73 -6
  79. data/lib/anthropic/resources/messages.rb +68 -7
  80. data/lib/anthropic/streaming.rb +5 -0
  81. data/lib/anthropic/version.rb +1 -1
  82. data/lib/anthropic.rb +14 -0
  83. data/rbi/anthropic/errors.rbi +16 -0
  84. data/rbi/anthropic/helpers/bedrock/client.rbi +17 -6
  85. data/rbi/anthropic/helpers/streaming/events.rbi +95 -0
  86. data/rbi/anthropic/helpers/streaming/message_stream.rbi +73 -0
  87. data/rbi/anthropic/helpers/vertex/client.rbi +17 -6
  88. data/rbi/anthropic/internal/transport/base_client.rbi +1 -1
  89. data/rbi/anthropic/internal/type/base_stream.rbi +8 -1
  90. data/rbi/anthropic/internal/type/boolean.rbi +2 -0
  91. data/rbi/anthropic/internal/type/converter.rbi +69 -15
  92. data/rbi/anthropic/internal/type/union.rbi +14 -2
  93. data/rbi/anthropic/internal/type/unknown.rbi +2 -0
  94. data/rbi/anthropic/internal/util.rbi +2 -0
  95. data/rbi/anthropic/models/anthropic_beta.rbi +2 -0
  96. data/rbi/anthropic/models/beta/beta_base64_pdf_block.rbi +1 -128
  97. data/rbi/anthropic/models/beta/beta_citation_char_location.rbi +6 -0
  98. data/rbi/anthropic/models/beta/beta_citation_content_block_location.rbi +6 -0
  99. data/rbi/anthropic/models/beta/beta_citation_page_location.rbi +6 -0
  100. data/rbi/anthropic/models/beta/beta_citation_search_result_location.rbi +78 -0
  101. data/rbi/anthropic/models/beta/beta_citation_search_result_location_param.rbi +79 -0
  102. data/rbi/anthropic/models/beta/beta_citations_delta.rbi +4 -2
  103. data/rbi/anthropic/models/beta/beta_content_block.rbi +3 -3
  104. data/rbi/anthropic/models/beta/beta_content_block_param.rbi +8 -7
  105. data/rbi/anthropic/models/beta/beta_message.rbi +11 -3
  106. data/rbi/anthropic/models/beta/beta_raw_content_block_start_event.rbi +6 -6
  107. data/rbi/anthropic/models/beta/beta_request_document_block.rbi +140 -0
  108. data/rbi/anthropic/models/beta/beta_search_result_block_param.rbi +91 -0
  109. data/rbi/anthropic/models/beta/beta_text_block.rbi +2 -1
  110. data/rbi/anthropic/models/beta/beta_text_block_param.rbi +6 -3
  111. data/rbi/anthropic/models/beta/beta_text_citation.rbi +2 -1
  112. data/rbi/anthropic/models/beta/beta_text_citation_param.rbi +2 -1
  113. data/rbi/anthropic/models/beta/beta_tool.rbi +14 -5
  114. data/rbi/anthropic/models/beta/beta_tool_result_block_param.rbi +2 -1
  115. data/rbi/anthropic/models/beta/beta_tool_text_editor_20250728.rbi +82 -0
  116. data/rbi/anthropic/models/beta/beta_tool_union.rbi +6 -5
  117. data/rbi/anthropic/models/beta/message_count_tokens_params.rbi +44 -27
  118. data/rbi/anthropic/models/beta/message_create_params.rbi +38 -22
  119. data/rbi/anthropic/models/beta/messages/batch_create_params.rbi +38 -22
  120. data/rbi/anthropic/models/citation_char_location.rbi +6 -0
  121. data/rbi/anthropic/models/citation_content_block_location.rbi +6 -0
  122. data/rbi/anthropic/models/citation_page_location.rbi +6 -0
  123. data/rbi/anthropic/models/citation_search_result_location_param.rbi +74 -0
  124. data/rbi/anthropic/models/citations_delta.rbi +4 -2
  125. data/rbi/anthropic/models/citations_search_result_location.rbi +74 -0
  126. data/rbi/anthropic/models/content_block.rbi +3 -3
  127. data/rbi/anthropic/models/content_block_param.rbi +6 -5
  128. data/rbi/anthropic/models/message.rbi +11 -3
  129. data/rbi/anthropic/models/message_count_tokens_params.rbi +22 -2
  130. data/rbi/anthropic/models/message_count_tokens_tool.rbi +2 -0
  131. data/rbi/anthropic/models/message_create_params.rbi +22 -2
  132. data/rbi/anthropic/models/messages/batch_create_params.rbi +22 -2
  133. data/rbi/anthropic/models/model.rbi +4 -8
  134. data/rbi/anthropic/models/raw_content_block_start_event.rbi +6 -6
  135. data/rbi/anthropic/models/search_result_block_param.rbi +77 -0
  136. data/rbi/anthropic/models/text_block.rbi +2 -1
  137. data/rbi/anthropic/models/text_block_param.rbi +6 -3
  138. data/rbi/anthropic/models/text_citation.rbi +2 -1
  139. data/rbi/anthropic/models/text_citation_param.rbi +2 -1
  140. data/rbi/anthropic/models/tool.rbi +16 -5
  141. data/rbi/anthropic/models/tool_result_block_param.rbi +5 -1
  142. data/rbi/anthropic/models/tool_text_editor_20250429.rbi +62 -0
  143. data/rbi/anthropic/models/tool_text_editor_20250728.rbi +72 -0
  144. data/rbi/anthropic/models/tool_union.rbi +2 -0
  145. data/rbi/anthropic/models.rbi +12 -0
  146. data/rbi/anthropic/resources/beta/messages.rbi +39 -18
  147. data/rbi/anthropic/resources/messages.rbi +318 -3
  148. data/rbi/anthropic/streaming.rbi +5 -0
  149. data/sig/anthropic/errors.rbs +9 -0
  150. data/sig/anthropic/helpers/streaming/events.rbs +117 -0
  151. data/sig/anthropic/helpers/streaming/message_stream.rbs +57 -0
  152. data/sig/anthropic/internal/transport/base_client.rbs +1 -1
  153. data/sig/anthropic/internal/type/base_stream.rbs +4 -0
  154. data/sig/anthropic/internal/type/converter.rbs +24 -1
  155. data/sig/anthropic/internal/type/union.rbs +2 -2
  156. data/sig/anthropic/models/anthropic_beta.rbs +2 -0
  157. data/sig/anthropic/models/beta/beta_base64_pdf_block.rbs +1 -58
  158. data/sig/anthropic/models/beta/beta_citation_char_location.rbs +5 -0
  159. data/sig/anthropic/models/beta/beta_citation_content_block_location.rbs +5 -0
  160. data/sig/anthropic/models/beta/beta_citation_page_location.rbs +5 -0
  161. data/sig/anthropic/models/beta/beta_citation_search_result_location.rbs +54 -0
  162. data/sig/anthropic/models/beta/beta_citation_search_result_location_param.rbs +54 -0
  163. data/sig/anthropic/models/beta/beta_citations_delta.rbs +1 -0
  164. data/sig/anthropic/models/beta/beta_content_block.rbs +2 -2
  165. data/sig/anthropic/models/beta/beta_content_block_param.rbs +9 -8
  166. data/sig/anthropic/models/beta/beta_raw_content_block_start_event.rbs +2 -2
  167. data/sig/anthropic/models/beta/beta_request_document_block.rbs +66 -0
  168. data/sig/anthropic/models/beta/beta_search_result_block_param.rbs +53 -0
  169. data/sig/anthropic/models/beta/beta_text_citation.rbs +1 -0
  170. data/sig/anthropic/models/beta/beta_text_citation_param.rbs +1 -0
  171. data/sig/anthropic/models/beta/beta_tool.rbs +14 -3
  172. data/sig/anthropic/models/beta/beta_tool_result_block_param.rbs +1 -0
  173. data/sig/anthropic/models/beta/beta_tool_text_editor_20250728.rbs +39 -0
  174. data/sig/anthropic/models/beta/beta_tool_union.rbs +5 -4
  175. data/sig/anthropic/models/beta/message_count_tokens_params.rbs +5 -4
  176. data/sig/anthropic/models/citation_char_location.rbs +5 -0
  177. data/sig/anthropic/models/citation_content_block_location.rbs +5 -0
  178. data/sig/anthropic/models/citation_page_location.rbs +5 -0
  179. data/sig/anthropic/models/citation_search_result_location_param.rbs +50 -0
  180. data/sig/anthropic/models/citations_delta.rbs +1 -0
  181. data/sig/anthropic/models/citations_search_result_location.rbs +50 -0
  182. data/sig/anthropic/models/content_block.rbs +2 -2
  183. data/sig/anthropic/models/content_block_param.rbs +6 -5
  184. data/sig/anthropic/models/message_count_tokens_tool.rbs +2 -0
  185. data/sig/anthropic/models/model.rbs +4 -10
  186. data/sig/anthropic/models/raw_content_block_start_event.rbs +2 -2
  187. data/sig/anthropic/models/search_result_block_param.rbs +49 -0
  188. data/sig/anthropic/models/text_citation.rbs +1 -0
  189. data/sig/anthropic/models/text_citation_param.rbs +1 -0
  190. data/sig/anthropic/models/tool.rbs +14 -3
  191. data/sig/anthropic/models/tool_result_block_param.rbs +4 -1
  192. data/sig/anthropic/models/tool_text_editor_20250429.rbs +30 -0
  193. data/sig/anthropic/models/tool_text_editor_20250728.rbs +35 -0
  194. data/sig/anthropic/models/tool_union.rbs +2 -0
  195. data/sig/anthropic/models.rbs +10 -0
  196. data/sig/anthropic/streaming.rbs +3 -0
  197. metadata +44 -3
@@ -0,0 +1,57 @@
1
+ module Anthropic
2
+ module Helpers
3
+ module Streaming
4
+ type raw_message_event =
5
+ Anthropic::Models::raw_message_start_event
6
+ | Anthropic::Models::raw_message_delta_event
7
+ | Anthropic::Models::raw_message_stop_event
8
+ | Anthropic::Models::raw_content_block_start_event
9
+ | Anthropic::Models::raw_content_block_delta_event
10
+ | Anthropic::Models::raw_content_block_stop_event
11
+
12
+ type stream_event =
13
+ raw_message_event
14
+ | text_event
15
+ | citation_event
16
+ | thinking_event
17
+ | signature_event
18
+ | input_json_event
19
+ | message_stop_event
20
+ | content_block_stop_event
21
+
22
+ class MessageStream
23
+ include Anthropic::Internal::Type::BaseStream[raw_message_event, stream_event]
24
+
25
+ @raw_stream: Anthropic::Internal::Stream[raw_message_event]
26
+ @accumated_message_snapshot: Anthropic::Models::message?
27
+ @iterator: Enumerable[stream_event]?
28
+
29
+ def initialize: (
30
+ raw_stream: Anthropic::Internal::Stream[raw_message_event]
31
+ ) -> void
32
+
33
+ def until_done: -> void
34
+
35
+ def text: -> Enumerator[String]
36
+
37
+ def accumulated_message: -> Anthropic::Models::message
38
+
39
+ def accumulated_text: -> String
40
+
41
+ private
42
+
43
+ def iterator: -> Enumerable[stream_event]
44
+
45
+ def accumulate_event: (
46
+ event: raw_message_event,
47
+ current_snapshot: Anthropic::Models::message?
48
+ ) -> Anthropic::Models::message
49
+
50
+ def build_events: (
51
+ event: raw_message_event,
52
+ message_snapshot: Anthropic::Models::message
53
+ ) -> ::Array[stream_event]
54
+ end
55
+ end
56
+ end
57
+ end
@@ -99,7 +99,7 @@ module Anthropic
99
99
  retry_count: Integer
100
100
  ) -> Float
101
101
 
102
- private def send_request: (
102
+ def send_request: (
103
103
  Anthropic::Internal::Transport::BaseClient::request_input request,
104
104
  redirect_count: Integer,
105
105
  retry_count: Integer,
@@ -23,6 +23,10 @@ module Anthropic
23
23
  url: URI::Generic,
24
24
  status: Integer,
25
25
  response: top,
26
+ unwrap: Symbol
27
+ | Integer
28
+ | ::Array[Symbol | Integer]
29
+ | ^(top arg0) -> top,
26
30
  stream: Enumerable[Message]
27
31
  ) -> void
28
32
 
@@ -8,8 +8,10 @@ module Anthropic
8
8
 
9
9
  type coerce_state =
10
10
  {
11
- strictness: bool | :strong,
11
+ translate_names: bool,
12
+ strictness: bool,
12
13
  exactness: { yes: Integer, no: Integer, maybe: Integer },
14
+ error: Class,
13
15
  branched: Integer
14
16
  }
15
17
 
@@ -37,6 +39,27 @@ module Anthropic
37
39
  | Anthropic::Internal::Type::Converter::input spec
38
40
  ) -> (^-> top)
39
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
+
59
+ def self.new_coerce_state: (
60
+ ?translate_names: bool
61
+ ) -> Anthropic::Internal::Type::Converter::coerce_state
62
+
40
63
  def self.coerce: (
41
64
  Anthropic::Internal::Type::Converter::input target,
42
65
  top value,
@@ -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
@@ -3,64 +3,7 @@ module Anthropic
3
3
  class BetaBase64PDFBlock = Beta::BetaBase64PDFBlock
4
4
 
5
5
  module Beta
6
- type beta_base64_pdf_block =
7
- {
8
- source: Anthropic::Models::Beta::BetaBase64PDFBlock::source,
9
- type: :document,
10
- cache_control: Anthropic::Beta::BetaCacheControlEphemeral?,
11
- citations: Anthropic::Beta::BetaCitationsConfigParam,
12
- context: String?,
13
- title: String?
14
- }
15
-
16
- class BetaBase64PDFBlock < Anthropic::Internal::Type::BaseModel
17
- attr_accessor source: Anthropic::Models::Beta::BetaBase64PDFBlock::source
18
-
19
- attr_accessor type: :document
20
-
21
- attr_accessor cache_control: Anthropic::Beta::BetaCacheControlEphemeral?
22
-
23
- attr_reader citations: Anthropic::Beta::BetaCitationsConfigParam?
24
-
25
- def citations=: (
26
- Anthropic::Beta::BetaCitationsConfigParam
27
- ) -> Anthropic::Beta::BetaCitationsConfigParam
28
-
29
- attr_accessor context: String?
30
-
31
- attr_accessor title: String?
32
-
33
- def initialize: (
34
- source: Anthropic::Models::Beta::BetaBase64PDFBlock::source,
35
- ?cache_control: Anthropic::Beta::BetaCacheControlEphemeral?,
36
- ?citations: Anthropic::Beta::BetaCitationsConfigParam,
37
- ?context: String?,
38
- ?title: String?,
39
- ?type: :document
40
- ) -> void
41
-
42
- def to_hash: -> {
43
- source: Anthropic::Models::Beta::BetaBase64PDFBlock::source,
44
- type: :document,
45
- cache_control: Anthropic::Beta::BetaCacheControlEphemeral?,
46
- citations: Anthropic::Beta::BetaCitationsConfigParam,
47
- context: String?,
48
- title: String?
49
- }
50
-
51
- type source =
52
- Anthropic::Beta::BetaBase64PDFSource
53
- | Anthropic::Beta::BetaPlainTextSource
54
- | Anthropic::Beta::BetaContentBlockSource
55
- | Anthropic::Beta::BetaURLPDFSource
56
- | Anthropic::Beta::BetaFileDocumentSource
57
-
58
- module Source
59
- extend Anthropic::Internal::Type::Union
60
-
61
- def self?.variants: -> ::Array[Anthropic::Models::Beta::BetaBase64PDFBlock::source]
62
- end
63
- end
6
+ class BetaBase64PDFBlock = Anthropic::Models::Beta::BetaRequestDocumentBlock
64
7
  end
65
8
  end
66
9
  end
@@ -9,6 +9,7 @@ module Anthropic
9
9
  document_index: Integer,
10
10
  document_title: String?,
11
11
  end_char_index: Integer,
12
+ file_id: String?,
12
13
  start_char_index: Integer,
13
14
  type: :char_location
14
15
  }
@@ -22,6 +23,8 @@ module Anthropic
22
23
 
23
24
  attr_accessor end_char_index: Integer
24
25
 
26
+ attr_accessor file_id: String?
27
+
25
28
  attr_accessor start_char_index: Integer
26
29
 
27
30
  attr_accessor type: :char_location
@@ -31,6 +34,7 @@ module Anthropic
31
34
  document_index: Integer,
32
35
  document_title: String?,
33
36
  end_char_index: Integer,
37
+ file_id: String?,
34
38
  start_char_index: Integer,
35
39
  ?type: :char_location
36
40
  ) -> void
@@ -40,6 +44,7 @@ module Anthropic
40
44
  document_index: Integer,
41
45
  document_title: String?,
42
46
  end_char_index: Integer,
47
+ file_id: String?,
43
48
  start_char_index: Integer,
44
49
  type: :char_location
45
50
  }
@@ -9,6 +9,7 @@ module Anthropic
9
9
  document_index: Integer,
10
10
  document_title: String?,
11
11
  end_block_index: Integer,
12
+ file_id: String?,
12
13
  start_block_index: Integer,
13
14
  type: :content_block_location
14
15
  }
@@ -22,6 +23,8 @@ module Anthropic
22
23
 
23
24
  attr_accessor end_block_index: Integer
24
25
 
26
+ attr_accessor file_id: String?
27
+
25
28
  attr_accessor start_block_index: Integer
26
29
 
27
30
  attr_accessor type: :content_block_location
@@ -31,6 +34,7 @@ module Anthropic
31
34
  document_index: Integer,
32
35
  document_title: String?,
33
36
  end_block_index: Integer,
37
+ file_id: String?,
34
38
  start_block_index: Integer,
35
39
  ?type: :content_block_location
36
40
  ) -> void
@@ -40,6 +44,7 @@ module Anthropic
40
44
  document_index: Integer,
41
45
  document_title: String?,
42
46
  end_block_index: Integer,
47
+ file_id: String?,
43
48
  start_block_index: Integer,
44
49
  type: :content_block_location
45
50
  }
@@ -9,6 +9,7 @@ module Anthropic
9
9
  document_index: Integer,
10
10
  document_title: String?,
11
11
  end_page_number: Integer,
12
+ file_id: String?,
12
13
  start_page_number: Integer,
13
14
  type: :page_location
14
15
  }
@@ -22,6 +23,8 @@ module Anthropic
22
23
 
23
24
  attr_accessor end_page_number: Integer
24
25
 
26
+ attr_accessor file_id: String?
27
+
25
28
  attr_accessor start_page_number: Integer
26
29
 
27
30
  attr_accessor type: :page_location
@@ -31,6 +34,7 @@ module Anthropic
31
34
  document_index: Integer,
32
35
  document_title: String?,
33
36
  end_page_number: Integer,
37
+ file_id: String?,
34
38
  start_page_number: Integer,
35
39
  ?type: :page_location
36
40
  ) -> void
@@ -40,6 +44,7 @@ module Anthropic
40
44
  document_index: Integer,
41
45
  document_title: String?,
42
46
  end_page_number: Integer,
47
+ file_id: String?,
43
48
  start_page_number: Integer,
44
49
  type: :page_location
45
50
  }
@@ -0,0 +1,54 @@
1
+ module Anthropic
2
+ module Models
3
+ class BetaCitationSearchResultLocation = Beta::BetaCitationSearchResultLocation
4
+
5
+ module Beta
6
+ type beta_citation_search_result_location =
7
+ {
8
+ cited_text: String,
9
+ end_block_index: Integer,
10
+ search_result_index: Integer,
11
+ source: String,
12
+ start_block_index: Integer,
13
+ title: String?,
14
+ type: :search_result_location
15
+ }
16
+
17
+ class BetaCitationSearchResultLocation < Anthropic::Internal::Type::BaseModel
18
+ attr_accessor cited_text: String
19
+
20
+ attr_accessor end_block_index: Integer
21
+
22
+ attr_accessor search_result_index: Integer
23
+
24
+ attr_accessor source: String
25
+
26
+ attr_accessor start_block_index: Integer
27
+
28
+ attr_accessor title: String?
29
+
30
+ attr_accessor type: :search_result_location
31
+
32
+ def initialize: (
33
+ cited_text: String,
34
+ end_block_index: Integer,
35
+ search_result_index: Integer,
36
+ source: String,
37
+ start_block_index: Integer,
38
+ title: String?,
39
+ ?type: :search_result_location
40
+ ) -> void
41
+
42
+ def to_hash: -> {
43
+ cited_text: String,
44
+ end_block_index: Integer,
45
+ search_result_index: Integer,
46
+ source: String,
47
+ start_block_index: Integer,
48
+ title: String?,
49
+ type: :search_result_location
50
+ }
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,54 @@
1
+ module Anthropic
2
+ module Models
3
+ class BetaCitationSearchResultLocationParam = Beta::BetaCitationSearchResultLocationParam
4
+
5
+ module Beta
6
+ type beta_citation_search_result_location_param =
7
+ {
8
+ cited_text: String,
9
+ end_block_index: Integer,
10
+ search_result_index: Integer,
11
+ source: String,
12
+ start_block_index: Integer,
13
+ title: String?,
14
+ type: :search_result_location
15
+ }
16
+
17
+ class BetaCitationSearchResultLocationParam < Anthropic::Internal::Type::BaseModel
18
+ attr_accessor cited_text: String
19
+
20
+ attr_accessor end_block_index: Integer
21
+
22
+ attr_accessor search_result_index: Integer
23
+
24
+ attr_accessor source: String
25
+
26
+ attr_accessor start_block_index: Integer
27
+
28
+ attr_accessor title: String?
29
+
30
+ attr_accessor type: :search_result_location
31
+
32
+ def initialize: (
33
+ cited_text: String,
34
+ end_block_index: Integer,
35
+ search_result_index: Integer,
36
+ source: String,
37
+ start_block_index: Integer,
38
+ title: String?,
39
+ ?type: :search_result_location
40
+ ) -> void
41
+
42
+ def to_hash: -> {
43
+ cited_text: String,
44
+ end_block_index: Integer,
45
+ search_result_index: Integer,
46
+ source: String,
47
+ start_block_index: Integer,
48
+ title: String?,
49
+ type: :search_result_location
50
+ }
51
+ end
52
+ end
53
+ end
54
+ end
@@ -29,6 +29,7 @@ module Anthropic
29
29
  | Anthropic::Beta::BetaCitationPageLocation
30
30
  | Anthropic::Beta::BetaCitationContentBlockLocation
31
31
  | Anthropic::Beta::BetaCitationsWebSearchResultLocation
32
+ | Anthropic::Beta::BetaCitationSearchResultLocation
32
33
 
33
34
  module Citation
34
35
  extend Anthropic::Internal::Type::Union
@@ -5,6 +5,8 @@ module Anthropic
5
5
  module Beta
6
6
  type beta_content_block =
7
7
  Anthropic::Beta::BetaTextBlock
8
+ | Anthropic::Beta::BetaThinkingBlock
9
+ | Anthropic::Beta::BetaRedactedThinkingBlock
8
10
  | Anthropic::Beta::BetaToolUseBlock
9
11
  | Anthropic::Beta::BetaServerToolUseBlock
10
12
  | Anthropic::Beta::BetaWebSearchToolResultBlock
@@ -12,8 +14,6 @@ module Anthropic
12
14
  | Anthropic::Beta::BetaMCPToolUseBlock
13
15
  | Anthropic::Beta::BetaMCPToolResultBlock
14
16
  | Anthropic::Beta::BetaContainerUploadBlock
15
- | Anthropic::Beta::BetaThinkingBlock
16
- | Anthropic::Beta::BetaRedactedThinkingBlock
17
17
 
18
18
  module BetaContentBlock
19
19
  extend Anthropic::Internal::Type::Union
@@ -4,18 +4,19 @@ module Anthropic
4
4
 
5
5
  module Beta
6
6
  type beta_content_block_param =
7
- Anthropic::Beta::BetaServerToolUseBlockParam
7
+ Anthropic::Beta::BetaTextBlockParam
8
+ | Anthropic::Beta::BetaImageBlockParam
9
+ | Anthropic::Beta::BetaRequestDocumentBlock
10
+ | Anthropic::Beta::BetaSearchResultBlockParam
11
+ | Anthropic::Beta::BetaThinkingBlockParam
12
+ | Anthropic::Beta::BetaRedactedThinkingBlockParam
13
+ | Anthropic::Beta::BetaToolUseBlockParam
14
+ | Anthropic::Beta::BetaToolResultBlockParam
15
+ | Anthropic::Beta::BetaServerToolUseBlockParam
8
16
  | Anthropic::Beta::BetaWebSearchToolResultBlockParam
9
17
  | Anthropic::Beta::BetaCodeExecutionToolResultBlockParam
10
18
  | Anthropic::Beta::BetaMCPToolUseBlockParam
11
19
  | Anthropic::Beta::BetaRequestMCPToolResultBlockParam
12
- | Anthropic::Beta::BetaTextBlockParam
13
- | Anthropic::Beta::BetaImageBlockParam
14
- | Anthropic::Beta::BetaToolUseBlockParam
15
- | Anthropic::Beta::BetaToolResultBlockParam
16
- | Anthropic::Beta::BetaBase64PDFBlock
17
- | Anthropic::Beta::BetaThinkingBlockParam
18
- | Anthropic::Beta::BetaRedactedThinkingBlockParam
19
20
  | Anthropic::Beta::BetaContainerUploadBlockParam
20
21
 
21
22
  module BetaContentBlockParam
@@ -31,6 +31,8 @@ module Anthropic
31
31
 
32
32
  type content_block =
33
33
  Anthropic::Beta::BetaTextBlock
34
+ | Anthropic::Beta::BetaThinkingBlock
35
+ | Anthropic::Beta::BetaRedactedThinkingBlock
34
36
  | Anthropic::Beta::BetaToolUseBlock
35
37
  | Anthropic::Beta::BetaServerToolUseBlock
36
38
  | Anthropic::Beta::BetaWebSearchToolResultBlock
@@ -38,8 +40,6 @@ module Anthropic
38
40
  | Anthropic::Beta::BetaMCPToolUseBlock
39
41
  | Anthropic::Beta::BetaMCPToolResultBlock
40
42
  | Anthropic::Beta::BetaContainerUploadBlock
41
- | Anthropic::Beta::BetaThinkingBlock
42
- | Anthropic::Beta::BetaRedactedThinkingBlock
43
43
 
44
44
  module ContentBlock
45
45
  extend Anthropic::Internal::Type::Union
@@ -0,0 +1,66 @@
1
+ module Anthropic
2
+ module Models
3
+ class BetaRequestDocumentBlock = Beta::BetaRequestDocumentBlock
4
+
5
+ module Beta
6
+ type beta_request_document_block =
7
+ {
8
+ source: Anthropic::Models::Beta::BetaRequestDocumentBlock::source,
9
+ type: :document,
10
+ cache_control: Anthropic::Beta::BetaCacheControlEphemeral?,
11
+ citations: Anthropic::Beta::BetaCitationsConfigParam,
12
+ context: String?,
13
+ title: String?
14
+ }
15
+
16
+ class BetaRequestDocumentBlock < Anthropic::Internal::Type::BaseModel
17
+ attr_accessor source: Anthropic::Models::Beta::BetaRequestDocumentBlock::source
18
+
19
+ attr_accessor type: :document
20
+
21
+ attr_accessor cache_control: Anthropic::Beta::BetaCacheControlEphemeral?
22
+
23
+ attr_reader citations: Anthropic::Beta::BetaCitationsConfigParam?
24
+
25
+ def citations=: (
26
+ Anthropic::Beta::BetaCitationsConfigParam
27
+ ) -> Anthropic::Beta::BetaCitationsConfigParam
28
+
29
+ attr_accessor context: String?
30
+
31
+ attr_accessor title: String?
32
+
33
+ def initialize: (
34
+ source: Anthropic::Models::Beta::BetaRequestDocumentBlock::source,
35
+ ?cache_control: Anthropic::Beta::BetaCacheControlEphemeral?,
36
+ ?citations: Anthropic::Beta::BetaCitationsConfigParam,
37
+ ?context: String?,
38
+ ?title: String?,
39
+ ?type: :document
40
+ ) -> void
41
+
42
+ def to_hash: -> {
43
+ source: Anthropic::Models::Beta::BetaRequestDocumentBlock::source,
44
+ type: :document,
45
+ cache_control: Anthropic::Beta::BetaCacheControlEphemeral?,
46
+ citations: Anthropic::Beta::BetaCitationsConfigParam,
47
+ context: String?,
48
+ title: String?
49
+ }
50
+
51
+ type source =
52
+ Anthropic::Beta::BetaBase64PDFSource
53
+ | Anthropic::Beta::BetaPlainTextSource
54
+ | Anthropic::Beta::BetaContentBlockSource
55
+ | Anthropic::Beta::BetaURLPDFSource
56
+ | Anthropic::Beta::BetaFileDocumentSource
57
+
58
+ module Source
59
+ extend Anthropic::Internal::Type::Union
60
+
61
+ def self?.variants: -> ::Array[Anthropic::Models::Beta::BetaRequestDocumentBlock::source]
62
+ end
63
+ end
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,53 @@
1
+ module Anthropic
2
+ module Models
3
+ class BetaSearchResultBlockParam = Beta::BetaSearchResultBlockParam
4
+
5
+ module Beta
6
+ type beta_search_result_block_param =
7
+ {
8
+ content: ::Array[Anthropic::Beta::BetaTextBlockParam],
9
+ source: String,
10
+ title: String,
11
+ type: :search_result,
12
+ cache_control: Anthropic::Beta::BetaCacheControlEphemeral?,
13
+ citations: Anthropic::Beta::BetaCitationsConfigParam
14
+ }
15
+
16
+ class BetaSearchResultBlockParam < Anthropic::Internal::Type::BaseModel
17
+ attr_accessor content: ::Array[Anthropic::Beta::BetaTextBlockParam]
18
+
19
+ attr_accessor source: String
20
+
21
+ attr_accessor title: String
22
+
23
+ attr_accessor type: :search_result
24
+
25
+ attr_accessor cache_control: Anthropic::Beta::BetaCacheControlEphemeral?
26
+
27
+ attr_reader citations: Anthropic::Beta::BetaCitationsConfigParam?
28
+
29
+ def citations=: (
30
+ Anthropic::Beta::BetaCitationsConfigParam
31
+ ) -> Anthropic::Beta::BetaCitationsConfigParam
32
+
33
+ def initialize: (
34
+ content: ::Array[Anthropic::Beta::BetaTextBlockParam],
35
+ source: String,
36
+ title: String,
37
+ ?cache_control: Anthropic::Beta::BetaCacheControlEphemeral?,
38
+ ?citations: Anthropic::Beta::BetaCitationsConfigParam,
39
+ ?type: :search_result
40
+ ) -> void
41
+
42
+ def to_hash: -> {
43
+ content: ::Array[Anthropic::Beta::BetaTextBlockParam],
44
+ source: String,
45
+ title: String,
46
+ type: :search_result,
47
+ cache_control: Anthropic::Beta::BetaCacheControlEphemeral?,
48
+ citations: Anthropic::Beta::BetaCitationsConfigParam
49
+ }
50
+ end
51
+ end
52
+ end
53
+ end
@@ -8,6 +8,7 @@ module Anthropic
8
8
  | Anthropic::Beta::BetaCitationPageLocation
9
9
  | Anthropic::Beta::BetaCitationContentBlockLocation
10
10
  | Anthropic::Beta::BetaCitationsWebSearchResultLocation
11
+ | Anthropic::Beta::BetaCitationSearchResultLocation
11
12
 
12
13
  module BetaTextCitation
13
14
  extend Anthropic::Internal::Type::Union
@@ -8,6 +8,7 @@ module Anthropic
8
8
  | Anthropic::Beta::BetaCitationPageLocationParam
9
9
  | Anthropic::Beta::BetaCitationContentBlockLocationParam
10
10
  | Anthropic::Beta::BetaCitationWebSearchResultLocationParam
11
+ | Anthropic::Beta::BetaCitationSearchResultLocationParam
11
12
 
12
13
  module BetaTextCitationParam
13
14
  extend Anthropic::Internal::Type::Union
@@ -41,16 +41,27 @@ module Anthropic
41
41
  type: Anthropic::Models::Beta::BetaTool::type_?
42
42
  }
43
43
 
44
- type input_schema = { type: :object, properties: top? }
44
+ type input_schema =
45
+ { type: :object, properties: top?, required: ::Array[String]? }
45
46
 
46
47
  class InputSchema < Anthropic::Internal::Type::BaseModel
47
48
  attr_accessor type: :object
48
49
 
49
50
  attr_accessor properties: top?
50
51
 
51
- def initialize: (?properties: top?, ?type: :object) -> void
52
+ attr_accessor required: ::Array[String]?
52
53
 
53
- def to_hash: -> { type: :object, properties: top? }
54
+ def initialize: (
55
+ ?properties: top?,
56
+ ?required: ::Array[String]?,
57
+ ?type: :object
58
+ ) -> void
59
+
60
+ def to_hash: -> {
61
+ type: :object,
62
+ properties: top?,
63
+ required: ::Array[String]?
64
+ }
54
65
  end
55
66
 
56
67
  type type_ = :custom
@@ -55,6 +55,7 @@ module Anthropic
55
55
  type content =
56
56
  Anthropic::Beta::BetaTextBlockParam
57
57
  | Anthropic::Beta::BetaImageBlockParam
58
+ | Anthropic::Beta::BetaSearchResultBlockParam
58
59
 
59
60
  module Content
60
61
  extend Anthropic::Internal::Type::Union