anthropic 1.1.0 → 1.2.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 (132) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +62 -0
  3. data/README.md +32 -16
  4. data/lib/anthropic/errors.rb +22 -0
  5. data/lib/anthropic/helpers/bedrock/client.rb +3 -1
  6. data/lib/anthropic/helpers/streaming/events.rb +141 -0
  7. data/lib/anthropic/helpers/streaming/message_stream.rb +238 -0
  8. data/lib/anthropic/helpers/streaming.rb +37 -0
  9. data/lib/anthropic/helpers/vertex/client.rb +8 -3
  10. data/lib/anthropic/internal/stream.rb +4 -2
  11. data/lib/anthropic/internal/transport/base_client.rb +10 -2
  12. data/lib/anthropic/internal/type/array_of.rb +6 -1
  13. data/lib/anthropic/internal/type/base_model.rb +77 -23
  14. data/lib/anthropic/internal/type/base_stream.rb +3 -1
  15. data/lib/anthropic/internal/type/boolean.rb +7 -1
  16. data/lib/anthropic/internal/type/converter.rb +42 -34
  17. data/lib/anthropic/internal/type/enum.rb +16 -5
  18. data/lib/anthropic/internal/type/file_input.rb +6 -1
  19. data/lib/anthropic/internal/type/hash_of.rb +6 -1
  20. data/lib/anthropic/internal/type/union.rb +17 -9
  21. data/lib/anthropic/internal/type/unknown.rb +7 -1
  22. data/lib/anthropic/internal/util.rb +18 -11
  23. data/lib/anthropic/models/beta/beta_base64_pdf_block.rb +1 -65
  24. data/lib/anthropic/models/beta/beta_citation_search_result_location.rb +55 -0
  25. data/lib/anthropic/models/beta/beta_citation_search_result_location_param.rb +55 -0
  26. data/lib/anthropic/models/beta/beta_citations_delta.rb +5 -3
  27. data/lib/anthropic/models/beta/beta_content_block.rb +5 -5
  28. data/lib/anthropic/models/beta/beta_content_block_param.rb +20 -17
  29. data/lib/anthropic/models/beta/beta_message.rb +6 -2
  30. data/lib/anthropic/models/beta/beta_message_param.rb +3 -3
  31. data/lib/anthropic/models/beta/beta_raw_content_block_start_event.rb +7 -7
  32. data/lib/anthropic/models/beta/beta_request_document_block.rb +75 -0
  33. data/lib/anthropic/models/beta/beta_search_result_block_param.rb +55 -0
  34. data/lib/anthropic/models/beta/beta_text_block.rb +2 -2
  35. data/lib/anthropic/models/beta/beta_text_block_param.rb +2 -2
  36. data/lib/anthropic/models/beta/beta_text_citation.rb +3 -1
  37. data/lib/anthropic/models/beta/beta_text_citation_param.rb +3 -1
  38. data/lib/anthropic/models/beta/beta_tool.rb +7 -1
  39. data/lib/anthropic/models/beta/beta_tool_result_block_param.rb +6 -4
  40. data/lib/anthropic/models/beta/beta_tool_union.rb +7 -7
  41. data/lib/anthropic/models/beta/message_count_tokens_params.rb +16 -10
  42. data/lib/anthropic/models/beta/message_create_params.rb +9 -3
  43. data/lib/anthropic/models/beta/messages/batch_create_params.rb +9 -3
  44. data/lib/anthropic/models/content_block.rb +5 -5
  45. data/lib/anthropic/models/content_block_param.rb +11 -11
  46. data/lib/anthropic/models/message.rb +6 -2
  47. data/lib/anthropic/models/message_count_tokens_params.rb +9 -3
  48. data/lib/anthropic/models/message_count_tokens_tool.rb +35 -1
  49. data/lib/anthropic/models/message_create_params.rb +9 -3
  50. data/lib/anthropic/models/message_param.rb +3 -3
  51. data/lib/anthropic/models/messages/batch_create_params.rb +9 -3
  52. data/lib/anthropic/models/model.rb +6 -0
  53. data/lib/anthropic/models/raw_content_block_start_event.rb +7 -7
  54. data/lib/anthropic/models/tool.rb +7 -1
  55. data/lib/anthropic/models/tool_union.rb +34 -1
  56. data/lib/anthropic/models/tool_use_block.rb +6 -0
  57. data/lib/anthropic/models.rb +4 -4
  58. data/lib/anthropic/resources/beta/messages.rb +5 -5
  59. data/lib/anthropic/resources/messages.rb +68 -7
  60. data/lib/anthropic/streaming.rb +5 -0
  61. data/lib/anthropic/version.rb +1 -1
  62. data/lib/anthropic.rb +11 -1
  63. data/rbi/anthropic/errors.rbi +16 -0
  64. data/rbi/anthropic/helpers/streaming/events.rbi +85 -0
  65. data/rbi/anthropic/helpers/streaming/message_stream.rbi +59 -0
  66. data/rbi/anthropic/internal/type/base_stream.rbi +8 -1
  67. data/rbi/anthropic/internal/type/boolean.rbi +2 -0
  68. data/rbi/anthropic/internal/type/converter.rbi +15 -15
  69. data/rbi/anthropic/internal/type/union.rbi +5 -0
  70. data/rbi/anthropic/internal/type/unknown.rbi +2 -0
  71. data/rbi/anthropic/internal/util.rbi +2 -0
  72. data/rbi/anthropic/models/beta/beta_base64_pdf_block.rbi +1 -128
  73. data/rbi/anthropic/models/beta/beta_citation_search_result_location.rbi +78 -0
  74. data/rbi/anthropic/models/beta/beta_citation_search_result_location_param.rbi +79 -0
  75. data/rbi/anthropic/models/beta/beta_citations_delta.rbi +4 -2
  76. data/rbi/anthropic/models/beta/beta_content_block.rbi +3 -3
  77. data/rbi/anthropic/models/beta/beta_content_block_param.rbi +8 -7
  78. data/rbi/anthropic/models/beta/beta_message.rbi +11 -3
  79. data/rbi/anthropic/models/beta/beta_raw_content_block_start_event.rbi +6 -6
  80. data/rbi/anthropic/models/beta/beta_request_document_block.rbi +140 -0
  81. data/rbi/anthropic/models/beta/beta_search_result_block_param.rbi +91 -0
  82. data/rbi/anthropic/models/beta/beta_text_block.rbi +2 -1
  83. data/rbi/anthropic/models/beta/beta_text_block_param.rbi +6 -3
  84. data/rbi/anthropic/models/beta/beta_text_citation.rbi +2 -1
  85. data/rbi/anthropic/models/beta/beta_text_citation_param.rbi +2 -1
  86. data/rbi/anthropic/models/beta/beta_tool.rbi +14 -5
  87. data/rbi/anthropic/models/beta/beta_tool_result_block_param.rbi +2 -1
  88. data/rbi/anthropic/models/beta/beta_tool_union.rbi +5 -5
  89. data/rbi/anthropic/models/beta/message_count_tokens_params.rbi +39 -27
  90. data/rbi/anthropic/models/beta/message_create_params.rbi +34 -22
  91. data/rbi/anthropic/models/beta/messages/batch_create_params.rbi +34 -22
  92. data/rbi/anthropic/models/content_block.rbi +3 -3
  93. data/rbi/anthropic/models/content_block_param.rbi +5 -5
  94. data/rbi/anthropic/models/message.rbi +11 -3
  95. data/rbi/anthropic/models/message_count_tokens_params.rbi +18 -2
  96. data/rbi/anthropic/models/message_count_tokens_tool.rbi +61 -0
  97. data/rbi/anthropic/models/message_create_params.rbi +18 -2
  98. data/rbi/anthropic/models/messages/batch_create_params.rbi +18 -2
  99. data/rbi/anthropic/models/raw_content_block_start_event.rbi +6 -6
  100. data/rbi/anthropic/models/tool.rbi +16 -5
  101. data/rbi/anthropic/models/tool_union.rbi +61 -0
  102. data/rbi/anthropic/resources/beta/messages.rbi +36 -18
  103. data/rbi/anthropic/resources/messages.rbi +293 -3
  104. data/rbi/anthropic/streaming.rbi +5 -0
  105. data/sig/anthropic/errors.rbs +9 -0
  106. data/sig/anthropic/helpers/streaming/events.rbs +119 -0
  107. data/sig/anthropic/helpers/streaming/message_stream.rbs +55 -0
  108. data/sig/anthropic/internal/type/base_stream.rbs +4 -0
  109. data/sig/anthropic/internal/type/converter.rbs +7 -1
  110. data/sig/anthropic/models/beta/beta_base64_pdf_block.rbs +1 -58
  111. data/sig/anthropic/models/beta/beta_citation_search_result_location.rbs +54 -0
  112. data/sig/anthropic/models/beta/beta_citation_search_result_location_param.rbs +54 -0
  113. data/sig/anthropic/models/beta/beta_citations_delta.rbs +1 -0
  114. data/sig/anthropic/models/beta/beta_content_block.rbs +2 -2
  115. data/sig/anthropic/models/beta/beta_content_block_param.rbs +9 -8
  116. data/sig/anthropic/models/beta/beta_raw_content_block_start_event.rbs +2 -2
  117. data/sig/anthropic/models/beta/beta_request_document_block.rbs +66 -0
  118. data/sig/anthropic/models/beta/beta_search_result_block_param.rbs +53 -0
  119. data/sig/anthropic/models/beta/beta_text_citation.rbs +1 -0
  120. data/sig/anthropic/models/beta/beta_text_citation_param.rbs +1 -0
  121. data/sig/anthropic/models/beta/beta_tool.rbs +14 -3
  122. data/sig/anthropic/models/beta/beta_tool_result_block_param.rbs +1 -0
  123. data/sig/anthropic/models/beta/beta_tool_union.rbs +4 -4
  124. data/sig/anthropic/models/beta/message_count_tokens_params.rbs +4 -4
  125. data/sig/anthropic/models/content_block.rbs +2 -2
  126. data/sig/anthropic/models/content_block_param.rbs +5 -5
  127. data/sig/anthropic/models/message_count_tokens_tool.rbs +28 -0
  128. data/sig/anthropic/models/raw_content_block_start_event.rbs +2 -2
  129. data/sig/anthropic/models/tool.rbs +14 -3
  130. data/sig/anthropic/models/tool_union.rbs +28 -0
  131. data/sig/anthropic/streaming.rbs +3 -0
  132. metadata +26 -3
