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
@@ -0,0 +1,75 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Anthropic
4
+ module Models
5
+ module Beta
6
+ class BetaRequestDocumentBlock < Anthropic::Internal::Type::BaseModel
7
+ # @!attribute source
8
+ #
9
+ # @return [Anthropic::Models::Beta::BetaBase64PDFSource, Anthropic::Models::Beta::BetaPlainTextSource, Anthropic::Models::Beta::BetaContentBlockSource, Anthropic::Models::Beta::BetaURLPDFSource, Anthropic::Models::Beta::BetaFileDocumentSource]
10
+ required :source, union: -> { Anthropic::Beta::BetaRequestDocumentBlock::Source }
11
+
12
+ # @!attribute type
13
+ #
14
+ # @return [Symbol, :document]
15
+ required :type, const: :document
16
+
17
+ # @!attribute cache_control
18
+ # Create a cache control breakpoint at this content block.
19
+ #
20
+ # @return [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil]
21
+ optional :cache_control, -> { Anthropic::Beta::BetaCacheControlEphemeral }, nil?: true
22
+
23
+ # @!attribute citations
24
+ #
25
+ # @return [Anthropic::Models::Beta::BetaCitationsConfigParam, nil]
26
+ optional :citations, -> { Anthropic::Beta::BetaCitationsConfigParam }
27
+
28
+ # @!attribute context
29
+ #
30
+ # @return [String, nil]
31
+ optional :context, String, nil?: true
32
+
33
+ # @!attribute title
34
+ #
35
+ # @return [String, nil]
36
+ optional :title, String, nil?: true
37
+
38
+ # @!method initialize(source:, cache_control: nil, citations: nil, context: nil, title: nil, type: :document)
39
+ # @param source [Anthropic::Models::Beta::BetaBase64PDFSource, Anthropic::Models::Beta::BetaPlainTextSource, Anthropic::Models::Beta::BetaContentBlockSource, Anthropic::Models::Beta::BetaURLPDFSource, Anthropic::Models::Beta::BetaFileDocumentSource]
40
+ #
41
+ # @param cache_control [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil] Create a cache control breakpoint at this content block.
42
+ #
43
+ # @param citations [Anthropic::Models::Beta::BetaCitationsConfigParam]
44
+ #
45
+ # @param context [String, nil]
46
+ #
47
+ # @param title [String, nil]
48
+ #
49
+ # @param type [Symbol, :document]
50
+
51
+ # @see Anthropic::Models::Beta::BetaRequestDocumentBlock#source
52
+ module Source
53
+ extend Anthropic::Internal::Type::Union
54
+
55
+ discriminator :type
56
+
57
+ variant :base64, -> { Anthropic::Beta::BetaBase64PDFSource }
58
+
59
+ variant :text, -> { Anthropic::Beta::BetaPlainTextSource }
60
+
61
+ variant :content, -> { Anthropic::Beta::BetaContentBlockSource }
62
+
63
+ variant :url, -> { Anthropic::Beta::BetaURLPDFSource }
64
+
65
+ variant :file, -> { Anthropic::Beta::BetaFileDocumentSource }
66
+
67
+ # @!method self.variants
68
+ # @return [Array(Anthropic::Models::Beta::BetaBase64PDFSource, Anthropic::Models::Beta::BetaPlainTextSource, Anthropic::Models::Beta::BetaContentBlockSource, Anthropic::Models::Beta::BetaURLPDFSource, Anthropic::Models::Beta::BetaFileDocumentSource)]
69
+ end
70
+ end
71
+ end
72
+
73
+ BetaRequestDocumentBlock = Beta::BetaRequestDocumentBlock
74
+ end
75
+ end
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Anthropic
4
+ module Models
5
+ module Beta
6
+ class BetaSearchResultBlockParam < Anthropic::Internal::Type::BaseModel
7
+ # @!attribute content
8
+ #
9
+ # @return [Array<Anthropic::Models::Beta::BetaTextBlockParam>]
10
+ required :content, -> { Anthropic::Internal::Type::ArrayOf[Anthropic::Beta::BetaTextBlockParam] }
11
+
12
+ # @!attribute source
13
+ #
14
+ # @return [String]
15
+ required :source, String
16
+
17
+ # @!attribute title
18
+ #
19
+ # @return [String]
20
+ required :title, String
21
+
22
+ # @!attribute type
23
+ #
24
+ # @return [Symbol, :search_result]
25
+ required :type, const: :search_result
26
+
27
+ # @!attribute cache_control
28
+ # Create a cache control breakpoint at this content block.
29
+ #
30
+ # @return [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil]
31
+ optional :cache_control, -> { Anthropic::Beta::BetaCacheControlEphemeral }, nil?: true
32
+
33
+ # @!attribute citations
34
+ #
35
+ # @return [Anthropic::Models::Beta::BetaCitationsConfigParam, nil]
36
+ optional :citations, -> { Anthropic::Beta::BetaCitationsConfigParam }
37
+
38
+ # @!method initialize(content:, source:, title:, cache_control: nil, citations: nil, type: :search_result)
39
+ # @param content [Array<Anthropic::Models::Beta::BetaTextBlockParam>]
40
+ #
41
+ # @param source [String]
42
+ #
43
+ # @param title [String]
44
+ #
45
+ # @param cache_control [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil] Create a cache control breakpoint at this content block.
46
+ #
47
+ # @param citations [Anthropic::Models::Beta::BetaCitationsConfigParam]
48
+ #
49
+ # @param type [Symbol, :search_result]
50
+ end
51
+ end
52
+
53
+ BetaSearchResultBlockParam = Beta::BetaSearchResultBlockParam
54
+ end
55
+ end
@@ -11,7 +11,7 @@ module Anthropic
11
11
  # Citing a PDF results in `page_location`, plain text results in `char_location`,
12
12
  # and content document results in `content_block_location`.
13
13
  #
