anthropic 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +62 -0
- data/README.md +32 -16
- data/lib/anthropic/errors.rb +22 -0
- data/lib/anthropic/helpers/bedrock/client.rb +3 -1
- 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 +8 -3
- 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 +18 -11
- 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 +6 -0
- 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 +5 -5
- 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 +11 -1
- data/rbi/anthropic/errors.rbi +16 -0
- data/rbi/anthropic/helpers/streaming/events.rbi +85 -0
- data/rbi/anthropic/helpers/streaming/message_stream.rbi +59 -0
- 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/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 +293 -3
- data/rbi/anthropic/streaming.rbi +5 -0
- data/sig/anthropic/errors.rbs +9 -0
- data/sig/anthropic/helpers/streaming/events.rbs +119 -0
- data/sig/anthropic/helpers/streaming/message_stream.rbs +55 -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/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
@@ -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
|
#
|
@@ -96,9 +96,15 @@ module Anthropic
|
|
96
96
|
CLAUDE_4_OPUS_20250514 = :"claude-4-opus-20250514"
|
97
97
|
|
98
98
|
# Excels at writing and complex tasks
|
99
|
+
# @deprecated Will reach end-of-life on January 5th, 2026. Please migrate to a newer model.
|
100
|
+
# Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more
|
101
|
+
# information.
|
99
102
|
CLAUDE_3_OPUS_LATEST = :"claude-3-opus-latest"
|
100
103
|
|
101
104
|
# Excels at writing and complex tasks
|
105
|
+
# @deprecated Will reach end-of-life on January 5th, 2026. Please migrate to a newer model.
|
106
|
+
# Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more
|
107
|
+
# information.
|
102
108
|
CLAUDE_3_OPUS_20240229 = :"claude-3-opus-20240229"
|
103
109
|
|
104
110
|
# Balance of speed and intelligence
|
@@ -5,7 +5,7 @@ module Anthropic
|
|
5
5
|
class RawContentBlockStartEvent < Anthropic::Internal::Type::BaseModel
|
6
6
|
# @!attribute content_block
|
7
7
|
#
|
8
|
-
# @return [Anthropic::Models::TextBlock, Anthropic::Models::
|
8
|
+
# @return [Anthropic::Models::TextBlock, Anthropic::Models::ThinkingBlock, Anthropic::Models::RedactedThinkingBlock, Anthropic::Models::ToolUseBlock, Anthropic::Models::ServerToolUseBlock, Anthropic::Models::WebSearchToolResultBlock]
|
9
9
|
required :content_block, union: -> { Anthropic::RawContentBlockStartEvent::ContentBlock }
|
10
10
|
|
11
11
|
# @!attribute index
|
@@ -19,7 +19,7 @@ module Anthropic
|
|
19
19
|
required :type, const: :content_block_start
|
20
20
|
|
21
21
|
# @!method initialize(content_block:, index:, type: :content_block_start)
|
22
|
-
# @param content_block [Anthropic::Models::TextBlock, Anthropic::Models::
|
22
|
+
# @param content_block [Anthropic::Models::TextBlock, Anthropic::Models::ThinkingBlock, Anthropic::Models::RedactedThinkingBlock, Anthropic::Models::ToolUseBlock, Anthropic::Models::ServerToolUseBlock, Anthropic::Models::WebSearchToolResultBlock]
|
23
23
|
# @param index [Integer]
|
24
24
|
# @param type [Symbol, :content_block_start]
|
25
25
|
|
@@ -31,18 +31,18 @@ module Anthropic
|
|
31
31
|
|
32
32
|
variant :text, -> { Anthropic::TextBlock }
|
33
33
|
|
34
|
+
variant :thinking, -> { Anthropic::ThinkingBlock }
|
35
|
+
|
36
|
+
variant :redacted_thinking, -> { Anthropic::RedactedThinkingBlock }
|
37
|
+
|
34
38
|
variant :tool_use, -> { Anthropic::ToolUseBlock }
|
35
39
|
|
36
40
|
variant :server_tool_use, -> { Anthropic::ServerToolUseBlock }
|
37
41
|
|
38
42
|
variant :web_search_tool_result, -> { Anthropic::WebSearchToolResultBlock }
|
39
43
|
|
40
|
-
variant :thinking, -> { Anthropic::ThinkingBlock }
|
41
|
-
|
42
|
-
variant :redacted_thinking, -> { Anthropic::RedactedThinkingBlock }
|
43
|
-
|
44
44
|
# @!method self.variants
|
45
|
-
# @return [Array(Anthropic::Models::TextBlock, Anthropic::Models::
|
45
|
+
# @return [Array(Anthropic::Models::TextBlock, Anthropic::Models::ThinkingBlock, Anthropic::Models::RedactedThinkingBlock, Anthropic::Models::ToolUseBlock, Anthropic::Models::ServerToolUseBlock, Anthropic::Models::WebSearchToolResultBlock)]
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
@@ -68,13 +68,19 @@ module Anthropic
|
|
68
68
|
# @return [Object, nil]
|
69
69
|
optional :properties, Anthropic::Internal::Type::Unknown, nil?: true
|
70
70
|
|
71
|
-
# @!
|
71
|
+
# @!attribute required
|
72
|
+
#
|
73
|
+
# @return [Array<String>, nil]
|
74
|
+
optional :required, Anthropic::Internal::Type::ArrayOf[String], nil?: true
|
75
|
+
|
76
|
+
# @!method initialize(properties: nil, required: nil, type: :object)
|
72
77
|
# [JSON schema](https://json-schema.org/draft/2020-12) for this tool's input.
|
73
78
|
#
|
74
79
|
# This defines the shape of the `input` that your tool accepts and that the model
|
75
80
|
# will produce.
|
76
81
|
#
|
77
82
|
# @param properties [Object, nil]
|
83
|
+
# @param required [Array<String>, nil]
|
78
84
|
# @param type [Symbol, :object]
|
79
85
|
end
|
80
86
|
|
@@ -11,10 +11,43 @@ module Anthropic
|
|
11
11
|
|
12
12
|
variant -> { Anthropic::ToolTextEditor20250124 }
|
13
13
|
|
14
|
+
variant -> { Anthropic::ToolUnion::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::ToolUnion::TextEditor20250429} for more details.
|
41
|
+
#
|
42
|
+
# @param cache_control [Anthropic::Models::CacheControlEphemeral, nil] Create a cache control breakpoint at this content block.
|
43
|
+
#
|
44
|
+
# @param name [Symbol, :str_replace_based_edit_tool] Name of the tool.
|
45
|
+
#
|
46
|
+
# @param type [Symbol, :text_editor_20250429]
|
47
|
+
end
|
48
|
+
|
16
49
|
# @!method self.variants
|
17
|
-
# @return [Array(Anthropic::Models::Tool, Anthropic::Models::ToolBash20250124, Anthropic::Models::ToolTextEditor20250124, Anthropic::Models::WebSearchTool20250305)]
|
50
|
+
# @return [Array(Anthropic::Models::Tool, Anthropic::Models::ToolBash20250124, Anthropic::Models::ToolTextEditor20250124, Anthropic::Models::ToolUnion::TextEditor20250429, Anthropic::Models::WebSearchTool20250305)]
|
18
51
|
end
|
19
52
|
end
|
20
53
|
end
|
@@ -23,6 +23,12 @@ module Anthropic
|
|
23
23
|
# @return [Symbol, :tool_use]
|
24
24
|
required :type, const: :tool_use
|
25
25
|
|
26
|
+
# @api private
|
27
|
+
#
|
28
|
+
# Internal buffer for accumulating partial JSON during streaming.
|
29
|
+
# Used by streaming helpers to reconstruct complete JSON input from deltas.
|
30
|
+
optional :json_buf, String
|
31
|
+
|
26
32
|
# @!method initialize(id:, input:, name:, type: :tool_use)
|
27
33
|
# @param id [String]
|
28
34
|
# @param input [Object]
|
data/lib/anthropic/models.rb
CHANGED
@@ -11,16 +11,16 @@ module Anthropic
|
|
11
11
|
mod.constants.each do |name|
|
12
12
|
case mod.const_get(name)
|
13
13
|
in true | false
|
14
|
-
mod.define_sorbet_constant!(:TaggedBoolean) { T.type_alias { T
|
14
|
+
mod.define_sorbet_constant!(:TaggedBoolean) { T.type_alias { T::Boolean } }
|
15
15
|
mod.define_sorbet_constant!(:OrBoolean) { T.type_alias { T::Boolean } }
|
16
16
|
in Integer
|
17
|
-
mod.define_sorbet_constant!(:TaggedInteger) { T.type_alias {
|
17
|
+
mod.define_sorbet_constant!(:TaggedInteger) { T.type_alias { Integer } }
|
18
18
|
mod.define_sorbet_constant!(:OrInteger) { T.type_alias { Integer } }
|
19
19
|
in Float
|
20
|
-
mod.define_sorbet_constant!(:TaggedFloat) { T.type_alias {
|
20
|
+
mod.define_sorbet_constant!(:TaggedFloat) { T.type_alias { Float } }
|
21
21
|
mod.define_sorbet_constant!(:OrFloat) { T.type_alias { Float } }
|
22
22
|
in Symbol
|
23
|
-
mod.define_sorbet_constant!(:TaggedSymbol) { T.type_alias {
|
23
|
+
mod.define_sorbet_constant!(:TaggedSymbol) { T.type_alias { Symbol } }
|
24
24
|
mod.define_sorbet_constant!(:OrSymbol) { T.type_alias { T.any(Symbol, String) } }
|
25
25
|
else
|
26
26
|
end
|
@@ -46,7 +46,7 @@ module Anthropic
|
|
46
46
|
#
|
47
47
|
# @param tool_choice [Anthropic::Models::Beta::BetaToolChoiceAuto, Anthropic::Models::Beta::BetaToolChoiceAny, Anthropic::Models::Beta::BetaToolChoiceTool, Anthropic::Models::Beta::BetaToolChoiceNone] Body param: How the model should use the provided tools. The model can use a spe
|
48
48
|
#
|
49
|
-
# @param tools [Array<Anthropic::Models::Beta::BetaTool, Anthropic::Models::Beta::
|
49
|
+
# @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>] Body param: Definitions of tools that the model may use.
|
50
50
|
#
|
51
51
|
# @param top_k [Integer] Body param: Only sample from the top K options for each subsequent token.
|
52
52
|
#
|
@@ -62,7 +62,7 @@ module Anthropic
|
|
62
62
|
def create(params)
|
63
63
|
parsed, options = Anthropic::Beta::MessageCreateParams.dump_request(params)
|
64
64
|
if parsed[:stream]
|
65
|
-
message = "Please use `#
|
65
|
+
message = "Please use `#stream` for the streaming use case."
|
66
66
|
raise ArgumentError.new(message)
|
67
67
|
end
|
68
68
|
|
@@ -90,7 +90,7 @@ module Anthropic
|
|
90
90
|
end
|
91
91
|
|
92
92
|
def stream
|
93
|
-
|
93
|
+
Anthropic::Streaming::MessageStream.new(raw_stream: raw_stream)
|
94
94
|
end
|
95
95
|
|
96
96
|
# See {Anthropic::Resources::Beta::Messages#create} for non-streaming counterpart.
|
@@ -132,7 +132,7 @@ module Anthropic
|
|
132
132
|
#
|
133
133
|
# @param tool_choice [Anthropic::Models::Beta::BetaToolChoiceAuto, Anthropic::Models::Beta::BetaToolChoiceAny, Anthropic::Models::Beta::BetaToolChoiceTool, Anthropic::Models::Beta::BetaToolChoiceNone] Body param: How the model should use the provided tools. The model can use a spe
|
134
134
|
#
|
135
|
-
# @param tools [Array<Anthropic::Models::Beta::BetaTool, Anthropic::Models::Beta::
|
135
|
+
# @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>] Body param: Definitions of tools that the model may use.
|
136
136
|
#
|
137
137
|
# @param top_k [Integer] Body param: Only sample from the top K options for each subsequent token.
|
138
138
|
#
|
@@ -192,7 +192,7 @@ module Anthropic
|
|
192
192
|
#
|
193
193
|
# @param tool_choice [Anthropic::Models::Beta::BetaToolChoiceAuto, Anthropic::Models::Beta::BetaToolChoiceAny, Anthropic::Models::Beta::BetaToolChoiceTool, Anthropic::Models::Beta::BetaToolChoiceNone] Body param: How the model should use the provided tools. The model can use a spe
|
194
194
|
#
|
195
|
-
# @param tools [Array<Anthropic::Models::Beta::BetaTool, Anthropic::Models::Beta::
|
195
|
+
# @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>] Body param: Definitions of tools that the model may use.
|
196
196
|
#
|
197
197
|
# @param betas [Array<String, Symbol, Anthropic::Models::AnthropicBeta>] Header param: Optional header to specify the beta version(s) you want to use.
|
198
198
|
#
|
@@ -6,7 +6,7 @@ module Anthropic
|
|
6
6
|
# @return [Anthropic::Resources::Messages::Batches]
|
7
7
|
attr_reader :batches
|
8
8
|
|
9
|
-
# See {Anthropic::Resources::Messages#
|
9
|
+
# See {Anthropic::Resources::Messages#stream} for streaming counterpart.
|
10
10
|
#
|
11
11
|
# Some parameter documentations has been truncated, see
|
12
12
|
# {Anthropic::Models::MessageCreateParams} for more details.
|
@@ -41,7 +41,7 @@ module Anthropic
|
|
41
41
|
#
|
42
42
|
# @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,
|
43
43
|
#
|
44
|
-
# @param tools [Array<Anthropic::Models::Tool, Anthropic::Models::ToolBash20250124, Anthropic::Models::ToolTextEditor20250124, Anthropic::Models::WebSearchTool20250305>] Definitions of tools that the model may use.
|
44
|
+
# @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.
|
45
45
|
#
|
46
46
|
# @param top_k [Integer] Only sample from the top K options for each subsequent token.
|
47
47
|
#
|
@@ -55,7 +55,7 @@ module Anthropic
|
|
55
55
|
def create(params)
|
56
56
|
parsed, options = Anthropic::MessageCreateParams.dump_request(params)
|
57
57
|
if parsed[:stream]
|
58
|
-
message = "Please use `#
|
58
|
+
message = "Please use `#stream` for the streaming use case."
|
59
59
|
raise ArgumentError.new(message)
|
60
60
|
end
|
61
61
|
|
@@ -80,8 +80,69 @@ module Anthropic
|
|
80
80
|
)
|
81
81
|
end
|
82
82
|
|
83
|
-
|
84
|
-
|
83
|
+
# See {Anthropic::Resources::Messages#create} for non-streaming counterpart.
|
84
|
+
#
|
85
|
+
# Some parameter documentations has been truncated, see
|
86
|
+
# {Anthropic::Models::MessageCreateParams} for more details.
|
87
|
+
#
|
88
|
+
# Send a structured list of input messages with text and/or image content, and the
|
89
|
+
# model will generate the next message in the conversation with streaming.
|
90
|
+
#
|
91
|
+
# The Messages API can be used for either single queries or stateless multi-turn
|
92
|
+
# conversations.
|
93
|
+
#
|
94
|
+
# Learn more about the Messages API in our [user guide](/en/docs/initial-setup)
|
95
|
+
#
|
96
|
+
# @overload stream(max_tokens:, messages:, model:, metadata: nil, service_tier: nil, stop_sequences: nil, system_: nil, temperature: nil, thinking: nil, tool_choice: nil, tools: nil, top_k: nil, top_p: nil, request_options: {})
|
97
|
+
#
|
98
|
+
# @param max_tokens [Integer] The maximum number of tokens to generate before stopping.
|
99
|
+
#
|
100
|
+
# @param messages [Array<Anthropic::Models::MessageParam>] Input messages.
|
101
|
+
#
|
102
|
+
# @param model [Symbol, String, Anthropic::Models::Model] The model that will complete your prompt.\n\nSee [models](https://docs.anthropic
|
103
|
+
#
|
104
|
+
# @param metadata [Anthropic::Models::Metadata] An object describing metadata about the request.
|
105
|
+
#
|
106
|
+
# @param service_tier [Symbol, Anthropic::Models::MessageCreateParams::ServiceTier] Determines whether to use priority capacity (if available) or standard capacity
|
107
|
+
#
|
108
|
+
# @param stop_sequences [Array<String>] Custom text sequences that will cause the model to stop generating.
|
109
|
+
#
|
110
|
+
# @param system_ [String, Array<Anthropic::Models::TextBlockParam>] System prompt.
|
111
|
+
#
|
112
|
+
# @param temperature [Float] Amount of randomness injected into the response.
|
113
|
+
#
|
114
|
+
# @param thinking [Anthropic::Models::ThinkingConfigEnabled, Anthropic::Models::ThinkingConfigDisabled] Configuration for enabling Claude's extended thinking.
|
115
|
+
#
|
116
|
+
# @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,
|
117
|
+
#
|
118
|
+
# @param tools [Array<Anthropic::Models::Tool, Anthropic::Models::ToolBash20250124, Anthropic::Models::ToolTextEditor20250124, Anthropic::Models::WebSearchTool20250305>] Definitions of tools that the model may use.
|
119
|
+
#
|
120
|
+
# @param top_k [Integer] Only sample from the top K options for each subsequent token.
|
121
|
+
#
|
122
|
+
# @param top_p [Float] Use nucleus sampling.
|
123
|
+
#
|
124
|
+
# @param request_options [Anthropic::RequestOptions, Hash{Symbol=>Object}, nil]
|
125
|
+
#
|
126
|
+
# @return [Anthropic::Streaming::MessageStream]
|
127
|
+
#
|
128
|
+
# @see Anthropic::Models::MessageCreateParams
|
129
|
+
def stream(params)
|
130
|
+
parsed, options = Anthropic::Models::MessageCreateParams.dump_request(params)
|
131
|
+
unless parsed.fetch(:stream, true)
|
132
|
+
message = "Please use `#create` for the non-streaming use case."
|
133
|
+
raise ArgumentError.new(message)
|
134
|
+
end
|
135
|
+
parsed.store(:stream, true)
|
136
|
+
raw_stream = @client.request(
|
137
|
+
method: :post,
|
138
|
+
path: "v1/messages",
|
139
|
+
headers: {"accept" => "text/event-stream"},
|
140
|
+
body: parsed,
|
141
|
+
stream: Anthropic::Internal::Stream,
|
142
|
+
model: Anthropic::Models::RawMessageStreamEvent,
|
143
|
+
options: options
|
144
|
+
)
|
145
|
+
Anthropic::Streaming::MessageStream.new(raw_stream: raw_stream)
|
85
146
|
end
|
86
147
|
|
87
148
|
# See {Anthropic::Resources::Messages#create} for non-streaming counterpart.
|
@@ -119,7 +180,7 @@ module Anthropic
|
|
119
180
|
#
|
120
181
|
# @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,
|
121
182
|
#
|
122
|
-
# @param tools [Array<Anthropic::Models::Tool, Anthropic::Models::ToolBash20250124, Anthropic::Models::ToolTextEditor20250124, Anthropic::Models::WebSearchTool20250305>] Definitions of tools that the model may use.
|
183
|
+
# @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.
|
123
184
|
#
|
124
185
|
# @param top_k [Integer] Only sample from the top K options for each subsequent token.
|
125
186
|
#
|
@@ -171,7 +232,7 @@ module Anthropic
|
|
171
232
|
#
|
172
233
|
# @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,
|
173
234
|
#
|
174
|
-
# @param tools [Array<Anthropic::Models::Tool, Anthropic::Models::ToolBash20250124, Anthropic::Models::ToolTextEditor20250124, Anthropic::Models::WebSearchTool20250305>] Definitions of tools that the model may use.
|
235
|
+
# @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.
|
175
236
|
#
|
176
237
|
# @param request_options [Anthropic::RequestOptions, Hash{Symbol=>Object}, nil]
|
177
238
|
#
|
data/lib/anthropic/version.rb
CHANGED
data/lib/anthropic.rb
CHANGED
@@ -20,7 +20,9 @@ require "uri"
|
|
20
20
|
|
21
21
|
# We already ship the preferred sorbet manifests in the package itself.
|
22
22
|
# `tapioca` currently does not offer us a way to opt out of unnecessary compilation.
|
23
|
-
if Object.const_defined?(:Tapioca) &&
|
23
|
+
if Object.const_defined?(:Tapioca) &&
|
24
|
+
caller.chain([$PROGRAM_NAME]).chain(ARGV).any?(/tapioca/) &&
|
25
|
+
ARGV.none?(/dsl/)
|
24
26
|
return
|
25
27
|
end
|
26
28
|
|
@@ -56,6 +58,7 @@ require_relative "anthropic/vertex"
|
|
56
58
|
require_relative "anthropic/internal/stream"
|
57
59
|
require_relative "anthropic/internal/jsonl_stream"
|
58
60
|
require_relative "anthropic/internal/page"
|
61
|
+
require_relative "anthropic/models/beta/beta_request_document_block"
|
59
62
|
require_relative "anthropic/models/anthropic_beta"
|
60
63
|
require_relative "anthropic/models/api_error_object"
|
61
64
|
require_relative "anthropic/models/authentication_error"
|
@@ -74,6 +77,8 @@ require_relative "anthropic/models/beta/beta_citation_page_location"
|
|
74
77
|
require_relative "anthropic/models/beta/beta_citation_page_location_param"
|
75
78
|
require_relative "anthropic/models/beta/beta_citations_config_param"
|
76
79
|
require_relative "anthropic/models/beta/beta_citations_delta"
|
80
|
+
require_relative "anthropic/models/beta/beta_citation_search_result_location"
|
81
|
+
require_relative "anthropic/models/beta/beta_citation_search_result_location_param"
|
77
82
|
require_relative "anthropic/models/beta/beta_citations_web_search_result_location"
|
78
83
|
require_relative "anthropic/models/beta/beta_citation_web_search_result_location_param"
|
79
84
|
require_relative "anthropic/models/beta/beta_code_execution_output_block"
|
@@ -122,6 +127,7 @@ require_relative "anthropic/models/beta/beta_redacted_thinking_block_param"
|
|
122
127
|
require_relative "anthropic/models/beta/beta_request_mcp_server_tool_configuration"
|
123
128
|
require_relative "anthropic/models/beta/beta_request_mcp_server_url_definition"
|
124
129
|
require_relative "anthropic/models/beta/beta_request_mcp_tool_result_block_param"
|
130
|
+
require_relative "anthropic/models/beta/beta_search_result_block_param"
|
125
131
|
require_relative "anthropic/models/beta/beta_server_tool_usage"
|
126
132
|
require_relative "anthropic/models/beta/beta_server_tool_use_block"
|
127
133
|
require_relative "anthropic/models/beta/beta_server_tool_use_block_param"
|
@@ -312,6 +318,10 @@ require_relative "anthropic/models/web_search_tool_result_block_content"
|
|
312
318
|
require_relative "anthropic/models/web_search_tool_result_block_param"
|
313
319
|
require_relative "anthropic/models/web_search_tool_result_block_param_content"
|
314
320
|
require_relative "anthropic/models/web_search_tool_result_error"
|
321
|
+
require_relative "anthropic/helpers/streaming/events"
|
322
|
+
require_relative "anthropic/helpers/streaming/message_stream"
|
323
|
+
require_relative "anthropic/helpers/streaming"
|
324
|
+
require_relative "anthropic/streaming"
|
315
325
|
require_relative "anthropic/models"
|
316
326
|
require_relative "anthropic/resources/beta"
|
317
327
|
require_relative "anthropic/resources/beta/files"
|
data/rbi/anthropic/errors.rbi
CHANGED
@@ -8,6 +8,22 @@ module Anthropic
|
|
8
8
|
end
|
9
9
|
|
10
10
|
class ConversionError < Anthropic::Errors::Error
|
11
|
+
sig { returns(T.nilable(StandardError)) }
|
12
|
+
def cause
|
13
|
+
end
|
14
|
+
|
15
|
+
# @api private
|
16
|
+
sig do
|
17
|
+
params(
|
18
|
+
on: T::Class[StandardError],
|
19
|
+
method: Symbol,
|
20
|
+
target: T.anything,
|
21
|
+
value: T.anything,
|
22
|
+
cause: T.nilable(StandardError)
|
23
|
+
).returns(T.attached_class)
|
24
|
+
end
|
25
|
+
def self.new(on:, method:, target:, value:, cause: nil)
|
26
|
+
end
|
11
27
|
end
|
12
28
|
|
13
29
|
class APIError < Anthropic::Errors::Error
|
@@ -0,0 +1,85 @@
|
|
1
|
+
# typed: strong
|
2
|
+
# frozen_string_literal: true
|
3
|
+
# typed: true
|
4
|
+
|
5
|
+
module Anthropic
|
6
|
+
module Helpers
|
7
|
+
module Streaming
|
8
|
+
class TextEvent < Anthropic::Internal::Type::BaseModel
|
9
|
+
sig { returns(Symbol) }
|
10
|
+
attr_accessor :type
|
11
|
+
|
12
|
+
sig { returns(String) }
|
13
|
+
attr_accessor :text
|
14
|
+
|
15
|
+
sig { returns(String) }
|
16
|
+
attr_accessor :snapshot
|
17
|
+
end
|
18
|
+
|
19
|
+
class CitationEvent < Anthropic::Internal::Type::BaseModel
|
20
|
+
sig { returns(Symbol) }
|
21
|
+
attr_accessor :type
|
22
|
+
|
23
|
+
sig { returns(Anthropic::CitationsDelta::Citation::Variants) }
|
24
|
+
attr_accessor :citation
|
25
|
+
|
26
|
+
sig { returns(T::Array[Anthropic::CitationsDelta::Citation::Variants]) }
|
27
|
+
attr_accessor :snapshot
|
28
|
+
end
|
29
|
+
|
30
|
+
class ThinkingEvent < Anthropic::Internal::Type::BaseModel
|
31
|
+
sig { returns(Symbol) }
|
32
|
+
attr_accessor :type
|
33
|
+
|
34
|
+
sig { returns(String) }
|
35
|
+
attr_accessor :thinking
|
36
|
+
|
37
|
+
sig { returns(String) }
|
38
|
+
attr_accessor :snapshot
|
39
|
+
end
|
40
|
+
|
41
|
+
class SignatureEvent < Anthropic::Internal::Type::BaseModel
|
42
|
+
sig { returns(Symbol) }
|
43
|
+
attr_accessor :type
|
44
|
+
|
45
|
+
sig { returns(String) }
|
46
|
+
attr_accessor :signature
|
47
|
+
end
|
48
|
+
|
49
|
+
class InputJsonEvent < Anthropic::Internal::Type::BaseModel
|
50
|
+
sig { returns(Symbol) }
|
51
|
+
attr_accessor :type
|
52
|
+
|
53
|
+
sig { returns(String) }
|
54
|
+
attr_accessor :partial_json
|
55
|
+
|
56
|
+
sig { returns(T.untyped) }
|
57
|
+
attr_accessor :snapshot
|
58
|
+
end
|
59
|
+
|
60
|
+
class MessageStopEvent < Anthropic::Models::RawMessageStopEvent
|
61
|
+
sig { returns(Anthropic::Models::Message) }
|
62
|
+
attr_accessor :message
|
63
|
+
|
64
|
+
sig { params(message: Anthropic::Models::Message, type: Symbol).returns(T.attached_class) }
|
65
|
+
def self.new(message:, type: :message_stop)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
class ContentBlockStopEvent < Anthropic::Models::RawContentBlockStopEvent
|
70
|
+
sig { returns(Integer) }
|
71
|
+
attr_accessor :index
|
72
|
+
|
73
|
+
sig { returns(Symbol) }
|
74
|
+
attr_accessor :type
|
75
|
+
|
76
|
+
sig { returns(Anthropic::Models::ContentBlock) }
|
77
|
+
attr_accessor :content_block
|
78
|
+
|
79
|
+
sig { params(index: Integer, content_block: Anthropic::Models::ContentBlock, type: Symbol).returns(T.attached_class) }
|
80
|
+
def self.new(index:, content_block:, type: :content_block_stop)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|