@@ -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,10 @@ module Anthropic
37
39
  | Anthropic::Internal::Type::Converter::input spec
38
40
  ) -> (^-> top)
39
41
 
42
+ def self.new_coerce_state: (
43
+ ?translate_names: bool
44
+ ) -> Anthropic::Internal::Type::Converter::coerce_state
45
+
40
46
  def self.coerce: (
41
47
  Anthropic::Internal::Type::Converter::input target,
42
48
  top value,
@@ -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
@@ -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
@@ -5,15 +5,15 @@ module Anthropic
5
5
  module Beta
6
6
  type beta_tool_union =
7
7
  Anthropic::Beta::BetaTool
8
- | Anthropic::Beta::BetaToolComputerUse20241022
9
8
  | Anthropic::Beta::BetaToolBash20241022
10
- | Anthropic::Beta::BetaToolTextEditor20241022
11
- | Anthropic::Beta::BetaToolComputerUse20250124
12
9
  | Anthropic::Beta::BetaToolBash20250124
10
+ | Anthropic::Beta::BetaCodeExecutionTool20250522
11
+ | Anthropic::Beta::BetaToolComputerUse20241022
12
+ | Anthropic::Beta::BetaToolComputerUse20250124
13
+ | Anthropic::Beta::BetaToolTextEditor20241022
13
14
  | Anthropic::Beta::BetaToolTextEditor20250124
14
15
  | Anthropic::Beta::BetaToolTextEditor20250429
15
16
  | Anthropic::Beta::BetaWebSearchTool20250305
16
- | Anthropic::Beta::BetaCodeExecutionTool20250522
17
17
 
18
18
  module BetaToolUnion
19
19
  extend Anthropic::Internal::Type::Union
@@ -94,15 +94,15 @@ module Anthropic
94
94
 
95
95
  type tool =
96
96
  Anthropic::Beta::BetaTool
97
- | Anthropic::Beta::BetaToolComputerUse20241022
98
97
  | Anthropic::Beta::BetaToolBash20241022
99
- | Anthropic::Beta::BetaToolTextEditor20241022
100
- | Anthropic::Beta::BetaToolComputerUse20250124
101
98
  | Anthropic::Beta::BetaToolBash20250124
99
+ | Anthropic::Beta::BetaCodeExecutionTool20250522
100
+ | Anthropic::Beta::BetaToolComputerUse20241022
101
+ | Anthropic::Beta::BetaToolComputerUse20250124
102
+ | Anthropic::Beta::BetaToolTextEditor20241022
102
103
  | Anthropic::Beta::BetaToolTextEditor20250124
103
104
  | Anthropic::Beta::BetaToolTextEditor20250429
104
105
  | Anthropic::Beta::BetaWebSearchTool20250305
105
- | Anthropic::Beta::BetaCodeExecutionTool20250522
106
106
 
107
107
  module Tool
108
108
  extend Anthropic::Internal::Type::Union
@@ -2,11 +2,11 @@ module Anthropic
2
2
  module Models
3
3
  type content_block =
4
4
  Anthropic::TextBlock
5
+ | Anthropic::ThinkingBlock
6
+ | Anthropic::RedactedThinkingBlock
5
7
  | Anthropic::ToolUseBlock
6
8
  | Anthropic::ServerToolUseBlock
7
9
  | Anthropic::WebSearchToolResultBlock
8
- | Anthropic::ThinkingBlock
9
- | Anthropic::RedactedThinkingBlock
10
10
 
11
11
  module ContentBlock
12
12
  extend Anthropic::Internal::Type::Union
@@ -1,15 +1,15 @@
1
1
  module Anthropic
2
2
  module Models
3
3
  type content_block_param =
4
- Anthropic::ServerToolUseBlockParam
5
- | Anthropic::WebSearchToolResultBlockParam
6
- | Anthropic::TextBlockParam
4
+ Anthropic::TextBlockParam
7
5
  | Anthropic::ImageBlockParam
8
- | Anthropic::ToolUseBlockParam
9
- | Anthropic::ToolResultBlockParam
10
6
  | Anthropic::DocumentBlockParam
11
7
  | Anthropic::ThinkingBlockParam
12
8
  | Anthropic::RedactedThinkingBlockParam
9
+ | Anthropic::ToolUseBlockParam
10
+ | Anthropic::ToolResultBlockParam
11
+ | Anthropic::ServerToolUseBlockParam
12
+ | Anthropic::WebSearchToolResultBlockParam
13
13
 
14
14
  module ContentBlockParam
15
15
  extend Anthropic::Internal::Type::Union
@@ -4,11 +4,39 @@ module Anthropic
4
4
  Anthropic::Tool
5
5
  | Anthropic::ToolBash20250124
6
6
  | Anthropic::ToolTextEditor20250124
7
+ | Anthropic::MessageCountTokensTool::TextEditor20250429
7
8
  | Anthropic::WebSearchTool20250305
8
9
 
9
10
  module MessageCountTokensTool
10
11
  extend Anthropic::Internal::Type::Union
11
12
 
13
+ type text_editor20250429 =
14
+ {
15
+ name: :str_replace_based_edit_tool,
16
+ type: :text_editor_20250429,
17
+ cache_control: Anthropic::CacheControlEphemeral?
18
+ }
19
+
20
+ class TextEditor20250429 < Anthropic::Internal::Type::BaseModel
21
+ attr_accessor name: :str_replace_based_edit_tool
22
+
23
+ attr_accessor type: :text_editor_20250429
24
+
25
+ attr_accessor cache_control: Anthropic::CacheControlEphemeral?
26
+
27
+ def initialize: (
28
+ ?cache_control: Anthropic::CacheControlEphemeral?,
29
+ ?name: :str_replace_based_edit_tool,
30
+ ?type: :text_editor_20250429
31
+ ) -> void
32
+
33
+ def to_hash: -> {
34
+ name: :str_replace_based_edit_tool,
35
+ type: :text_editor_20250429,
36
+ cache_control: Anthropic::CacheControlEphemeral?
37
+ }
38
+ end
39
+
12
40
  def self?.variants: -> ::Array[Anthropic::Models::message_count_tokens_tool]
13
41
  end
14
42
  end
@@ -28,11 +28,11 @@ module Anthropic
28
28
 
29
29
  type content_block =
30
30
  Anthropic::TextBlock
31
+ | Anthropic::ThinkingBlock
32
+ | Anthropic::RedactedThinkingBlock
31
33
  | Anthropic::ToolUseBlock
32
34
  | Anthropic::ServerToolUseBlock
33
35
  | Anthropic::WebSearchToolResultBlock
34
- | Anthropic::ThinkingBlock
35
- | Anthropic::RedactedThinkingBlock
36
36
 
37
37
  module ContentBlock
38
38
  extend Anthropic::Internal::Type::Union
@@ -38,16 +38,27 @@ module Anthropic
38
38
  type: Anthropic::Models::Tool::type_?
39
39
  }