14
- # @return [Array<Anthropic::Models::Beta::BetaCitationCharLocation, Anthropic::Models::Beta::BetaCitationPageLocation, Anthropic::Models::Beta::BetaCitationContentBlockLocation, Anthropic::Models::Beta::BetaCitationsWebSearchResultLocation>, nil]
14
+ # @return [Array<Anthropic::Models::Beta::BetaCitationCharLocation, Anthropic::Models::Beta::BetaCitationPageLocation, Anthropic::Models::Beta::BetaCitationContentBlockLocation, Anthropic::Models::Beta::BetaCitationsWebSearchResultLocation, Anthropic::Models::Beta::BetaCitationSearchResultLocation>, nil]
15
15
  required :citations,
16
16
  -> { Anthropic::Internal::Type::ArrayOf[union: Anthropic::Beta::BetaTextCitation] },
17
17
  nil?: true
@@ -30,7 +30,7 @@ module Anthropic
30
30
  # Some parameter documentations has been truncated, see
31
31
  # {Anthropic::Models::Beta::BetaTextBlock} for more details.
32
32
  #
33
- # @param citations [Array<Anthropic::Models::Beta::BetaCitationCharLocation, Anthropic::Models::Beta::BetaCitationPageLocation, Anthropic::Models::Beta::BetaCitationContentBlockLocation, Anthropic::Models::Beta::BetaCitationsWebSearchResultLocation>, nil] Citations supporting the text block.
33
+ # @param citations [Array<Anthropic::Models::Beta::BetaCitationCharLocation, Anthropic::Models::Beta::BetaCitationPageLocation, Anthropic::Models::Beta::BetaCitationContentBlockLocation, Anthropic::Models::Beta::BetaCitationsWebSearchResultLocation, Anthropic::Models::Beta::BetaCitationSearchResultLocation>, nil] Citations supporting the text block.
34
34
  #
35
35
  # @param text [String]
36
36
  #
@@ -22,7 +22,7 @@ module Anthropic
22
22
 
23
23
  # @!attribute citations
24
24
  #
25
- # @return [Array<Anthropic::Models::Beta::BetaCitationCharLocationParam, Anthropic::Models::Beta::BetaCitationPageLocationParam, Anthropic::Models::Beta::BetaCitationContentBlockLocationParam, Anthropic::Models::Beta::BetaCitationWebSearchResultLocationParam>, nil]
25
+ # @return [Array<Anthropic::Models::Beta::BetaCitationCharLocationParam, Anthropic::Models::Beta::BetaCitationPageLocationParam, Anthropic::Models::Beta::BetaCitationContentBlockLocationParam, Anthropic::Models::Beta::BetaCitationWebSearchResultLocationParam, Anthropic::Models::Beta::BetaCitationSearchResultLocationParam>, nil]
26
26
  optional :citations,
27
27
  -> { Anthropic::Internal::Type::ArrayOf[union: Anthropic::Beta::BetaTextCitationParam] },
28
28
  nil?: true
@@ -32,7 +32,7 @@ module Anthropic
32
32
  #
33
33
  # @param cache_control [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil] Create a cache control breakpoint at this content block.
34
34
  #
35
- # @param citations [Array<Anthropic::Models::Beta::BetaCitationCharLocationParam, Anthropic::Models::Beta::BetaCitationPageLocationParam, Anthropic::Models::Beta::BetaCitationContentBlockLocationParam, Anthropic::Models::Beta::BetaCitationWebSearchResultLocationParam>, nil]
35
+ # @param citations [Array<Anthropic::Models::Beta::BetaCitationCharLocationParam, Anthropic::Models::Beta::BetaCitationPageLocationParam, Anthropic::Models::Beta::BetaCitationContentBlockLocationParam, Anthropic::Models::Beta::BetaCitationWebSearchResultLocationParam, Anthropic::Models::Beta::BetaCitationSearchResultLocationParam>, nil]
36
36
  #
37
37
  # @param type [Symbol, :text]
38
38
  end
@@ -16,8 +16,10 @@ module Anthropic
16
16
 
17
17
  variant :web_search_result_location, -> { Anthropic::Beta::BetaCitationsWebSearchResultLocation }
18
18
 
19
+ variant :search_result_location, -> { Anthropic::Beta::BetaCitationSearchResultLocation }
20
+
19
21
  # @!method self.variants
20
- # @return [Array(Anthropic::Models::Beta::BetaCitationCharLocation, Anthropic::Models::Beta::BetaCitationPageLocation, Anthropic::Models::Beta::BetaCitationContentBlockLocation, Anthropic::Models::Beta::BetaCitationsWebSearchResultLocation)]
22
+ # @return [Array(Anthropic::Models::Beta::BetaCitationCharLocation, Anthropic::Models::Beta::BetaCitationPageLocation, Anthropic::Models::Beta::BetaCitationContentBlockLocation, Anthropic::Models::Beta::BetaCitationsWebSearchResultLocation, Anthropic::Models::Beta::BetaCitationSearchResultLocation)]
21
23
  end
22
24
  end
23
25
 
@@ -16,8 +16,10 @@ module Anthropic
16
16
 
17
17
  variant :web_search_result_location, -> { Anthropic::Beta::BetaCitationWebSearchResultLocationParam }
18
18
 
19
+ variant :search_result_location, -> { Anthropic::Beta::BetaCitationSearchResultLocationParam }
20
+
19
21
  # @!method self.variants
20
- # @return [Array(Anthropic::Models::Beta::BetaCitationCharLocationParam, Anthropic::Models::Beta::BetaCitationPageLocationParam, Anthropic::Models::Beta::BetaCitationContentBlockLocationParam, Anthropic::Models::Beta::BetaCitationWebSearchResultLocationParam)]
22
+ # @return [Array(Anthropic::Models::Beta::BetaCitationCharLocationParam, Anthropic::Models::Beta::BetaCitationPageLocationParam, Anthropic::Models::Beta::BetaCitationContentBlockLocationParam, Anthropic::Models::Beta::BetaCitationWebSearchResultLocationParam, Anthropic::Models::Beta::BetaCitationSearchResultLocationParam)]
21
23
  end
