anthropic 1.1.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +69 -0
- data/README.md +32 -16
- data/lib/anthropic/errors.rb +22 -0
- data/lib/anthropic/helpers/streaming/events.rb +141 -0
- data/lib/anthropic/helpers/streaming/message_stream.rb +238 -0
- data/lib/anthropic/helpers/streaming.rb +37 -0
- data/lib/anthropic/helpers/vertex/client.rb +4 -1
- data/lib/anthropic/internal/stream.rb +4 -2
- data/lib/anthropic/internal/transport/base_client.rb +10 -2
- data/lib/anthropic/internal/type/array_of.rb +6 -1
- data/lib/anthropic/internal/type/base_model.rb +77 -23
- data/lib/anthropic/internal/type/base_stream.rb +3 -1
- data/lib/anthropic/internal/type/boolean.rb +7 -1
- data/lib/anthropic/internal/type/converter.rb +42 -34
- data/lib/anthropic/internal/type/enum.rb +16 -5
- data/lib/anthropic/internal/type/file_input.rb +6 -1
- data/lib/anthropic/internal/type/hash_of.rb +6 -1
- data/lib/anthropic/internal/type/union.rb +17 -9
- data/lib/anthropic/internal/type/unknown.rb +7 -1
- data/lib/anthropic/internal/util.rb +8 -9
- data/lib/anthropic/models/beta/beta_base64_pdf_block.rb +1 -65
- data/lib/anthropic/models/beta/beta_citation_search_result_location.rb +55 -0
- data/lib/anthropic/models/beta/beta_citation_search_result_location_param.rb +55 -0
- data/lib/anthropic/models/beta/beta_citations_delta.rb +5 -3
- data/lib/anthropic/models/beta/beta_content_block.rb +5 -5
- data/lib/anthropic/models/beta/beta_content_block_param.rb +20 -17
- data/lib/anthropic/models/beta/beta_message.rb +6 -2
- data/lib/anthropic/models/beta/beta_message_param.rb +3 -3
- data/lib/anthropic/models/beta/beta_raw_content_block_start_event.rb +7 -7
- data/lib/anthropic/models/beta/beta_request_document_block.rb +75 -0
- data/lib/anthropic/models/beta/beta_search_result_block_param.rb +55 -0
- data/lib/anthropic/models/beta/beta_text_block.rb +2 -2
- data/lib/anthropic/models/beta/beta_text_block_param.rb +2 -2
- data/lib/anthropic/models/beta/beta_text_citation.rb +3 -1
- data/lib/anthropic/models/beta/beta_text_citation_param.rb +3 -1
- data/lib/anthropic/models/beta/beta_tool.rb +7 -1
- data/lib/anthropic/models/beta/beta_tool_result_block_param.rb +6 -4
- data/lib/anthropic/models/beta/beta_tool_union.rb +7 -7
- data/lib/anthropic/models/beta/message_count_tokens_params.rb +16 -10
- data/lib/anthropic/models/beta/message_create_params.rb +9 -3
- data/lib/anthropic/models/beta/messages/batch_create_params.rb +9 -3
- data/lib/anthropic/models/content_block.rb +5 -5
- data/lib/anthropic/models/content_block_param.rb +11 -11
- data/lib/anthropic/models/message.rb +6 -2
- data/lib/anthropic/models/message_count_tokens_params.rb +9 -3
- data/lib/anthropic/models/message_count_tokens_tool.rb +35 -1
- data/lib/anthropic/models/message_create_params.rb +9 -3
- data/lib/anthropic/models/message_param.rb +3 -3
- data/lib/anthropic/models/messages/batch_create_params.rb +9 -3
- data/lib/anthropic/models/model.rb +5 -21
- data/lib/anthropic/models/raw_content_block_start_event.rb +7 -7
- data/lib/anthropic/models/tool.rb +7 -1
- data/lib/anthropic/models/tool_union.rb +34 -1
- data/lib/anthropic/models/tool_use_block.rb +6 -0
- data/lib/anthropic/models.rb +4 -4
- data/lib/anthropic/resources/beta/messages.rb +73 -6
- data/lib/anthropic/resources/messages.rb +68 -7
- data/lib/anthropic/streaming.rb +5 -0
- data/lib/anthropic/version.rb +1 -1
- data/lib/anthropic.rb +8 -0
- data/rbi/anthropic/errors.rbi +16 -0
- data/rbi/anthropic/helpers/bedrock/client.rbi +17 -6
- data/rbi/anthropic/helpers/streaming/events.rbi +95 -0
- data/rbi/anthropic/helpers/streaming/message_stream.rbi +73 -0
- data/rbi/anthropic/helpers/vertex/client.rbi +17 -6
- data/rbi/anthropic/internal/type/base_stream.rbi +8 -1
- data/rbi/anthropic/internal/type/boolean.rbi +2 -0
- data/rbi/anthropic/internal/type/converter.rbi +15 -15
- data/rbi/anthropic/internal/type/union.rbi +5 -0
- data/rbi/anthropic/internal/type/unknown.rbi +2 -0
- data/rbi/anthropic/internal/util.rbi +2 -0
- data/rbi/anthropic/models/beta/beta_base64_pdf_block.rbi +1 -128
- data/rbi/anthropic/models/beta/beta_citation_search_result_location.rbi +78 -0
- data/rbi/anthropic/models/beta/beta_citation_search_result_location_param.rbi +79 -0
- data/rbi/anthropic/models/beta/beta_citations_delta.rbi +4 -2
- data/rbi/anthropic/models/beta/beta_content_block.rbi +3 -3
- data/rbi/anthropic/models/beta/beta_content_block_param.rbi +8 -7
- data/rbi/anthropic/models/beta/beta_message.rbi +11 -3
- data/rbi/anthropic/models/beta/beta_raw_content_block_start_event.rbi +6 -6
- data/rbi/anthropic/models/beta/beta_request_document_block.rbi +140 -0
- data/rbi/anthropic/models/beta/beta_search_result_block_param.rbi +91 -0
- data/rbi/anthropic/models/beta/beta_text_block.rbi +2 -1
- data/rbi/anthropic/models/beta/beta_text_block_param.rbi +6 -3
- data/rbi/anthropic/models/beta/beta_text_citation.rbi +2 -1
- data/rbi/anthropic/models/beta/beta_text_citation_param.rbi +2 -1
- data/rbi/anthropic/models/beta/beta_tool.rbi +14 -5
- data/rbi/anthropic/models/beta/beta_tool_result_block_param.rbi +2 -1
- data/rbi/anthropic/models/beta/beta_tool_union.rbi +5 -5
- data/rbi/anthropic/models/beta/message_count_tokens_params.rbi +39 -27
- data/rbi/anthropic/models/beta/message_create_params.rbi +34 -22
- data/rbi/anthropic/models/beta/messages/batch_create_params.rbi +34 -22
- data/rbi/anthropic/models/content_block.rbi +3 -3
- data/rbi/anthropic/models/content_block_param.rbi +5 -5
- data/rbi/anthropic/models/message.rbi +11 -3
- data/rbi/anthropic/models/message_count_tokens_params.rbi +18 -2
- data/rbi/anthropic/models/message_count_tokens_tool.rbi +61 -0
- data/rbi/anthropic/models/message_create_params.rbi +18 -2
- data/rbi/anthropic/models/messages/batch_create_params.rbi +18 -2
- data/rbi/anthropic/models/model.rbi +0 -8
- data/rbi/anthropic/models/raw_content_block_start_event.rbi +6 -6
- data/rbi/anthropic/models/tool.rbi +16 -5
- data/rbi/anthropic/models/tool_union.rbi +61 -0
- data/rbi/anthropic/resources/beta/messages.rbi +36 -18
- data/rbi/anthropic/resources/messages.rbi +315 -3
- data/rbi/anthropic/streaming.rbi +5 -0
- data/sig/anthropic/errors.rbs +9 -0
- data/sig/anthropic/helpers/streaming/events.rbs +117 -0
- data/sig/anthropic/helpers/streaming/message_stream.rbs +57 -0
- data/sig/anthropic/internal/type/base_stream.rbs +4 -0
- data/sig/anthropic/internal/type/converter.rbs +7 -1
- data/sig/anthropic/models/beta/beta_base64_pdf_block.rbs +1 -58
- data/sig/anthropic/models/beta/beta_citation_search_result_location.rbs +54 -0
- data/sig/anthropic/models/beta/beta_citation_search_result_location_param.rbs +54 -0
- data/sig/anthropic/models/beta/beta_citations_delta.rbs +1 -0
- data/sig/anthropic/models/beta/beta_content_block.rbs +2 -2
- data/sig/anthropic/models/beta/beta_content_block_param.rbs +9 -8
- data/sig/anthropic/models/beta/beta_raw_content_block_start_event.rbs +2 -2
- data/sig/anthropic/models/beta/beta_request_document_block.rbs +66 -0
- data/sig/anthropic/models/beta/beta_search_result_block_param.rbs +53 -0
- data/sig/anthropic/models/beta/beta_text_citation.rbs +1 -0
- data/sig/anthropic/models/beta/beta_text_citation_param.rbs +1 -0
- data/sig/anthropic/models/beta/beta_tool.rbs +14 -3
- data/sig/anthropic/models/beta/beta_tool_result_block_param.rbs +1 -0
- data/sig/anthropic/models/beta/beta_tool_union.rbs +4 -4
- data/sig/anthropic/models/beta/message_count_tokens_params.rbs +4 -4
- data/sig/anthropic/models/content_block.rbs +2 -2
- data/sig/anthropic/models/content_block_param.rbs +5 -5
- data/sig/anthropic/models/message_count_tokens_tool.rbs +28 -0
- data/sig/anthropic/models/model.rbs +0 -10
- data/sig/anthropic/models/raw_content_block_start_event.rbs +2 -2
- data/sig/anthropic/models/tool.rbs +14 -3
- data/sig/anthropic/models/tool_union.rbs +28 -0
- data/sig/anthropic/streaming.rbs +3 -0
- metadata +26 -3
@@ -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
|
-
# @!
|
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::
|
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::
|
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::
|
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
|
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::
|
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::
|
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::
|
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::
|
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::
|
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
|
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::
|
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::
|
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
|
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::
|
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::
|
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::
|
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::
|
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::
|
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::
|
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
|
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
|
@@ -109,7 +109,7 @@ module Anthropic
|
|
109
109
|
# the top-level `system` parameter — there is no `"system"` role for input
|
110
110
|
# messages in the Messages API.
|
111
111
|
#
|
112
|
-
# There is a limit of
|
112
|
+
# There is a limit of 100,000 messages in a single request.
|
113
113
|
#
|
114
114
|
# @return [Array<Anthropic::Models::MessageParam>]
|
115
115
|
required :messages, -> { Anthropic::Internal::Type::ArrayOf[Anthropic::MessageParam] }
|
@@ -204,6 +204,12 @@ module Anthropic
|
|
204
204
|
# those tools using the tool input generated by the model and then optionally
|
205
205
|
# return results back to the model using `tool_result` content blocks.
|
206
206
|
#
|
207
|
+
# There are two types of tools: **client tools** and **server tools**. The
|
208
|
+
# behavior described below applies to client tools. For
|
209
|
+
# [server tools](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/overview#server-tools),
|
210
|
+
# see their individual documentation as each has its own behavior (e.g., the
|
211
|
+
# [web search tool](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/web-search-tool)).
|
212
|
+
#
|
207
213
|
# Each tool definition includes:
|
208
214
|
#
|
209
215
|
# - `name`: Name of the tool.
|
@@ -267,7 +273,7 @@ module Anthropic
|
|
267
273
|
#
|
268
274
|
# See our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details.
|
269
275
|
#
|
270
|
-
# @return [Array<Anthropic::Models::Tool, Anthropic::Models::ToolBash20250124, Anthropic::Models::ToolTextEditor20250124, Anthropic::Models::WebSearchTool20250305>, nil]
|
276
|
+
# @return [Array<Anthropic::Models::Tool, Anthropic::Models::ToolBash20250124, Anthropic::Models::ToolTextEditor20250124, Anthropic::Models::ToolUnion::TextEditor20250429, Anthropic::Models::WebSearchTool20250305>, nil]
|
271
277
|
optional :tools, -> { Anthropic::Internal::Type::ArrayOf[union: Anthropic::ToolUnion] }
|
272
278
|
|
273
279
|
# @!attribute top_k
|
@@ -320,7 +326,7 @@ module Anthropic
|
|
320
326
|
#
|
321
327
|
# @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,
|
322
328
|
#
|
323
|
-
# @param tools [Array<Anthropic::Models::Tool, Anthropic::Models::ToolBash20250124, Anthropic::Models::ToolTextEditor20250124, Anthropic::Models::WebSearchTool20250305>] Definitions of tools that the model may use.
|
329
|
+
# @param tools [Array<Anthropic::Models::Tool, Anthropic::Models::ToolBash20250124, Anthropic::Models::ToolTextEditor20250124, Anthropic::Models::ToolUnion::TextEditor20250429, Anthropic::Models::WebSearchTool20250305>] Definitions of tools that the model may use.
|
324
330
|
#
|
325
331
|
# @param top_k [Integer] Only sample from the top K options for each subsequent token.
|
326
332
|
#
|
@@ -5,7 +5,7 @@ module Anthropic
|
|
5
5
|
class MessageParam < Anthropic::Internal::Type::BaseModel
|
6
6
|
# @!attribute content
|
7
7
|
#
|
8
|
-
# @return [String, Array<Anthropic::Models::
|
8
|
+
# @return [String, Array<Anthropic::Models::TextBlockParam, Anthropic::Models::ImageBlockParam, Anthropic::Models::DocumentBlockParam, Anthropic::Models::ThinkingBlockParam, Anthropic::Models::RedactedThinkingBlockParam, Anthropic::Models::ToolUseBlockParam, Anthropic::Models::ToolResultBlockParam, Anthropic::Models::ServerToolUseBlockParam, Anthropic::Models::WebSearchToolResultBlockParam>]
|
9
9
|
required :content, union: -> { Anthropic::MessageParam::Content }
|
10
10
|
|
11
11
|
# @!attribute role
|
@@ -14,7 +14,7 @@ module Anthropic
|
|
14
14
|
required :role, enum: -> { Anthropic::MessageParam::Role }
|
15
15
|
|
16
16
|
# @!method initialize(content:, role:)
|
17
|
-
# @param content [String, Array<Anthropic::Models::
|
17
|
+
# @param content [String, Array<Anthropic::Models::TextBlockParam, Anthropic::Models::ImageBlockParam, Anthropic::Models::DocumentBlockParam, Anthropic::Models::ThinkingBlockParam, Anthropic::Models::RedactedThinkingBlockParam, Anthropic::Models::ToolUseBlockParam, Anthropic::Models::ToolResultBlockParam, Anthropic::Models::ServerToolUseBlockParam, Anthropic::Models::WebSearchToolResultBlockParam>]
|
18
18
|
# @param role [Symbol, Anthropic::Models::MessageParam::Role]
|
19
19
|
|
20
20
|
# @see Anthropic::Models::MessageParam#content
|
@@ -26,7 +26,7 @@ module Anthropic
|
|
26
26
|
variant -> { Anthropic::Models::MessageParam::Content::ContentBlockParamArray }
|
27
27
|
|
28
28
|
# @!method self.variants
|
29
|
-
# @return [Array(String, Array<Anthropic::Models::
|
29
|
+
# @return [Array(String, Array<Anthropic::Models::TextBlockParam, Anthropic::Models::ImageBlockParam, Anthropic::Models::DocumentBlockParam, Anthropic::Models::ThinkingBlockParam, Anthropic::Models::RedactedThinkingBlockParam, Anthropic::Models::ToolUseBlockParam, Anthropic::Models::ToolResultBlockParam, Anthropic::Models::ServerToolUseBlockParam, Anthropic::Models::WebSearchToolResultBlockParam>)]
|
30
30
|
|
31
31
|
# @type [Anthropic::Internal::Type::Converter]
|
32
32
|
ContentBlockParamArray = Anthropic::Internal::Type::ArrayOf[union: -> {
|
@@ -153,7 +153,7 @@ module Anthropic
|
|
153
153
|
# the top-level `system` parameter — there is no `"system"` role for input
|
154
154
|
# messages in the Messages API.
|
155
155
|
#
|
156
|
-
# There is a limit of
|
156
|
+
# There is a limit of 100,000 messages in a single request.
|
157
157
|
#
|
158
158
|
# @return [Array<Anthropic::Models::MessageParam>]
|
159
159
|
required :messages, -> { Anthropic::Internal::Type::ArrayOf[Anthropic::MessageParam] }
|
@@ -262,6 +262,12 @@ module Anthropic
|
|
262
262
|
# those tools using the tool input generated by the model and then optionally
|
263
263
|
# return results back to the model using `tool_result` content blocks.
|
264
264
|
#
|
265
|
+
# There are two types of tools: **client tools** and **server tools**. The
|
266
|
+
# behavior described below applies to client tools. For
|
267
|
+
# [server tools](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/overview#server-tools),
|
268
|
+
# see their individual documentation as each has its own behavior (e.g., the
|
269
|
+
# [web search tool](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/web-search-tool)).
|
270
|
+
#
|
265
271
|
# Each tool definition includes:
|
266
272
|
#
|
267
273
|
# - `name`: Name of the tool.
|
@@ -325,7 +331,7 @@ module Anthropic
|
|
325
331
|
#
|
326
332
|
# See our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details.
|
327
333
|
#
|
328
|
-
# @return [Array<Anthropic::Models::Tool, Anthropic::Models::ToolBash20250124, Anthropic::Models::ToolTextEditor20250124, Anthropic::Models::WebSearchTool20250305>, nil]
|
334
|
+
# @return [Array<Anthropic::Models::Tool, Anthropic::Models::ToolBash20250124, Anthropic::Models::ToolTextEditor20250124, Anthropic::Models::ToolUnion::TextEditor20250429, Anthropic::Models::WebSearchTool20250305>, nil]
|
329
335
|
optional :tools, -> { Anthropic::Internal::Type::ArrayOf[union: Anthropic::ToolUnion] }
|
330
336
|
|
331
337
|
# @!attribute top_k
|
@@ -386,7 +392,7 @@ module Anthropic
|
|
386
392
|
#
|
387
393
|
# @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,
|
388
394
|
#
|
389
|
-
# @param tools [Array<Anthropic::Models::Tool, Anthropic::Models::ToolBash20250124, Anthropic::Models::ToolTextEditor20250124, Anthropic::Models::WebSearchTool20250305>] Definitions of tools that the model may use.
|
395
|
+
# @param tools [Array<Anthropic::Models::Tool, Anthropic::Models::ToolBash20250124, Anthropic::Models::ToolTextEditor20250124, Anthropic::Models::ToolUnion::TextEditor20250429, Anthropic::Models::WebSearchTool20250305>] Definitions of tools that the model may use.
|
390
396
|
#
|
391
397
|
# @param top_k [Integer] Only sample from the top K options for each subsequent token.
|
392
398
|
#
|
@@ -38,14 +38,8 @@ module Anthropic
|
|
38
38
|
|
39
39
|
variant const: -> { Anthropic::Models::Model::CLAUDE_3_OPUS_20240229 }
|
40
40
|
|
41
|
-
variant const: -> { Anthropic::Models::Model::CLAUDE_3_SONNET_20240229 }
|
42
|
-
|
43
41
|
variant const: -> { Anthropic::Models::Model::CLAUDE_3_HAIKU_20240307 }
|
44
42
|
|
45
|
-
variant const: -> { Anthropic::Models::Model::CLAUDE_2_1 }
|
46
|
-
|
47
|
-
variant const: -> { Anthropic::Models::Model::CLAUDE_2_0 }
|
48
|
-
|
49
43
|
variant String
|
50
44
|
|
51
45
|
# @!method self.variants
|
@@ -96,30 +90,20 @@ module Anthropic
|
|
96
90
|
CLAUDE_4_OPUS_20250514 = :"claude-4-opus-20250514"
|
97
91
|
|
98
92
|
# Excels at writing and complex tasks
|
93
|
+
# @deprecated Will reach end-of-life on January 5th, 2026. Please migrate to a newer model.
|
94
|
+
# Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more
|
95
|
+
# information.
|
99
96
|
CLAUDE_3_OPUS_LATEST = :"claude-3-opus-latest"
|
100
97
|
|
101
98
|
# Excels at writing and complex tasks
|
102
|
-
|
103
|
-
|
104
|
-
# Balance of speed and intelligence
|
105
|
-
# @deprecated Will reach end-of-life on July 21st, 2025. Please migrate to a newer model.
|
99
|
+
# @deprecated Will reach end-of-life on January 5th, 2026. Please migrate to a newer model.
|
106
100
|
# Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more
|
107
101
|
# information.
|
108
|
-
|
102
|
+
CLAUDE_3_OPUS_20240229 = :"claude-3-opus-20240229"
|
109
103
|
|
110
104
|
# Our previous most fast and cost-effective
|
111
105
|
CLAUDE_3_HAIKU_20240307 = :"claude-3-haiku-20240307"
|
112
106
|
|
113
|
-
# @deprecated Will reach end-of-life on July 21st, 2025. Please migrate to a newer model.
|
114
|
-
# Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more
|
115
|
-
# information.
|
116
|
-
CLAUDE_2_1 = :"claude-2.1"
|
117
|
-
|
118
|
-
# @deprecated Will reach end-of-life on July 21st, 2025. Please migrate to a newer model.
|
119
|
-
# Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more
|
120
|
-
# information.
|
121
|
-
CLAUDE_2_0 = :"claude-2.0"
|
122
|
-
|
123
107
|
# @!endgroup
|
124
108
|
end
|
125
109
|
end
|