40
40
 
41
- type input_schema = { type: :object, properties: top? }
41
+ type input_schema =
42
+ { type: :object, properties: top?, required: ::Array[String]? }
42
43
 
43
44
  class InputSchema < Anthropic::Internal::Type::BaseModel
44
45
  attr_accessor type: :object
45
46
 
46
47
  attr_accessor properties: top?
47
48
 
48
- def initialize: (?properties: top?, ?type: :object) -> void
49
+ attr_accessor required: ::Array[String]?
49
50
 
50
- def to_hash: -> { type: :object, properties: top? }
51
+ def initialize: (
52
+ ?properties: top?,
53
+ ?required: ::Array[String]?,
54
+ ?type: :object
55
+ ) -> void
56
+
57
+ def to_hash: -> {
58
+ type: :object,
59
+ properties: top?,
60
+ required: ::Array[String]?
61
+ }
51
62
  end
52
63
 
53
64
  type type_ = :custom
@@ -4,11 +4,39 @@ module Anthropic
4
4
  Anthropic::Tool
5
5
  | Anthropic::ToolBash20250124
6
6
  | Anthropic::ToolTextEditor20250124
7
+ | Anthropic::ToolUnion::TextEditor20250429
7
8
  | Anthropic::WebSearchTool20250305
8
9
 