22
24
  end
23
25
 
@@ -69,13 +69,19 @@ module Anthropic
69
69
  # @return [Object, nil]
70
70
  optional :properties, Anthropic::Internal::Type::Unknown, nil?: true
71
71
 
72
- # @!method initialize(properties: nil, type: :object)
72
+ # @!attribute required
73
+ #
74
+ # @return [Array<String>, nil]
75
+ optional :required, Anthropic::Internal::Type::ArrayOf[String], nil?: true
76
+
77
+ # @!method initialize(properties: nil, required: nil, type: :object)
73
78
  # [JSON schema](https://json-schema.org/draft/2020-12) for this tool's input.
74
79
  #
75
80
  # This defines the shape of the `input` that your tool accepts and that the model
76
81
  # will produce.
77
82
  #
78
83
  # @param properties [Object, nil]
84
+ # @param required [Array<String>, nil]
79
85
  # @param type [Symbol, :object]
80
86
  end
81
87
 
@@ -22,7 +22,7 @@ module Anthropic
22
22
 
23
23
  # @!attribute content
24
24
  #
25
- # @return [String, Array<Anthropic::Models::Beta::BetaTextBlockParam, Anthropic::Models::Beta::BetaImageBlockParam>, nil]
25
+ # @return [String, Array<Anthropic::Models::Beta::BetaTextBlockParam, Anthropic::Models::Beta::BetaImageBlockParam, Anthropic::Models::Beta::BetaSearchResultBlockParam>, nil]
26
26
  optional :content, union: -> { Anthropic::Beta::BetaToolResultBlockParam::Content }
27
27
 
28
28
  # @!attribute is_error
@@ -35,7 +35,7 @@ module Anthropic
35
35
  #
36
36
  # @param cache_control [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil] Create a cache control breakpoint at this content block.
37
37
  #
38
- # @param content [String, Array<Anthropic::Models::Beta::BetaTextBlockParam, Anthropic::Models::Beta::BetaImageBlockParam>]
38
+ # @param content [String, Array<Anthropic::Models::Beta::BetaTextBlockParam, Anthropic::Models::Beta::BetaImageBlockParam, Anthropic::Models::Beta::BetaSearchResultBlockParam>]
39
39
  #
40
40
  # @param is_error [Boolean]
41
41
  #
@@ -58,12 +58,14 @@ module Anthropic
58
58
 
59
59
  variant :image, -> { Anthropic::Beta::BetaImageBlockParam }
60
60
 
61
+ variant :search_result, -> { Anthropic::Beta::BetaSearchResultBlockParam }
62
+
61
63
  # @!method self.variants
62
- # @return [Array(Anthropic::Models::Beta::BetaTextBlockParam, Anthropic::Models::Beta::BetaImageBlockParam)]
64
+ # @return [Array(Anthropic::Models::Beta::BetaTextBlockParam, Anthropic::Models::Beta::BetaImageBlockParam, Anthropic::Models::Beta::BetaSearchResultBlockParam)]
63
65
  end
64
66
 
65
67
  # @!method self.variants
66
- # @return [Array(String, Array<Anthropic::Models::Beta::BetaTextBlockParam, Anthropic::Models::Beta::BetaImageBlockParam>)]
68
+ # @return [Array(String, Array<Anthropic::Models::Beta::BetaTextBlockParam, Anthropic::Models::Beta::BetaImageBlockParam, Anthropic::Models::Beta::BetaSearchResultBlockParam>)]
67
69
 
68
70
  # @type [Anthropic::Internal::Type::Converter]
69
71
  ContentArray =
@@ -8,15 +8,17 @@ module Anthropic
8
8
 
9
9
  variant -> { Anthropic::Beta::BetaTool }
10
10
 
11
- variant -> { Anthropic::Beta::BetaToolComputerUse20241022 }
12
-
13
11
  variant -> { Anthropic::Beta::BetaToolBash20241022 }
14
12
 
15
- variant -> { Anthropic::Beta::BetaToolTextEditor20241022 }
13
+ variant -> { Anthropic::Beta::BetaToolBash20250124 }
14
+
15
+ variant -> { Anthropic::Beta::BetaCodeExecutionTool20250522 }
16
+
17
+ variant -> { Anthropic::Beta::BetaToolComputerUse20241022 }
16
18
 
17
19
  variant -> { Anthropic::Beta::BetaToolComputerUse20250124 }
18
20
 
19
- variant -> { Anthropic::Beta::BetaToolBash20250124 }
21
+ variant -> { Anthropic::Beta::BetaToolTextEditor20241022 }
20
22
 
21
23
  variant -> { Anthropic::Beta::BetaToolTextEditor20250124 }
22
24
 
@@ -24,10 +26,8 @@ module Anthropic
24
26
 
25
27
  variant -> { Anthropic::Beta::BetaWebSearchTool20250305 }
26
28
 
27
- variant -> { Anthropic::Beta::BetaCodeExecutionTool20250522 }
28
-
29
29
  # @!method self.variants
30
- # @return [Array(Anthropic::Models::Beta::BetaTool, Anthropic::Models::Beta::BetaToolComputerUse20241022, Anthropic::Models::Beta::BetaToolBash20241022, Anthropic::Models::Beta::BetaToolTextEditor20241022, Anthropic::Models::Beta::BetaToolComputerUse20250124, Anthropic::Models::Beta::BetaToolBash20250124, Anthropic::Models::Beta::BetaToolTextEditor20250124, Anthropic::Models::Beta::BetaToolTextEditor20250429, Anthropic::Models::Beta::BetaWebSearchTool20250305, Anthropic::Models::Beta::BetaCodeExecutionTool20250522)]
30
+ # @return [Array(Anthropic::Models::Beta::BetaTool, Anthropic::Models::Beta::BetaToolBash20241022, Anthropic::Models::Beta::BetaToolBash20250124, Anthropic::Models::Beta::BetaCodeExecutionTool20250522, Anthropic::Models::Beta::BetaToolComputerUse20241022, Anthropic::Models::Beta::BetaToolComputerUse20250124, Anthropic::Models::Beta::BetaToolTextEditor20241022, Anthropic::Models::Beta::BetaToolTextEditor20250124, Anthropic::Models::Beta::BetaToolTextEditor20250429, Anthropic::Models::Beta::BetaWebSearchTool20250305)]
31
31
  end
