anthropic 1.1.1 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +123 -0
- data/README.md +32 -16
- data/lib/anthropic/client.rb +5 -2
- data/lib/anthropic/errors.rb +22 -0
- data/lib/anthropic/helpers/bedrock/client.rb +34 -4
- 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 +29 -3
- data/lib/anthropic/internal/type/array_of.rb +7 -1
- data/lib/anthropic/internal/type/base_model.rb +80 -24
- 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 +69 -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 +7 -1
- data/lib/anthropic/internal/type/union.rb +26 -16
- data/lib/anthropic/internal/type/unknown.rb +7 -1
- data/lib/anthropic/internal/util.rb +8 -9
- data/lib/anthropic/models/anthropic_beta.rb +3 -0
- data/lib/anthropic/models/beta/beta_base64_pdf_block.rb +1 -65
- data/lib/anthropic/models/beta/beta_citation_char_location.rb +7 -1
- data/lib/anthropic/models/beta/beta_citation_content_block_location.rb +7 -1
- data/lib/anthropic/models/beta/beta_citation_page_location.rb +7 -1
- 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_text_editor_20250728.rb +49 -0
- data/lib/anthropic/models/beta/beta_tool_union.rb +9 -7
- data/lib/anthropic/models/beta/message_count_tokens_params.rb +18 -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/citation_char_location.rb +7 -1
- data/lib/anthropic/models/citation_content_block_location.rb +7 -1
- data/lib/anthropic/models/citation_page_location.rb +7 -1
- data/lib/anthropic/models/citation_search_result_location_param.rb +51 -0
- data/lib/anthropic/models/citations_delta.rb +5 -3
- data/lib/anthropic/models/citations_search_result_location.rb +51 -0
- data/lib/anthropic/models/content_block.rb +5 -5
- data/lib/anthropic/models/content_block_param.rb +14 -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 +5 -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 +10 -21
- data/lib/anthropic/models/raw_content_block_start_event.rb +7 -7
- data/lib/anthropic/models/search_result_block_param.rb +51 -0
- data/lib/anthropic/models/text_block.rb +2 -2
- data/lib/anthropic/models/text_block_param.rb +2 -2
- data/lib/anthropic/models/text_citation.rb +3 -1
- data/lib/anthropic/models/text_citation_param.rb +3 -1
- data/lib/anthropic/models/tool.rb +7 -1
- data/lib/anthropic/models/tool_result_block_param.rb +6 -4
- data/lib/anthropic/models/tool_text_editor_20250429.rb +36 -0
- data/lib/anthropic/models/tool_text_editor_20250728.rb +45 -0
- data/lib/anthropic/models/tool_union.rb +5 -1
- data/lib/anthropic/models/tool_use_block.rb +6 -0
- data/lib/anthropic/models.rb +14 -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 +14 -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/transport/base_client.rbi +1 -1
- 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 +69 -15
- data/rbi/anthropic/internal/type/union.rbi +14 -2
- data/rbi/anthropic/internal/type/unknown.rbi +2 -0
- data/rbi/anthropic/internal/util.rbi +2 -0
- data/rbi/anthropic/models/anthropic_beta.rbi +2 -0
- data/rbi/anthropic/models/beta/beta_base64_pdf_block.rbi +1 -128
- data/rbi/anthropic/models/beta/beta_citation_char_location.rbi +6 -0
- data/rbi/anthropic/models/beta/beta_citation_content_block_location.rbi +6 -0
- data/rbi/anthropic/models/beta/beta_citation_page_location.rbi +6 -0
- 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_text_editor_20250728.rbi +82 -0
- data/rbi/anthropic/models/beta/beta_tool_union.rbi +6 -5
- data/rbi/anthropic/models/beta/message_count_tokens_params.rbi +44 -27
- data/rbi/anthropic/models/beta/message_create_params.rbi +38 -22
- data/rbi/anthropic/models/beta/messages/batch_create_params.rbi +38 -22
- data/rbi/anthropic/models/citation_char_location.rbi +6 -0
- data/rbi/anthropic/models/citation_content_block_location.rbi +6 -0
- data/rbi/anthropic/models/citation_page_location.rbi +6 -0
- data/rbi/anthropic/models/citation_search_result_location_param.rbi +74 -0
- data/rbi/anthropic/models/citations_delta.rbi +4 -2
- data/rbi/anthropic/models/citations_search_result_location.rbi +74 -0
- data/rbi/anthropic/models/content_block.rbi +3 -3
- data/rbi/anthropic/models/content_block_param.rbi +6 -5
- data/rbi/anthropic/models/message.rbi +11 -3
- data/rbi/anthropic/models/message_count_tokens_params.rbi +22 -2
- data/rbi/anthropic/models/message_count_tokens_tool.rbi +2 -0
- data/rbi/anthropic/models/message_create_params.rbi +22 -2
- data/rbi/anthropic/models/messages/batch_create_params.rbi +22 -2
- data/rbi/anthropic/models/model.rbi +4 -8
- data/rbi/anthropic/models/raw_content_block_start_event.rbi +6 -6
- data/rbi/anthropic/models/search_result_block_param.rbi +77 -0
- data/rbi/anthropic/models/text_block.rbi +2 -1
- data/rbi/anthropic/models/text_block_param.rbi +6 -3
- data/rbi/anthropic/models/text_citation.rbi +2 -1
- data/rbi/anthropic/models/text_citation_param.rbi +2 -1
- data/rbi/anthropic/models/tool.rbi +16 -5
- data/rbi/anthropic/models/tool_result_block_param.rbi +5 -1
- data/rbi/anthropic/models/tool_text_editor_20250429.rbi +62 -0
- data/rbi/anthropic/models/tool_text_editor_20250728.rbi +72 -0
- data/rbi/anthropic/models/tool_union.rbi +2 -0
- data/rbi/anthropic/models.rbi +12 -0
- data/rbi/anthropic/resources/beta/messages.rbi +39 -18
- data/rbi/anthropic/resources/messages.rbi +318 -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/transport/base_client.rbs +1 -1
- data/sig/anthropic/internal/type/base_stream.rbs +4 -0
- data/sig/anthropic/internal/type/converter.rbs +24 -1
- data/sig/anthropic/internal/type/union.rbs +2 -2
- data/sig/anthropic/models/anthropic_beta.rbs +2 -0
- data/sig/anthropic/models/beta/beta_base64_pdf_block.rbs +1 -58
- data/sig/anthropic/models/beta/beta_citation_char_location.rbs +5 -0
- data/sig/anthropic/models/beta/beta_citation_content_block_location.rbs +5 -0
- data/sig/anthropic/models/beta/beta_citation_page_location.rbs +5 -0
- 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_text_editor_20250728.rbs +39 -0
- data/sig/anthropic/models/beta/beta_tool_union.rbs +5 -4
- data/sig/anthropic/models/beta/message_count_tokens_params.rbs +5 -4
- data/sig/anthropic/models/citation_char_location.rbs +5 -0
- data/sig/anthropic/models/citation_content_block_location.rbs +5 -0
- data/sig/anthropic/models/citation_page_location.rbs +5 -0
- data/sig/anthropic/models/citation_search_result_location_param.rbs +50 -0
- data/sig/anthropic/models/citations_delta.rbs +1 -0
- data/sig/anthropic/models/citations_search_result_location.rbs +50 -0
- data/sig/anthropic/models/content_block.rbs +2 -2
- data/sig/anthropic/models/content_block_param.rbs +6 -5
- data/sig/anthropic/models/message_count_tokens_tool.rbs +2 -0
- data/sig/anthropic/models/model.rbs +4 -10
- data/sig/anthropic/models/raw_content_block_start_event.rbs +2 -2
- data/sig/anthropic/models/search_result_block_param.rbs +49 -0
- data/sig/anthropic/models/text_citation.rbs +1 -0
- data/sig/anthropic/models/text_citation_param.rbs +1 -0
- data/sig/anthropic/models/tool.rbs +14 -3
- data/sig/anthropic/models/tool_result_block_param.rbs +4 -1
- data/sig/anthropic/models/tool_text_editor_20250429.rbs +30 -0
- data/sig/anthropic/models/tool_text_editor_20250728.rbs +35 -0
- data/sig/anthropic/models/tool_union.rbs +2 -0
- data/sig/anthropic/models.rbs +10 -0
- data/sig/anthropic/streaming.rbs +3 -0
- metadata +44 -3
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Anthropic
|
|
4
|
+
module Models
|
|
5
|
+
module Beta
|
|
6
|
+
class BetaToolTextEditor20250728 < Anthropic::Internal::Type::BaseModel
|
|
7
|
+
# @!attribute name
|
|
8
|
+
# Name of the tool.
|
|
9
|
+
#
|
|
10
|
+
# This is how the tool will be called by the model and in `tool_use` blocks.
|
|
11
|
+
#
|
|
12
|
+
# @return [Symbol, :str_replace_based_edit_tool]
|
|
13
|
+
required :name, const: :str_replace_based_edit_tool
|
|
14
|
+
|
|
15
|
+
# @!attribute type
|
|
16
|
+
#
|
|
17
|
+
# @return [Symbol, :text_editor_20250728]
|
|
18
|
+
required :type, const: :text_editor_20250728
|
|
19
|
+
|
|
20
|
+
# @!attribute cache_control
|
|
21
|
+
# Create a cache control breakpoint at this content block.
|
|
22
|
+
#
|
|
23
|
+
# @return [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil]
|
|
24
|
+
optional :cache_control, -> { Anthropic::Beta::BetaCacheControlEphemeral }, nil?: true
|
|
25
|
+
|
|
26
|
+
# @!attribute max_characters
|
|
27
|
+
# Maximum number of characters to display when viewing a file. If not specified,
|
|
28
|
+
# defaults to displaying the full file.
|
|
29
|
+
#
|
|
30
|
+
# @return [Integer, nil]
|
|
31
|
+
optional :max_characters, Integer, nil?: true
|
|
32
|
+
|
|
33
|
+
# @!method initialize(cache_control: nil, max_characters: nil, name: :str_replace_based_edit_tool, type: :text_editor_20250728)
|
|
34
|
+
# Some parameter documentations has been truncated, see
|
|
35
|
+
# {Anthropic::Models::Beta::BetaToolTextEditor20250728} for more details.
|
|
36
|
+
#
|
|
37
|
+
# @param cache_control [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil] Create a cache control breakpoint at this content block.
|
|
38
|
+
#
|
|
39
|
+
# @param max_characters [Integer, nil] Maximum number of characters to display when viewing a file. If not specified, d
|
|
40
|
+
#
|
|
41
|
+
# @param name [Symbol, :str_replace_based_edit_tool] Name of the tool.
|
|
42
|
+
#
|
|
43
|
+
# @param type [Symbol, :text_editor_20250728]
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
BetaToolTextEditor20250728 = Beta::BetaToolTextEditor20250728
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -8,26 +8,28 @@ 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
|
|
|
23
25
|
variant -> { Anthropic::Beta::BetaToolTextEditor20250429 }
|
|
24
26
|
|
|
25
|
-
variant -> { Anthropic::Beta::
|
|
27
|
+
variant -> { Anthropic::Beta::BetaToolTextEditor20250728 }
|
|
26
28
|
|
|
27
|
-
variant -> { Anthropic::Beta::
|
|
29
|
+
variant -> { Anthropic::Beta::BetaWebSearchTool20250305 }
|
|
28
30
|
|
|
29
31
|
# @!method self.variants
|
|
30
|
-
# @return [Array(Anthropic::Models::Beta::BetaTool, Anthropic::Models::Beta::
|
|
32
|
+
# @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::BetaToolTextEditor20250728, Anthropic::Models::Beta::BetaWebSearchTool20250305)]
|
|
31
33
|
end
|
|
32
34
|
end
|
|
33
35
|
|
|
@@ -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::BetaToolTextEditor20250728, 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::BetaToolTextEditor20250728, 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,26 +284,28 @@ 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
|
|
|
293
301
|
variant -> { Anthropic::Beta::BetaToolTextEditor20250429 }
|
|
294
302
|
|
|
295
|
-
variant -> { Anthropic::Beta::
|
|
303
|
+
variant -> { Anthropic::Beta::BetaToolTextEditor20250728 }
|
|
296
304
|
|
|
297
|
-
variant -> { Anthropic::Beta::
|
|
305
|
+
variant -> { Anthropic::Beta::BetaWebSearchTool20250305 }
|
|
298
306
|
|
|
299
307
|
# @!method self.variants
|
|
300
|
-
# @return [Array(Anthropic::Models::Beta::BetaTool, Anthropic::Models::Beta::
|
|
308
|
+
# @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::BetaToolTextEditor20250728, Anthropic::Models::Beta::BetaWebSearchTool20250305)]
|
|
301
309
|
end
|
|
302
310
|
end
|
|
303
311
|
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::BetaToolTextEditor20250728, 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::BetaToolTextEditor20250728, 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::BetaToolTextEditor20250728, 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::BetaToolTextEditor20250728, 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
|
#
|
|
@@ -23,6 +23,11 @@ module Anthropic
|
|
|
23
23
|
# @return [Integer]
|
|
24
24
|
required :end_char_index, Integer
|
|
25
25
|
|
|
26
|
+
# @!attribute file_id
|
|
27
|
+
#
|
|
28
|
+
# @return [String, nil]
|
|
29
|
+
required :file_id, String, nil?: true
|
|
30
|
+
|
|
26
31
|
# @!attribute start_char_index
|
|
27
32
|
#
|
|
28
33
|
# @return [Integer]
|
|
@@ -33,11 +38,12 @@ module Anthropic
|
|
|
33
38
|
# @return [Symbol, :char_location]
|
|
34
39
|
required :type, const: :char_location
|
|
35
40
|
|
|
36
|
-
# @!method initialize(cited_text:, document_index:, document_title:, end_char_index:, start_char_index:, type: :char_location)
|
|
41
|
+
# @!method initialize(cited_text:, document_index:, document_title:, end_char_index:, file_id:, start_char_index:, type: :char_location)
|
|
37
42
|
# @param cited_text [String]
|
|
38
43
|
# @param document_index [Integer]
|
|
39
44
|
# @param document_title [String, nil]
|
|
40
45
|
# @param end_char_index [Integer]
|
|
46
|
+
# @param file_id [String, nil]
|
|
41
47
|
# @param start_char_index [Integer]
|
|
42
48
|
# @param type [Symbol, :char_location]
|
|
43
49
|
end
|
|
@@ -23,6 +23,11 @@ module Anthropic
|
|
|
23
23
|
# @return [Integer]
|
|
24
24
|
required :end_block_index, Integer
|
|
25
25
|
|
|
26
|
+
# @!attribute file_id
|
|
27
|
+
#
|
|
28
|
+
# @return [String, nil]
|
|
29
|
+
required :file_id, String, nil?: true
|
|
30
|
+
|
|
26
31
|
# @!attribute start_block_index
|
|
27
32
|
#
|
|
28
33
|
# @return [Integer]
|
|
@@ -33,11 +38,12 @@ module Anthropic
|
|
|
33
38
|
# @return [Symbol, :content_block_location]
|
|
34
39
|
required :type, const: :content_block_location
|
|
35
40
|
|
|
36
|
-
# @!method initialize(cited_text:, document_index:, document_title:, end_block_index:, start_block_index:, type: :content_block_location)
|
|
41
|
+
# @!method initialize(cited_text:, document_index:, document_title:, end_block_index:, file_id:, start_block_index:, type: :content_block_location)
|
|
37
42
|
# @param cited_text [String]
|
|
38
43
|
# @param document_index [Integer]
|
|
39
44
|
# @param document_title [String, nil]
|
|
40
45
|
# @param end_block_index [Integer]
|
|
46
|
+
# @param file_id [String, nil]
|
|
41
47
|
# @param start_block_index [Integer]
|
|
42
48
|
# @param type [Symbol, :content_block_location]
|
|
43
49
|
end
|
|
@@ -23,6 +23,11 @@ module Anthropic
|
|
|
23
23
|
# @return [Integer]
|
|
24
24
|
required :end_page_number, Integer
|
|
25
25
|
|
|
26
|
+
# @!attribute file_id
|
|
27
|
+
#
|
|
28
|
+
# @return [String, nil]
|
|
29
|
+
required :file_id, String, nil?: true
|
|
30
|
+
|
|
26
31
|
# @!attribute start_page_number
|
|
27
32
|
#
|
|
28
33
|
# @return [Integer]
|
|
@@ -33,11 +38,12 @@ module Anthropic
|
|
|
33
38
|
# @return [Symbol, :page_location]
|
|
34
39
|
required :type, const: :page_location
|
|
35
40
|
|
|
36
|
-
# @!method initialize(cited_text:, document_index:, document_title:, end_page_number:, start_page_number:, type: :page_location)
|
|
41
|
+
# @!method initialize(cited_text:, document_index:, document_title:, end_page_number:, file_id:, start_page_number:, type: :page_location)
|
|
37
42
|
# @param cited_text [String]
|
|
38
43
|
# @param document_index [Integer]
|
|
39
44
|
# @param document_title [String, nil]
|
|
40
45
|
# @param end_page_number [Integer]
|
|
46
|
+
# @param file_id [String, nil]
|
|
41
47
|
# @param start_page_number [Integer]
|
|
42
48
|
# @param type [Symbol, :page_location]
|
|
43
49
|
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Anthropic
|
|
4
|
+
module Models
|
|
5
|
+
class CitationSearchResultLocationParam < Anthropic::Internal::Type::BaseModel
|
|
6
|
+
# @!attribute cited_text
|
|
7
|
+
#
|
|
8
|
+
# @return [String]
|
|
9
|
+
required :cited_text, String
|
|
10
|
+
|
|
11
|
+
# @!attribute end_block_index
|
|
12
|
+
#
|
|
13
|
+
# @return [Integer]
|
|
14
|
+
required :end_block_index, Integer
|
|
15
|
+
|
|
16
|
+
# @!attribute search_result_index
|
|
17
|
+
#
|
|
18
|
+
# @return [Integer]
|
|
19
|
+
required :search_result_index, Integer
|
|
20
|
+
|
|
21
|
+
# @!attribute source
|
|
22
|
+
#
|
|
23
|
+
# @return [String]
|
|
24
|
+
required :source, String
|
|
25
|
+
|
|
26
|
+
# @!attribute start_block_index
|
|
27
|
+
#
|
|
28
|
+
# @return [Integer]
|
|
29
|
+
required :start_block_index, Integer
|
|
30
|
+
|
|
31
|
+
# @!attribute title
|
|
32
|
+
#
|
|
33
|
+
# @return [String, nil]
|
|
34
|
+
required :title, String, nil?: true
|
|
35
|
+
|
|
36
|
+
# @!attribute type
|
|
37
|
+
#
|
|
38
|
+
# @return [Symbol, :search_result_location]
|
|
39
|
+
required :type, const: :search_result_location
|
|
40
|
+
|
|
41
|
+
# @!method initialize(cited_text:, end_block_index:, search_result_index:, source:, start_block_index:, title:, type: :search_result_location)
|
|
42
|
+
# @param cited_text [String]
|
|
43
|
+
# @param end_block_index [Integer]
|
|
44
|
+
# @param search_result_index [Integer]
|
|
45
|
+
# @param source [String]
|
|
46
|
+
# @param start_block_index [Integer]
|
|
47
|
+
# @param title [String, nil]
|
|
48
|
+
# @param type [Symbol, :search_result_location]
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -5,7 +5,7 @@ module Anthropic
|
|
|
5
5
|
class CitationsDelta < Anthropic::Internal::Type::BaseModel
|
|
6
6
|
# @!attribute citation
|
|
7
7
|
#
|
|
8
|
-
# @return [Anthropic::Models::CitationCharLocation, Anthropic::Models::CitationPageLocation, Anthropic::Models::CitationContentBlockLocation, Anthropic::Models::CitationsWebSearchResultLocation]
|
|
8
|
+
# @return [Anthropic::Models::CitationCharLocation, Anthropic::Models::CitationPageLocation, Anthropic::Models::CitationContentBlockLocation, Anthropic::Models::CitationsWebSearchResultLocation, Anthropic::Models::CitationsSearchResultLocation]
|
|
9
9
|
required :citation, union: -> { Anthropic::CitationsDelta::Citation }
|
|
10
10
|
|
|
11
11
|
# @!attribute type
|
|
@@ -14,7 +14,7 @@ module Anthropic
|
|
|
14
14
|
required :type, const: :citations_delta
|
|
15
15
|
|
|
16
16
|
# @!method initialize(citation:, type: :citations_delta)
|
|
17
|
-
# @param citation [Anthropic::Models::CitationCharLocation, Anthropic::Models::CitationPageLocation, Anthropic::Models::CitationContentBlockLocation, Anthropic::Models::CitationsWebSearchResultLocation]
|
|
17
|
+
# @param citation [Anthropic::Models::CitationCharLocation, Anthropic::Models::CitationPageLocation, Anthropic::Models::CitationContentBlockLocation, Anthropic::Models::CitationsWebSearchResultLocation, Anthropic::Models::CitationsSearchResultLocation]
|
|
18
18
|
# @param type [Symbol, :citations_delta]
|
|
19
19
|
|
|
20
20
|
# @see Anthropic::Models::CitationsDelta#citation
|
|
@@ -31,8 +31,10 @@ module Anthropic
|
|
|
31
31
|
|
|
32
32
|
variant :web_search_result_location, -> { Anthropic::CitationsWebSearchResultLocation }
|
|
33
33
|
|
|
34
|
+
variant :search_result_location, -> { Anthropic::CitationsSearchResultLocation }
|
|
35
|
+
|
|
34
36
|
# @!method self.variants
|
|
35
|
-
# @return [Array(Anthropic::Models::CitationCharLocation, Anthropic::Models::CitationPageLocation, Anthropic::Models::CitationContentBlockLocation, Anthropic::Models::CitationsWebSearchResultLocation)]
|
|
37
|
+
# @return [Array(Anthropic::Models::CitationCharLocation, Anthropic::Models::CitationPageLocation, Anthropic::Models::CitationContentBlockLocation, Anthropic::Models::CitationsWebSearchResultLocation, Anthropic::Models::CitationsSearchResultLocation)]
|
|
36
38
|
end
|
|
37
39
|
end
|
|
38
40
|
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Anthropic
|
|
4
|
+
module Models
|
|
5
|
+
class CitationsSearchResultLocation < Anthropic::Internal::Type::BaseModel
|
|
6
|
+
# @!attribute cited_text
|
|
7
|
+
#
|
|
8
|
+
# @return [String]
|
|
9
|
+
required :cited_text, String
|
|
10
|
+
|
|
11
|
+
# @!attribute end_block_index
|
|
12
|
+
#
|
|
13
|
+
# @return [Integer]
|
|
14
|
+
required :end_block_index, Integer
|
|
15
|
+
|
|
16
|
+
# @!attribute search_result_index
|
|
17
|
+
#
|
|
18
|
+
# @return [Integer]
|
|
19
|
+
required :search_result_index, Integer
|
|
20
|
+
|
|
21
|
+
# @!attribute source
|
|
22
|
+
#
|
|
23
|
+
# @return [String]
|
|
24
|
+
required :source, String
|
|
25
|
+
|
|
26
|
+
# @!attribute start_block_index
|
|
27
|
+
#
|
|
28
|
+
# @return [Integer]
|
|
29
|
+
required :start_block_index, Integer
|
|
30
|
+
|
|
31
|
+
# @!attribute title
|
|
32
|
+
#
|
|
33
|
+
# @return [String, nil]
|
|
34
|
+
required :title, String, nil?: true
|
|
35
|
+
|
|
36
|
+
# @!attribute type
|
|
37
|
+
#
|
|
38
|
+
# @return [Symbol, :search_result_location]
|
|
39
|
+
required :type, const: :search_result_location
|
|
40
|
+
|
|
41
|
+
# @!method initialize(cited_text:, end_block_index:, search_result_index:, source:, start_block_index:, title:, type: :search_result_location)
|
|
42
|
+
# @param cited_text [String]
|
|
43
|
+
# @param end_block_index [Integer]
|
|
44
|
+
# @param search_result_index [Integer]
|
|
45
|
+
# @param source [String]
|
|
46
|
+
# @param start_block_index [Integer]
|
|
47
|
+
# @param title [String, nil]
|
|
48
|
+
# @param type [Symbol, :search_result_location]
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -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,33 +8,36 @@ 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
|
|
|
20
|
+
# A search result block containing source, title, and content from search operations.
|
|
21
|
+
variant :search_result, -> { Anthropic::SearchResultBlockParam }
|
|
22
|
+
|
|
30
23
|
# A block specifying internal thinking by the model.
|
|
31
24
|
variant :thinking, -> { Anthropic::ThinkingBlockParam }
|
|
32
25
|
|
|
33
26
|
# A block specifying internal, redacted thinking by the model.
|
|
34
27
|
variant :redacted_thinking, -> { Anthropic::RedactedThinkingBlockParam }
|
|
35
28
|
|
|
29
|
+
# A block indicating a tool use by the model.
|
|
30
|
+
variant :tool_use, -> { Anthropic::ToolUseBlockParam }
|
|
31
|
+
|
|
32
|
+
# A block specifying the results of a tool use by the model.
|
|
33
|
+
variant :tool_result, -> { Anthropic::ToolResultBlockParam }
|
|
34
|
+
|
|
35
|
+
variant :server_tool_use, -> { Anthropic::ServerToolUseBlockParam }
|
|
36
|
+
|
|
37
|
+
variant :web_search_tool_result, -> { Anthropic::WebSearchToolResultBlockParam }
|
|
38
|
+
|
|
36
39
|
# @!method self.variants
|
|
37
|
-
# @return [Array(Anthropic::Models::
|
|
40
|
+
# @return [Array(Anthropic::Models::TextBlockParam, Anthropic::Models::ImageBlockParam, Anthropic::Models::DocumentBlockParam, Anthropic::Models::SearchResultBlockParam, Anthropic::Models::ThinkingBlockParam, Anthropic::Models::RedactedThinkingBlockParam, Anthropic::Models::ToolUseBlockParam, Anthropic::Models::ToolResultBlockParam, Anthropic::Models::ServerToolUseBlockParam, Anthropic::Models::WebSearchToolResultBlockParam)]
|
|
38
41
|
end
|
|
39
42
|
end
|
|
40
43
|
end
|
|
@@ -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::ToolTextEditor20250429, Anthropic::Models::ToolTextEditor20250728, 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::ToolTextEditor20250429, Anthropic::Models::ToolTextEditor20250728, 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,14 @@ module Anthropic
|
|
|
11
11
|
|
|
12
12
|
variant -> { Anthropic::ToolTextEditor20250124 }
|
|
13
13
|
|
|
14
|
+
variant -> { Anthropic::ToolTextEditor20250429 }
|
|
15
|
+
|
|
16
|
+
variant -> { Anthropic::ToolTextEditor20250728 }
|
|
17
|
+
|
|
14
18
|
variant -> { Anthropic::WebSearchTool20250305 }
|
|
15
19
|
|
|
16
20
|
# @!method self.variants
|
|
17
|
-
# @return [Array(Anthropic::Models::Tool, Anthropic::Models::ToolBash20250124, Anthropic::Models::ToolTextEditor20250124, Anthropic::Models::WebSearchTool20250305)]
|
|
21
|
+
# @return [Array(Anthropic::Models::Tool, Anthropic::Models::ToolBash20250124, Anthropic::Models::ToolTextEditor20250124, Anthropic::Models::ToolTextEditor20250429, Anthropic::Models::ToolTextEditor20250728, Anthropic::Models::WebSearchTool20250305)]
|
|
18
22
|
end
|
|
19
23
|
end
|
|
20
24
|
end
|