9
10
  module ToolUnion
10
11
  extend Anthropic::Internal::Type::Union
11
12
 
13
+ type text_editor20250429 =
14
+ {
15
+ name: :str_replace_based_edit_tool,
16
+ type: :text_editor_20250429,
17
+ cache_control: Anthropic::CacheControlEphemeral?
18
+ }
19
+
20
+ class TextEditor20250429 < Anthropic::Internal::Type::BaseModel
21
+ attr_accessor name: :str_replace_based_edit_tool
22
+
23
+ attr_accessor type: :text_editor_20250429
24
+
25
+ attr_accessor cache_control: Anthropic::CacheControlEphemeral?
26
+
27
+ def initialize: (
28
+ ?cache_control: Anthropic::CacheControlEphemeral?,
29
+ ?name: :str_replace_based_edit_tool,
30
+ ?type: :text_editor_20250429
31
+ ) -> void
32
+
33
+ def to_hash: -> {
34
+ name: :str_replace_based_edit_tool,
35
+ type: :text_editor_20250429,
36
+ cache_control: Anthropic::CacheControlEphemeral?
37
+ }
38
+ end
39
+
12
40
  def self?.variants: -> ::Array[Anthropic::Models::tool_union]
13
41
  end
14
42
  end
@@ -0,0 +1,3 @@
1
+ module Anthropic
2
+ Streaming: singleton(Anthropic::Helpers::Streaming)
3
+ end