32
32
  end
33
33
 
@@ -96,7 +96,7 @@ module Anthropic
96
96
  # the top-level `system` parameter — there is no `"system"` role for input
97
97
  # messages in the Messages API.
98
98
  #
99
- # There is a limit of 100000 messages in a single request.
99
+ # There is a limit of 100,000 messages in a single request.
100
100
  #
101
101
  # @return [Array<Anthropic::Models::Beta::BetaMessageParam>]
102
102
  required :messages, -> { Anthropic::Internal::Type::ArrayOf[Anthropic::Beta::BetaMessageParam] }
@@ -155,6 +155,12 @@ module Anthropic
155
155
  # those tools using the tool input generated by the model and then optionally
156
156
  # return results back to the model using `tool_result` content blocks.
157
157
  #
158
+ # There are two types of tools: **client tools** and **server tools**. The
159
+ # behavior described below applies to client tools. For
160
+ # [server tools](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/overview#server-tools),
161
+ # see their individual documentation as each has its own behavior (e.g., the
162
+ # [web search tool](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/web-search-tool)).
163
+ #
158
164
  # Each tool definition includes:
159
165
  #
160
166
  # - `name`: Name of the tool.
@@ -218,7 +224,7 @@ module Anthropic
218
224
  #
219
225
  # See our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details.
220
226
  #
221
- # @return [Array<Anthropic::Models::Beta::BetaTool, Anthropic::Models::Beta::BetaToolComputerUse20241022, Anthropic::Models::Beta::BetaToolBash20241022, Anthropic::Models::Beta::BetaToolTextEditor20241022, Anthropic::Models::Beta::BetaToolComputerUse20250124, Anthropic::Models::Beta::BetaToolBash20250124, Anthropic::Models::Beta::BetaToolTextEditor20250124, Anthropic::Models::Beta::BetaToolTextEditor20250429, Anthropic::Models::Beta::BetaWebSearchTool20250305, Anthropic::Models::Beta::BetaCodeExecutionTool20250522>, nil]
227
+ # @return [Array<Anthropic::Models::Beta::BetaTool, Anthropic::Models::Beta::BetaToolBash20241022, Anthropic::Models::Beta::BetaToolBash20250124, Anthropic::Models::Beta::BetaCodeExecutionTool20250522, Anthropic::Models::Beta::BetaToolComputerUse20241022, Anthropic::Models::Beta::BetaToolComputerUse20250124, Anthropic::Models::Beta::BetaToolTextEditor20241022, Anthropic::Models::Beta::BetaToolTextEditor20250124, Anthropic::Models::Beta::BetaToolTextEditor20250429, Anthropic::Models::Beta::BetaWebSearchTool20250305>, nil]
222
228
  optional :tools,
223
229
  -> {
224
230
  Anthropic::Internal::Type::ArrayOf[union: Anthropic::Beta::MessageCountTokensParams::Tool]
@@ -246,7 +252,7 @@ module Anthropic
246
252
  #
247
253
  # @param tool_choice [Anthropic::Models::Beta::BetaToolChoiceAuto, Anthropic::Models::Beta::BetaToolChoiceAny, Anthropic::Models::Beta::BetaToolChoiceTool, Anthropic::Models::Beta::BetaToolChoiceNone] How the model should use the provided tools. The model can use a specific tool,
248
254
  #
249
- # @param tools [Array<Anthropic::Models::Beta::BetaTool, Anthropic::Models::Beta::BetaToolComputerUse20241022, Anthropic::Models::Beta::BetaToolBash20241022, Anthropic::Models::Beta::BetaToolTextEditor20241022, Anthropic::Models::Beta::BetaToolComputerUse20250124, Anthropic::Models::Beta::BetaToolBash20250124, Anthropic::Models::Beta::BetaToolTextEditor20250124, Anthropic::Models::Beta::BetaToolTextEditor20250429, Anthropic::Models::Beta::BetaWebSearchTool20250305, Anthropic::Models::Beta::BetaCodeExecutionTool20250522>] Definitions of tools that the model may use.
255
+ # @param tools [Array<Anthropic::Models::Beta::BetaTool, Anthropic::Models::Beta::BetaToolBash20241022, Anthropic::Models::Beta::BetaToolBash20250124, Anthropic::Models::Beta::BetaCodeExecutionTool20250522, Anthropic::Models::Beta::BetaToolComputerUse20241022, Anthropic::Models::Beta::BetaToolComputerUse20250124, Anthropic::Models::Beta::BetaToolTextEditor20241022, Anthropic::Models::Beta::BetaToolTextEditor20250124, Anthropic::Models::Beta::BetaToolTextEditor20250429, Anthropic::Models::Beta::BetaWebSearchTool20250305>] Definitions of tools that the model may use.
250
256
  #
251
257
  # @param betas [Array<String, Symbol, Anthropic::Models::AnthropicBeta>] Optional header to specify the beta version(s) you want to use.
252
258
  #
@@ -278,15 +284,17 @@ module Anthropic
278
284
 
279
285
  variant -> { Anthropic::Beta::BetaTool }
280
286
 
281
- variant -> { Anthropic::Beta::BetaToolComputerUse20241022 }
282
-
283
287
  variant -> { Anthropic::Beta::BetaToolBash20241022 }
284
288
 
285
- variant -> { Anthropic::Beta::BetaToolTextEditor20241022 }
289
+ variant -> { Anthropic::Beta::BetaToolBash20250124 }
290
+
291
+ variant -> { Anthropic::Beta::BetaCodeExecutionTool20250522 }
292
+
293
+ variant -> { Anthropic::Beta::BetaToolComputerUse20241022 }
286
294
 
287
295
  variant -> { Anthropic::Beta::BetaToolComputerUse20250124 }
288
296
 
289
- variant -> { Anthropic::Beta::BetaToolBash20250124 }
297
+ variant -> { Anthropic::Beta::BetaToolTextEditor20241022 }
290
298
 
291
299
  variant -> { Anthropic::Beta::BetaToolTextEditor20250124 }
292
300
 
@@ -294,10 +302,8 @@ module Anthropic
294
302
 
295
303
  variant -> { Anthropic::Beta::BetaWebSearchTool20250305 }
296
304
 
297
- variant -> { Anthropic::Beta::BetaCodeExecutionTool20250522 }
298
-
299
305
  # @!method self.variants
300
- # @return [Array(Anthropic::Models::Beta::BetaTool, Anthropic::Models::Beta::BetaToolComputerUse20241022, Anthropic::Models::Beta::BetaToolBash20241022, Anthropic::Models::Beta::BetaToolTextEditor20241022, Anthropic::Models::Beta::BetaToolComputerUse20250124, Anthropic::Models::Beta::BetaToolBash20250124, Anthropic::Models::Beta::BetaToolTextEditor20250124, Anthropic::Models::Beta::BetaToolTextEditor20250429, Anthropic::Models::Beta::BetaWebSearchTool20250305, Anthropic::Models::Beta::BetaCodeExecutionTool20250522)]
306
+ # @return [Array(Anthropic::Models::Beta::BetaTool, Anthropic::Models::Beta::BetaToolBash20241022, Anthropic::Models::Beta::BetaToolBash20250124, Anthropic::Models::Beta::BetaCodeExecutionTool20250522, Anthropic::Models::Beta::BetaToolComputerUse20241022, Anthropic::Models::Beta::BetaToolComputerUse20250124, Anthropic::Models::Beta::BetaToolTextEditor20241022, Anthropic::Models::Beta::BetaToolTextEditor20250124, Anthropic::Models::Beta::BetaToolTextEditor20250429, Anthropic::Models::Beta::BetaWebSearchTool20250305)]
301
307
  end
302
308
  end
303
309
  end
@@ -110,7 +110,7 @@ module Anthropic
110
110
  # the top-level `system` parameter — there is no `"system"` role for input
111
111
  # messages in the Messages API.
112
112
  #
113
- # There is a limit of 100000 messages in a single request.
113
+ # There is a limit of 100,000 messages in a single request.
114
114
  #
115
115
  # @return [Array<Anthropic::Models::Beta::BetaMessageParam>]
116
116
  required :messages, -> { Anthropic::Internal::Type::ArrayOf[Anthropic::Beta::BetaMessageParam] }
@@ -218,6 +218,12 @@ module Anthropic
218
218
  # those tools using the tool input generated by the model and then optionally
219
219
  # return results back to the model using `tool_result` content blocks.
220
220
  #
221
+ # There are two types of tools: **client tools** and **server tools**. The
222
+ # behavior described below applies to client tools. For
223
+ # [server tools](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/overview#server-tools),
224
+ # see their individual documentation as each has its own behavior (e.g., the
225
+ # [web search tool](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/web-search-tool)).
226
+ #
221
227
  # Each tool definition includes:
222
228
  #
223
229
  # - `name`: Name of the tool.
@@ -281,7 +287,7 @@ module Anthropic
281
287
  #
282
288
  # See our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details.
283
289
  #
284
- # @return [Array<Anthropic::Models::Beta::BetaTool, Anthropic::Models::Beta::BetaToolComputerUse20241022, Anthropic::Models::Beta::BetaToolBash20241022, Anthropic::Models::Beta::BetaToolTextEditor20241022, Anthropic::Models::Beta::BetaToolComputerUse20250124, Anthropic::Models::Beta::BetaToolBash20250124, Anthropic::Models::Beta::BetaToolTextEditor20250124, Anthropic::Models::Beta::BetaToolTextEditor20250429, Anthropic::Models::Beta::BetaWebSearchTool20250305, Anthropic::Models::Beta::BetaCodeExecutionTool20250522>, nil]
290
+ # @return [Array<Anthropic::Models::Beta::BetaTool, Anthropic::Models::Beta::BetaToolBash20241022, Anthropic::Models::Beta::BetaToolBash20250124, Anthropic::Models::Beta::BetaCodeExecutionTool20250522, Anthropic::Models::Beta::BetaToolComputerUse20241022, Anthropic::Models::Beta::BetaToolComputerUse20250124, Anthropic::Models::Beta::BetaToolTextEditor20241022, Anthropic::Models::Beta::BetaToolTextEditor20250124, Anthropic::Models::Beta::BetaToolTextEditor20250429, Anthropic::Models::Beta::BetaWebSearchTool20250305>, nil]
285
291
  optional :tools, -> { Anthropic::Internal::Type::ArrayOf[union: Anthropic::Beta::BetaToolUnion] }
286
292
 
287
293
  # @!attribute top_k
@@ -344,7 +350,7 @@ module Anthropic
344
350
  #
345
351
  # @param tool_choice [Anthropic::Models::Beta::BetaToolChoiceAuto, Anthropic::Models::Beta::BetaToolChoiceAny, Anthropic::Models::Beta::BetaToolChoiceTool, Anthropic::Models::Beta::BetaToolChoiceNone] How the model should use the provided tools. The model can use a specific tool,
346
352
  #
347
- # @param tools [Array<Anthropic::Models::Beta::BetaTool, Anthropic::Models::Beta::BetaToolComputerUse20241022, Anthropic::Models::Beta::BetaToolBash20241022, Anthropic::Models::Beta::BetaToolTextEditor20241022, Anthropic::Models::Beta::BetaToolComputerUse20250124, Anthropic::Models::Beta::BetaToolBash20250124, Anthropic::Models::Beta::BetaToolTextEditor20250124, Anthropic::Models::Beta::BetaToolTextEditor20250429, Anthropic::Models::Beta::BetaWebSearchTool20250305, Anthropic::Models::Beta::BetaCodeExecutionTool20250522>] Definitions of tools that the model may use.
353
+ # @param tools [Array<Anthropic::Models::Beta::BetaTool, Anthropic::Models::Beta::BetaToolBash20241022, Anthropic::Models::Beta::BetaToolBash20250124, Anthropic::Models::Beta::BetaCodeExecutionTool20250522, Anthropic::Models::Beta::BetaToolComputerUse20241022, Anthropic::Models::Beta::BetaToolComputerUse20250124, Anthropic::Models::Beta::BetaToolTextEditor20241022, Anthropic::Models::Beta::BetaToolTextEditor20250124, Anthropic::Models::Beta::BetaToolTextEditor20250429, Anthropic::Models::Beta::BetaWebSearchTool20250305>] Definitions of tools that the model may use.
348
354
  #
349
355
  # @param top_k [Integer] Only sample from the top K options for each subsequent token.
350
356
  #
@@ -165,7 +165,7 @@ module Anthropic
165
165
  # the top-level `system` parameter — there is no `"system"` role for input
166
166
  # messages in the Messages API.
167
167
  #
168
- # There is a limit of 100000 messages in a single request.
168
+ # There is a limit of 100,000 messages in a single request.
169
169
  #
170
170
  # @return [Array<Anthropic::Models::Beta::BetaMessageParam>]
171
171
  required :messages, -> { Anthropic::Internal::Type::ArrayOf[Anthropic::Beta::BetaMessageParam] }
@@ -287,6 +287,12 @@ module Anthropic
287
287
  # those tools using the tool input generated by the model and then optionally
288
288
  # return results back to the model using `tool_result` content blocks.
289
289
  #
290
+ # There are two types of tools: **client tools** and **server tools**. The
291
+ # behavior described below applies to client tools. For
292
+ # [server tools](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/overview#server-tools),
293
+ # see their individual documentation as each has its own behavior (e.g., the
294
+ # [web search tool](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/web-search-tool)).
295
+ #
290
296
  # Each tool definition includes:
291
297
  #
292
298
  # - `name`: Name of the tool.
@@ -350,7 +356,7 @@ module Anthropic
350
356
  #
351
357
  # See our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details.
352
358
  #
353
- # @return [Array<Anthropic::Models::Beta::BetaTool, Anthropic::Models::Beta::BetaToolComputerUse20241022, Anthropic::Models::Beta::BetaToolBash20241022, Anthropic::Models::Beta::BetaToolTextEditor20241022, Anthropic::Models::Beta::BetaToolComputerUse20250124, Anthropic::Models::Beta::BetaToolBash20250124, Anthropic::Models::Beta::BetaToolTextEditor20250124, Anthropic::Models::Beta::BetaToolTextEditor20250429, Anthropic::Models::Beta::BetaWebSearchTool20250305, Anthropic::Models::Beta::BetaCodeExecutionTool20250522>, nil]
359
+ # @return [Array<Anthropic::Models::Beta::BetaTool, Anthropic::Models::Beta::BetaToolBash20241022, Anthropic::Models::Beta::BetaToolBash20250124, Anthropic::Models::Beta::BetaCodeExecutionTool20250522, Anthropic::Models::Beta::BetaToolComputerUse20241022, Anthropic::Models::Beta::BetaToolComputerUse20250124, Anthropic::Models::Beta::BetaToolTextEditor20241022, Anthropic::Models::Beta::BetaToolTextEditor20250124, Anthropic::Models::Beta::BetaToolTextEditor20250429, Anthropic::Models::Beta::BetaWebSearchTool20250305>, nil]
354
360
  optional :tools,
355
361
  -> {
356
362
  Anthropic::Internal::Type::ArrayOf[union: Anthropic::Beta::BetaToolUnion]
@@ -418,7 +424,7 @@ module Anthropic
418
424
  #
419
425
  # @param tool_choice [Anthropic::Models::Beta::BetaToolChoiceAuto, Anthropic::Models::Beta::BetaToolChoiceAny, Anthropic::Models::Beta::BetaToolChoiceTool, Anthropic::Models::Beta::BetaToolChoiceNone] How the model should use the provided tools. The model can use a specific tool,
420
426
  #
421
- # @param tools [Array<Anthropic::Models::Beta::BetaTool, Anthropic::Models::Beta::BetaToolComputerUse20241022, Anthropic::Models::Beta::BetaToolBash20241022, Anthropic::Models::Beta::BetaToolTextEditor20241022, Anthropic::Models::Beta::BetaToolComputerUse20250124, Anthropic::Models::Beta::BetaToolBash20250124, Anthropic::Models::Beta::BetaToolTextEditor20250124, Anthropic::Models::Beta::BetaToolTextEditor20250429, Anthropic::Models::Beta::BetaWebSearchTool20250305, Anthropic::Models::Beta::BetaCodeExecutionTool20250522>] Definitions of tools that the model may use.
427
+ # @param tools [Array<Anthropic::Models::Beta::BetaTool, Anthropic::Models::Beta::BetaToolBash20241022, Anthropic::Models::Beta::BetaToolBash20250124, Anthropic::Models::Beta::BetaCodeExecutionTool20250522, Anthropic::Models::Beta::BetaToolComputerUse20241022, Anthropic::Models::Beta::BetaToolComputerUse20250124, Anthropic::Models::Beta::BetaToolTextEditor20241022, Anthropic::Models::Beta::BetaToolTextEditor20250124, Anthropic::Models::Beta::BetaToolTextEditor20250429, Anthropic::Models::Beta::BetaWebSearchTool20250305>] Definitions of tools that the model may use.
422
428
  #
423
429
  # @param top_k [Integer] Only sample from the top K options for each subsequent token.
424
430
  #
@@ -9,18 +9,18 @@ module Anthropic
9
9
 
10
10
  variant :text, -> { Anthropic::TextBlock }
11
11
 
12
+ variant :thinking, -> { Anthropic::ThinkingBlock }
13
+
14
+ variant :redacted_thinking, -> { Anthropic::RedactedThinkingBlock }
15
+
12
16
  variant :tool_use, -> { Anthropic::ToolUseBlock }
13
17
 
14
18
  variant :server_tool_use, -> { Anthropic::ServerToolUseBlock }
15
19
 
16
20
  variant :web_search_tool_result, -> { Anthropic::WebSearchToolResultBlock }
17
21
 
18
- variant :thinking, -> { Anthropic::ThinkingBlock }
19
-
20
- variant :redacted_thinking, -> { Anthropic::RedactedThinkingBlock }
21
-
22
22
  # @!method self.variants
23
- # @return [Array(Anthropic::Models::TextBlock, Anthropic::Models::ToolUseBlock, Anthropic::Models::ServerToolUseBlock, Anthropic::Models::WebSearchToolResultBlock, Anthropic::Models::ThinkingBlock, Anthropic::Models::RedactedThinkingBlock)]
23
+ # @return [Array(Anthropic::Models::TextBlock, Anthropic::Models::ThinkingBlock, Anthropic::Models::RedactedThinkingBlock, Anthropic::Models::ToolUseBlock, Anthropic::Models::ServerToolUseBlock, Anthropic::Models::WebSearchToolResultBlock)]
24
24
  end
25
25
  end
26
26
  end
@@ -8,22 +8,12 @@ module Anthropic
8
8
 
9
9
  discriminator :type
10
10
 
11
- variant :server_tool_use, -> { Anthropic::ServerToolUseBlockParam }
12
-
13
- variant :web_search_tool_result, -> { Anthropic::WebSearchToolResultBlockParam }
14
-
15
11
  # Regular text content.
16
12
  variant :text, -> { Anthropic::TextBlockParam }
17
13
 
18
14
  # Image content specified directly as base64 data or as a reference via a URL.
19
15
  variant :image, -> { Anthropic::ImageBlockParam }
20
16
 
21
- # A block indicating a tool use by the model.
22
- variant :tool_use, -> { Anthropic::ToolUseBlockParam }
23
-
24
- # A block specifying the results of a tool use by the model.
25
- variant :tool_result, -> { Anthropic::ToolResultBlockParam }
26
-
27
17
  # Document content, either specified directly as base64 data, as text, or as a reference via a URL.
28
18
  variant :document, -> { Anthropic::DocumentBlockParam }
29
19
 
@@ -33,8 +23,18 @@ module Anthropic
33
23
  # A block specifying internal, redacted thinking by the model.
34
24
  variant :redacted_thinking, -> { Anthropic::RedactedThinkingBlockParam }
35
25
 
26
+ # A block indicating a tool use by the model.
27
+ variant :tool_use, -> { Anthropic::ToolUseBlockParam }
28
+
29
+ # A block specifying the results of a tool use by the model.
30
+ variant :tool_result, -> { Anthropic::ToolResultBlockParam }
31
+
32
+ variant :server_tool_use, -> { Anthropic::ServerToolUseBlockParam }
33
+
34
+ variant :web_search_tool_result, -> { Anthropic::WebSearchToolResultBlockParam }
35
+
36
36
  # @!method self.variants
37
- # @return [Array(Anthropic::Models::ServerToolUseBlockParam, Anthropic::Models::WebSearchToolResultBlockParam, Anthropic::Models::TextBlockParam, Anthropic::Models::ImageBlockParam, Anthropic::Models::ToolUseBlockParam, Anthropic::Models::ToolResultBlockParam, Anthropic::Models::DocumentBlockParam, Anthropic::Models::ThinkingBlockParam, Anthropic::Models::RedactedThinkingBlockParam)]
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)]
38
38
  end
39
39
  end
40
40
  end
@@ -48,7 +48,7 @@ module Anthropic
48
48
  # [{ "type": "text", "text": "B)" }]
49
49
  # ```
50
50
  #
51
- # @return [Array<Anthropic::Models::TextBlock, Anthropic::Models::ToolUseBlock, Anthropic::Models::ServerToolUseBlock, Anthropic::Models::WebSearchToolResultBlock, Anthropic::Models::ThinkingBlock, Anthropic::Models::RedactedThinkingBlock>]
51
+ # @return [Array<Anthropic::Models::TextBlock, Anthropic::Models::ThinkingBlock, Anthropic::Models::RedactedThinkingBlock, Anthropic::Models::ToolUseBlock, Anthropic::Models::ServerToolUseBlock, Anthropic::Models::WebSearchToolResultBlock>]
52
52
  required :content, -> { Anthropic::Internal::Type::ArrayOf[union: Anthropic::ContentBlock] }
53
53
 
54
54
  # @!attribute model
@@ -76,6 +76,10 @@ module Anthropic
76
76
  # - `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum
77
77
  # - `"stop_sequence"`: one of your provided custom `stop_sequences` was generated
78
78
  # - `"tool_use"`: the model invoked one or more tools
79
+ # - `"pause_turn"`: we paused a long-running turn. You may provide the response
80
+ # back as-is in a subsequent request to let the model continue.
81
+ # - `"refusal"`: when streaming classifiers intervene to handle potential policy
82
+ # violations
79
83
  #
80
84
  # In non-streaming mode this value is always non-null. In streaming mode, it is
81
85
  # null in the `message_start` event and non-null otherwise.
@@ -126,7 +130,7 @@ module Anthropic
126
130
  #
127
131
  # @param id [String] Unique object identifier.
128
132
  #
129
- # @param content [Array<Anthropic::Models::TextBlock, Anthropic::Models::ToolUseBlock, Anthropic::Models::ServerToolUseBlock, Anthropic::Models::WebSearchToolResultBlock, Anthropic::Models::ThinkingBlock, Anthropic::Models::RedactedThinkingBlock>] Content generated by the model.
133
+ # @param content [Array<Anthropic::Models::TextBlock, Anthropic::Models::ThinkingBlock, Anthropic::Models::RedactedThinkingBlock, Anthropic::Models::ToolUseBlock, Anthropic::Models::ServerToolUseBlock, Anthropic::Models::WebSearchToolResultBlock>] Content generated by the model.
130
134
  #
131
135
  # @param model [Symbol, String, Anthropic::Models::Model] The model that will complete your prompt.\n\nSee [models](https://docs.anthropic
132
136
  #
@@ -95,7 +95,7 @@ module Anthropic
95
95
  # the top-level `system` parameter — there is no `"system"` role for input
96
96
  # messages in the Messages API.
97
97
  #
98
- # There is a limit of 100000 messages in a single request.
98
+ # There is a limit of 100,000 messages in a single request.
99
99
  #
100
100
  # @return [Array<Anthropic::Models::MessageParam>]
101
101
  required :messages, -> { Anthropic::Internal::Type::ArrayOf[Anthropic::MessageParam] }
@@ -147,6 +147,12 @@ module Anthropic
147
147
  # those tools using the tool input generated by the model and then optionally
148
148
  # return results back to the model using `tool_result` content blocks.
149
149
  #
150
+ # There are two types of tools: **client tools** and **server tools**. The
151
+ # behavior described below applies to client tools. For
152
+ # [server tools](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/overview#server-tools),
153
+ # see their individual documentation as each has its own behavior (e.g., the
154
+ # [web search tool](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/web-search-tool)).
155
+ #
150
156
  # Each tool definition includes:
151
157
  #
152
158
  # - `name`: Name of the tool.
@@ -210,7 +216,7 @@ module Anthropic
210
216
  #
211
217
  # See our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details.
212
218
  #
213
- # @return [Array<Anthropic::Models::Tool, Anthropic::Models::ToolBash20250124, Anthropic::Models::ToolTextEditor20250124, Anthropic::Models::WebSearchTool20250305>, nil]
219
+ # @return [Array<Anthropic::Models::Tool, Anthropic::Models::ToolBash20250124, Anthropic::Models::ToolTextEditor20250124, Anthropic::Models::MessageCountTokensTool::TextEditor20250429, Anthropic::Models::WebSearchTool20250305>, nil]
214
220
  optional :tools, -> { Anthropic::Internal::Type::ArrayOf[union: Anthropic::MessageCountTokensTool] }
215
221
 
216
222
  # @!method initialize(messages:, model:, system_: nil, thinking: nil, tool_choice: nil, tools: nil, request_options: {})
@@ -227,7 +233,7 @@ module Anthropic
227
233
  #
228
234
  # @param tool_choice [Anthropic::Models::ToolChoiceAuto, Anthropic::Models::ToolChoiceAny, Anthropic::Models::ToolChoiceTool, Anthropic::Models::ToolChoiceNone] How the model should use the provided tools. The model can use a specific tool,
229
235
  #
230
- # @param tools [Array<Anthropic::Models::Tool, Anthropic::Models::ToolBash20250124, Anthropic::Models::ToolTextEditor20250124, Anthropic::Models::WebSearchTool20250305>] Definitions of tools that the model may use.
236
+ # @param tools [Array<Anthropic::Models::Tool, Anthropic::Models::ToolBash20250124, Anthropic::Models::ToolTextEditor20250124, Anthropic::Models::MessageCountTokensTool::TextEditor20250429, Anthropic::Models::WebSearchTool20250305>] Definitions of tools that the model may use.
231
237
  #
232
238
  # @param request_options [Anthropic::RequestOptions, Hash{Symbol=>Object}]
233
239
 
@@ -11,10 +11,44 @@ module Anthropic
11
11
 
12
12
  variant -> { Anthropic::ToolTextEditor20250124 }
13
13
 
14
+ variant -> { Anthropic::MessageCountTokensTool::TextEditor20250429 }
15
+
14
16
  variant -> { Anthropic::WebSearchTool20250305 }
15
17
 
18
+ class TextEditor20250429 < Anthropic::Internal::Type::BaseModel
19
+ # @!attribute name
20
+ # Name of the tool.
21
+ #
22
+ # This is how the tool will be called by the model and in `tool_use` blocks.
23
+ #
24
+ # @return [Symbol, :str_replace_based_edit_tool]
25
+ required :name, const: :str_replace_based_edit_tool
26
+
27
+ # @!attribute type
28
+ #
29
+ # @return [Symbol, :text_editor_20250429]
30
+ required :type, const: :text_editor_20250429
31
+
32
+ # @!attribute cache_control
33
+ # Create a cache control breakpoint at this content block.
34
+ #
35
+ # @return [Anthropic::Models::CacheControlEphemeral, nil]
36
+ optional :cache_control, -> { Anthropic::CacheControlEphemeral }, nil?: true
37
+
38
+ # @!method initialize(cache_control: nil, name: :str_replace_based_edit_tool, type: :text_editor_20250429)
39
+ # Some parameter documentations has been truncated, see
40
+ # {Anthropic::Models::MessageCountTokensTool::TextEditor20250429} for more
41
+ # details.
42
+ #
43
+ # @param cache_control [Anthropic::Models::CacheControlEphemeral, nil] Create a cache control breakpoint at this content block.
44
+ #
45
+ # @param name [Symbol, :str_replace_based_edit_tool] Name of the tool.
46
+ #
47
+ # @param type [Symbol, :text_editor_20250429]
48
+ end
49
+
16
50
  # @!method self.variants
17
- # @return [Array(Anthropic::Models::Tool, Anthropic::Models::ToolBash20250124, Anthropic::Models::ToolTextEditor20250124, Anthropic::Models::WebSearchTool20250305)]
51
+ # @return [Array(Anthropic::Models::Tool, Anthropic::Models::ToolBash20250124, Anthropic::Models::ToolTextEditor20250124, Anthropic::Models::MessageCountTokensTool::TextEditor20250429, Anthropic::Models::WebSearchTool20250305)]
18
52
  end
19
53
  end
20
54
  end