anthropic 1.1.1 → 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 +45 -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 +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 +8 -0
- 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
@@ -101,7 +101,7 @@ module Anthropic
|
|
101
101
|
# the top-level `system` parameter — there is no `"system"` role for input
|
102
102
|
# messages in the Messages API.
|
103
103
|
#
|
104
|
-
# There is a limit of
|
104
|
+
# There is a limit of 100,000 messages in a single request.
|
105
105
|
sig { returns(T::Array[Anthropic::MessageParam]) }
|
106
106
|
attr_accessor :messages
|
107
107
|
|
@@ -198,6 +198,12 @@ module Anthropic
|
|
198
198
|
# those tools using the tool input generated by the model and then optionally
|
199
199
|
# return results back to the model using `tool_result` content blocks.
|
200
200
|
#
|
201
|
+
# There are two types of tools: **client tools** and **server tools**. The
|
202
|
+
# behavior described below applies to client tools. For
|
203
|
+
# [server tools](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/overview#server-tools),
|
204
|
+
# see their individual documentation as each has its own behavior (e.g., the
|
205
|
+
# [web search tool](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/web-search-tool)).
|
206
|
+
#
|
201
207
|
# Each tool definition includes:
|
202
208
|
#
|
203
209
|
# - `name`: Name of the tool.
|
@@ -268,6 +274,7 @@ module Anthropic
|
|
268
274
|
Anthropic::Tool,
|
269
275
|
Anthropic::ToolBash20250124,
|
270
276
|
Anthropic::ToolTextEditor20250124,
|
277
|
+
Anthropic::MessageCountTokensTool::TextEditor20250429,
|
271
278
|
Anthropic::WebSearchTool20250305
|
272
279
|
)
|
273
280
|
]
|
@@ -284,6 +291,7 @@ module Anthropic
|
|
284
291
|
Anthropic::Tool::OrHash,
|
285
292
|
Anthropic::ToolBash20250124::OrHash,
|
286
293
|
Anthropic::ToolTextEditor20250124::OrHash,
|
294
|
+
Anthropic::MessageCountTokensTool::TextEditor20250429::OrHash,
|
287
295
|
Anthropic::WebSearchTool20250305::OrHash
|
288
296
|
)
|
289
297
|
]
|
@@ -314,6 +322,7 @@ module Anthropic
|
|
314
322
|
Anthropic::Tool::OrHash,
|
315
323
|
Anthropic::ToolBash20250124::OrHash,
|
316
324
|
Anthropic::ToolTextEditor20250124::OrHash,
|
325
|
+
Anthropic::MessageCountTokensTool::TextEditor20250429::OrHash,
|
317
326
|
Anthropic::WebSearchTool20250305::OrHash
|
318
327
|
)
|
319
328
|
],
|
@@ -408,7 +417,7 @@ module Anthropic
|
|
408
417
|
# the top-level `system` parameter — there is no `"system"` role for input
|
409
418
|
# messages in the Messages API.
|
410
419
|
#
|
411
|
-
# There is a limit of
|
420
|
+
# There is a limit of 100,000 messages in a single request.
|
412
421
|
messages:,
|
413
422
|
# The model that will complete your prompt.\n\nSee
|
414
423
|
# [models](https://docs.anthropic.com/en/docs/models-overview) for additional
|
@@ -440,6 +449,12 @@ module Anthropic
|
|
440
449
|
# those tools using the tool input generated by the model and then optionally
|
441
450
|
# return results back to the model using `tool_result` content blocks.
|
442
451
|
#
|
452
|
+
# There are two types of tools: **client tools** and **server tools**. The
|
453
|
+
# behavior described below applies to client tools. For
|
454
|
+
# [server tools](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/overview#server-tools),
|
455
|
+
# see their individual documentation as each has its own behavior (e.g., the
|
456
|
+
# [web search tool](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/web-search-tool)).
|
457
|
+
#
|
443
458
|
# Each tool definition includes:
|
444
459
|
#
|
445
460
|
# - `name`: Name of the tool.
|
@@ -531,6 +546,7 @@ module Anthropic
|
|
531
546
|
Anthropic::Tool,
|
532
547
|
Anthropic::ToolBash20250124,
|
533
548
|
Anthropic::ToolTextEditor20250124,
|
549
|
+
Anthropic::MessageCountTokensTool::TextEditor20250429,
|
534
550
|
Anthropic::WebSearchTool20250305
|
535
551
|
)
|
536
552
|
],
|
@@ -11,10 +11,71 @@ module Anthropic
|
|
11
11
|
Anthropic::Tool,
|
12
12
|
Anthropic::ToolBash20250124,
|
13
13
|
Anthropic::ToolTextEditor20250124,
|
14
|
+
Anthropic::MessageCountTokensTool::TextEditor20250429,
|
14
15
|
Anthropic::WebSearchTool20250305
|
15
16
|
)
|
16
17
|
end
|
17
18
|
|
19
|
+
class TextEditor20250429 < Anthropic::Internal::Type::BaseModel
|
20
|
+
OrHash =
|
21
|
+
T.type_alias do
|
22
|
+
T.any(
|
23
|
+
Anthropic::MessageCountTokensTool::TextEditor20250429,
|
24
|
+
Anthropic::Internal::AnyHash
|
25
|
+
)
|
26
|
+
end
|
27
|
+
|
28
|
+
# Name of the tool.
|
29
|
+
#
|
30
|
+
# This is how the tool will be called by the model and in `tool_use` blocks.
|
31
|
+
sig { returns(Symbol) }
|
32
|
+
attr_accessor :name
|
33
|
+
|
34
|
+
sig { returns(Symbol) }
|
35
|
+
attr_accessor :type
|
36
|
+
|
37
|
+
# Create a cache control breakpoint at this content block.
|
38
|
+
sig { returns(T.nilable(Anthropic::CacheControlEphemeral)) }
|
39
|
+
attr_reader :cache_control
|
40
|
+
|
41
|
+
sig do
|
42
|
+
params(
|
43
|
+
cache_control: T.nilable(Anthropic::CacheControlEphemeral::OrHash)
|
44
|
+
).void
|
45
|
+
end
|
46
|
+
attr_writer :cache_control
|
47
|
+
|
48
|
+
sig do
|
49
|
+
params(
|
50
|
+
cache_control: T.nilable(Anthropic::CacheControlEphemeral::OrHash),
|
51
|
+
name: Symbol,
|
52
|
+
type: Symbol
|
53
|
+
).returns(T.attached_class)
|
54
|
+
end
|
55
|
+
def self.new(
|
56
|
+
# Create a cache control breakpoint at this content block.
|
57
|
+
cache_control: nil,
|
58
|
+
# Name of the tool.
|
59
|
+
#
|
60
|
+
# This is how the tool will be called by the model and in `tool_use` blocks.
|
61
|
+
name: :str_replace_based_edit_tool,
|
62
|
+
type: :text_editor_20250429
|
63
|
+
)
|
64
|
+
end
|
65
|
+
|
66
|
+
sig do
|
67
|
+
override.returns(
|
68
|
+
{
|
69
|
+
name: Symbol,
|
70
|
+
type: Symbol,
|
71
|
+
cache_control: T.nilable(Anthropic::CacheControlEphemeral)
|
72
|
+
}
|
73
|
+
)
|
74
|
+
end
|
75
|
+
def to_hash
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
18
79
|
sig do
|
19
80
|
override.returns(T::Array[Anthropic::MessageCountTokensTool::Variants])
|
20
81
|
end
|
@@ -108,7 +108,7 @@ module Anthropic
|
|
108
108
|
# the top-level `system` parameter — there is no `"system"` role for input
|
109
109
|
# messages in the Messages API.
|
110
110
|
#
|
111
|
-
# There is a limit of
|
111
|
+
# There is a limit of 100,000 messages in a single request.
|
112
112
|
sig { returns(T::Array[Anthropic::MessageParam]) }
|
113
113
|
attr_accessor :messages
|
114
114
|
|
@@ -256,6 +256,12 @@ module Anthropic
|
|
256
256
|
# those tools using the tool input generated by the model and then optionally
|
257
257
|
# return results back to the model using `tool_result` content blocks.
|
258
258
|
#
|
259
|
+
# There are two types of tools: **client tools** and **server tools**. The
|
260
|
+
# behavior described below applies to client tools. For
|
261
|
+
# [server tools](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/overview#server-tools),
|
262
|
+
# see their individual documentation as each has its own behavior (e.g., the
|
263
|
+
# [web search tool](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/web-search-tool)).
|
264
|
+
#
|
259
265
|
# Each tool definition includes:
|
260
266
|
#
|
261
267
|
# - `name`: Name of the tool.
|
@@ -326,6 +332,7 @@ module Anthropic
|
|
326
332
|
Anthropic::Tool,
|
327
333
|
Anthropic::ToolBash20250124,
|
328
334
|
Anthropic::ToolTextEditor20250124,
|
335
|
+
Anthropic::ToolUnion::TextEditor20250429,
|
329
336
|
Anthropic::WebSearchTool20250305
|
330
337
|
)
|
331
338
|
]
|
@@ -342,6 +349,7 @@ module Anthropic
|
|
342
349
|
Anthropic::Tool::OrHash,
|
343
350
|
Anthropic::ToolBash20250124::OrHash,
|
344
351
|
Anthropic::ToolTextEditor20250124::OrHash,
|
352
|
+
Anthropic::ToolUnion::TextEditor20250429::OrHash,
|
345
353
|
Anthropic::WebSearchTool20250305::OrHash
|
346
354
|
)
|
347
355
|
]
|
@@ -405,6 +413,7 @@ module Anthropic
|
|
405
413
|
Anthropic::Tool::OrHash,
|
406
414
|
Anthropic::ToolBash20250124::OrHash,
|
407
415
|
Anthropic::ToolTextEditor20250124::OrHash,
|
416
|
+
Anthropic::ToolUnion::TextEditor20250429::OrHash,
|
408
417
|
Anthropic::WebSearchTool20250305::OrHash
|
409
418
|
)
|
410
419
|
],
|
@@ -509,7 +518,7 @@ module Anthropic
|
|
509
518
|
# the top-level `system` parameter — there is no `"system"` role for input
|
510
519
|
# messages in the Messages API.
|
511
520
|
#
|
512
|
-
# There is a limit of
|
521
|
+
# There is a limit of 100,000 messages in a single request.
|
513
522
|
messages:,
|
514
523
|
# The model that will complete your prompt.\n\nSee
|
515
524
|
# [models](https://docs.anthropic.com/en/docs/models-overview) for additional
|
@@ -568,6 +577,12 @@ module Anthropic
|
|
568
577
|
# those tools using the tool input generated by the model and then optionally
|
569
578
|
# return results back to the model using `tool_result` content blocks.
|
570
579
|
#
|
580
|
+
# There are two types of tools: **client tools** and **server tools**. The
|
581
|
+
# behavior described below applies to client tools. For
|
582
|
+
# [server tools](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/overview#server-tools),
|
583
|
+
# see their individual documentation as each has its own behavior (e.g., the
|
584
|
+
# [web search tool](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/web-search-tool)).
|
585
|
+
#
|
571
586
|
# Each tool definition includes:
|
572
587
|
#
|
573
588
|
# - `name`: Name of the tool.
|
@@ -682,6 +697,7 @@ module Anthropic
|
|
682
697
|
Anthropic::Tool,
|
683
698
|
Anthropic::ToolBash20250124,
|
684
699
|
Anthropic::ToolTextEditor20250124,
|
700
|
+
Anthropic::ToolUnion::TextEditor20250429,
|
685
701
|
Anthropic::WebSearchTool20250305
|
686
702
|
)
|
687
703
|
],
|
@@ -220,7 +220,7 @@ module Anthropic
|
|
220
220
|
# the top-level `system` parameter — there is no `"system"` role for input
|
221
221
|
# messages in the Messages API.
|
222
222
|
#
|
223
|
-
# There is a limit of
|
223
|
+
# There is a limit of 100,000 messages in a single request.
|
224
224
|
sig { returns(T::Array[Anthropic::MessageParam]) }
|
225
225
|
attr_accessor :messages
|
226
226
|
|
@@ -388,6 +388,12 @@ module Anthropic
|
|
388
388
|
# those tools using the tool input generated by the model and then optionally
|
389
389
|
# return results back to the model using `tool_result` content blocks.
|
390
390
|
#
|
391
|
+
# There are two types of tools: **client tools** and **server tools**. The
|
392
|
+
# behavior described below applies to client tools. For
|
393
|
+
# [server tools](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/overview#server-tools),
|
394
|
+
# see their individual documentation as each has its own behavior (e.g., the
|
395
|
+
# [web search tool](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/web-search-tool)).
|
396
|
+
#
|
391
397
|
# Each tool definition includes:
|
392
398
|
#
|
393
399
|
# - `name`: Name of the tool.
|
@@ -458,6 +464,7 @@ module Anthropic
|
|
458
464
|
Anthropic::Tool,
|
459
465
|
Anthropic::ToolBash20250124,
|
460
466
|
Anthropic::ToolTextEditor20250124,
|
467
|
+
Anthropic::ToolUnion::TextEditor20250429,
|
461
468
|
Anthropic::WebSearchTool20250305
|
462
469
|
)
|
463
470
|
]
|
@@ -474,6 +481,7 @@ module Anthropic
|
|
474
481
|
Anthropic::Tool::OrHash,
|
475
482
|
Anthropic::ToolBash20250124::OrHash,
|
476
483
|
Anthropic::ToolTextEditor20250124::OrHash,
|
484
|
+
Anthropic::ToolUnion::TextEditor20250429::OrHash,
|
477
485
|
Anthropic::WebSearchTool20250305::OrHash
|
478
486
|
)
|
479
487
|
]
|
@@ -544,6 +552,7 @@ module Anthropic
|
|
544
552
|
Anthropic::Tool::OrHash,
|
545
553
|
Anthropic::ToolBash20250124::OrHash,
|
546
554
|
Anthropic::ToolTextEditor20250124::OrHash,
|
555
|
+
Anthropic::ToolUnion::TextEditor20250429::OrHash,
|
547
556
|
Anthropic::WebSearchTool20250305::OrHash
|
548
557
|
)
|
549
558
|
],
|
@@ -647,7 +656,7 @@ module Anthropic
|
|
647
656
|
# the top-level `system` parameter — there is no `"system"` role for input
|
648
657
|
# messages in the Messages API.
|
649
658
|
#
|
650
|
-
# There is a limit of
|
659
|
+
# There is a limit of 100,000 messages in a single request.
|
651
660
|
messages:,
|
652
661
|
# The model that will complete your prompt.\n\nSee
|
653
662
|
# [models](https://docs.anthropic.com/en/docs/models-overview) for additional
|
@@ -711,6 +720,12 @@ module Anthropic
|
|
711
720
|
# those tools using the tool input generated by the model and then optionally
|
712
721
|
# return results back to the model using `tool_result` content blocks.
|
713
722
|
#
|
723
|
+
# There are two types of tools: **client tools** and **server tools**. The
|
724
|
+
# behavior described below applies to client tools. For
|
725
|
+
# [server tools](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/overview#server-tools),
|
726
|
+
# see their individual documentation as each has its own behavior (e.g., the
|
727
|
+
# [web search tool](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/web-search-tool)).
|
728
|
+
#
|
714
729
|
# Each tool definition includes:
|
715
730
|
#
|
716
731
|
# - `name`: Name of the tool.
|
@@ -827,6 +842,7 @@ module Anthropic
|
|
827
842
|
Anthropic::Tool,
|
828
843
|
Anthropic::ToolBash20250124,
|
829
844
|
Anthropic::ToolTextEditor20250124,
|
845
|
+
Anthropic::ToolUnion::TextEditor20250429,
|
830
846
|
Anthropic::WebSearchTool20250305
|
831
847
|
)
|
832
848
|
],
|
@@ -27,11 +27,11 @@ module Anthropic
|
|
27
27
|
content_block:
|
28
28
|
T.any(
|
29
29
|
Anthropic::TextBlock::OrHash,
|
30
|
+
Anthropic::ThinkingBlock::OrHash,
|
31
|
+
Anthropic::RedactedThinkingBlock::OrHash,
|
30
32
|
Anthropic::ToolUseBlock::OrHash,
|
31
33
|
Anthropic::ServerToolUseBlock::OrHash,
|
32
|
-
Anthropic::WebSearchToolResultBlock::OrHash
|
33
|
-
Anthropic::ThinkingBlock::OrHash,
|
34
|
-
Anthropic::RedactedThinkingBlock::OrHash
|
34
|
+
Anthropic::WebSearchToolResultBlock::OrHash
|
35
35
|
),
|
36
36
|
index: Integer,
|
37
37
|
type: Symbol
|
@@ -60,11 +60,11 @@ module Anthropic
|
|
60
60
|
T.type_alias do
|
61
61
|
T.any(
|
62
62
|
Anthropic::TextBlock,
|
63
|
+
Anthropic::ThinkingBlock,
|
64
|
+
Anthropic::RedactedThinkingBlock,
|
63
65
|
Anthropic::ToolUseBlock,
|
64
66
|
Anthropic::ServerToolUseBlock,
|
65
|
-
Anthropic::WebSearchToolResultBlock
|
66
|
-
Anthropic::ThinkingBlock,
|
67
|
-
Anthropic::RedactedThinkingBlock
|
67
|
+
Anthropic::WebSearchToolResultBlock
|
68
68
|
)
|
69
69
|
end
|
70
70
|
|
@@ -106,20 +106,31 @@ module Anthropic
|
|
106
106
|
sig { returns(T.nilable(T.anything)) }
|
107
107
|
attr_accessor :properties
|
108
108
|
|
109
|
+
sig { returns(T.nilable(T::Array[String])) }
|
110
|
+
attr_accessor :required
|
111
|
+
|
109
112
|
# [JSON schema](https://json-schema.org/draft/2020-12) for this tool's input.
|
110
113
|
#
|
111
114
|
# This defines the shape of the `input` that your tool accepts and that the model
|
112
115
|
# will produce.
|
113
116
|
sig do
|
114
|
-
params(
|
115
|
-
T.
|
116
|
-
|
117
|
+
params(
|
118
|
+
properties: T.nilable(T.anything),
|
119
|
+
required: T.nilable(T::Array[String]),
|
120
|
+
type: Symbol
|
121
|
+
).returns(T.attached_class)
|
117
122
|
end
|
118
|
-
def self.new(properties: nil, type: :object)
|
123
|
+
def self.new(properties: nil, required: nil, type: :object)
|
119
124
|
end
|
120
125
|
|
121
126
|
sig do
|
122
|
-
override.returns(
|
127
|
+
override.returns(
|
128
|
+
{
|
129
|
+
type: Symbol,
|
130
|
+
properties: T.nilable(T.anything),
|
131
|
+
required: T.nilable(T::Array[String])
|
132
|
+
}
|
133
|
+
)
|
123
134
|
end
|
124
135
|
def to_hash
|
125
136
|
end
|
@@ -11,10 +11,71 @@ module Anthropic
|
|
11
11
|
Anthropic::Tool,
|
12
12
|
Anthropic::ToolBash20250124,
|
13
13
|
Anthropic::ToolTextEditor20250124,
|
14
|
+
Anthropic::ToolUnion::TextEditor20250429,
|
14
15
|
Anthropic::WebSearchTool20250305
|
15
16
|
)
|
16
17
|
end
|
17
18
|
|
19
|
+
class TextEditor20250429 < Anthropic::Internal::Type::BaseModel
|
20
|
+
OrHash =
|
21
|
+
T.type_alias do
|
22
|
+
T.any(
|
23
|
+
Anthropic::ToolUnion::TextEditor20250429,
|
24
|
+
Anthropic::Internal::AnyHash
|
25
|
+
)
|
26
|
+
end
|
27
|
+
|
28
|
+
# Name of the tool.
|
29
|
+
#
|
30
|
+
# This is how the tool will be called by the model and in `tool_use` blocks.
|
31
|
+
sig { returns(Symbol) }
|
32
|
+
attr_accessor :name
|
33
|
+
|
34
|
+
sig { returns(Symbol) }
|
35
|
+
attr_accessor :type
|
36
|
+
|
37
|
+
# Create a cache control breakpoint at this content block.
|
38
|
+
sig { returns(T.nilable(Anthropic::CacheControlEphemeral)) }
|
39
|
+
attr_reader :cache_control
|
40
|
+
|
41
|
+
sig do
|
42
|
+
params(
|
43
|
+
cache_control: T.nilable(Anthropic::CacheControlEphemeral::OrHash)
|
44
|
+
).void
|
45
|
+
end
|
46
|
+
attr_writer :cache_control
|
47
|
+
|
48
|
+
sig do
|
49
|
+
params(
|
50
|
+
cache_control: T.nilable(Anthropic::CacheControlEphemeral::OrHash),
|
51
|
+
name: Symbol,
|
52
|
+
type: Symbol
|
53
|
+
).returns(T.attached_class)
|
54
|
+
end
|
55
|
+
def self.new(
|
56
|
+
# Create a cache control breakpoint at this content block.
|
57
|
+
cache_control: nil,
|
58
|
+
# Name of the tool.
|
59
|
+
#
|
60
|
+
# This is how the tool will be called by the model and in `tool_use` blocks.
|
61
|
+
name: :str_replace_based_edit_tool,
|
62
|
+
type: :text_editor_20250429
|
63
|
+
)
|
64
|
+
end
|
65
|
+
|
66
|
+
sig do
|
67
|
+
override.returns(
|
68
|
+
{
|
69
|
+
name: Symbol,
|
70
|
+
type: Symbol,
|
71
|
+
cache_control: T.nilable(Anthropic::CacheControlEphemeral)
|
72
|
+
}
|
73
|
+
)
|
74
|
+
end
|
75
|
+
def to_hash
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
18
79
|
sig { override.returns(T::Array[Anthropic::ToolUnion::Variants]) }
|
19
80
|
def self.variants
|
20
81
|
end
|
@@ -48,15 +48,15 @@ module Anthropic
|
|
48
48
|
T::Array[
|
49
49
|
T.any(
|
50
50
|
Anthropic::Beta::BetaTool::OrHash,
|
51
|
-
Anthropic::Beta::BetaToolComputerUse20241022::OrHash,
|
52
51
|
Anthropic::Beta::BetaToolBash20241022::OrHash,
|
53
|
-
Anthropic::Beta::BetaToolTextEditor20241022::OrHash,
|
54
|
-
Anthropic::Beta::BetaToolComputerUse20250124::OrHash,
|
55
52
|
Anthropic::Beta::BetaToolBash20250124::OrHash,
|
53
|
+
Anthropic::Beta::BetaCodeExecutionTool20250522::OrHash,
|
54
|
+
Anthropic::Beta::BetaToolComputerUse20241022::OrHash,
|
55
|
+
Anthropic::Beta::BetaToolComputerUse20250124::OrHash,
|
56
|
+
Anthropic::Beta::BetaToolTextEditor20241022::OrHash,
|
56
57
|
Anthropic::Beta::BetaToolTextEditor20250124::OrHash,
|
57
58
|
Anthropic::Beta::BetaToolTextEditor20250429::OrHash,
|
58
|
-
Anthropic::Beta::BetaWebSearchTool20250305::OrHash
|
59
|
-
Anthropic::Beta::BetaCodeExecutionTool20250522::OrHash
|
59
|
+
Anthropic::Beta::BetaWebSearchTool20250305::OrHash
|
60
60
|
)
|
61
61
|
],
|
62
62
|
top_k: Integer,
|
@@ -162,7 +162,7 @@ module Anthropic
|
|
162
162
|
# the top-level `system` parameter — there is no `"system"` role for input
|
163
163
|
# messages in the Messages API.
|
164
164
|
#
|
165
|
-
# There is a limit of
|
165
|
+
# There is a limit of 100,000 messages in a single request.
|
166
166
|
messages:,
|
167
167
|
# Body param: The model that will complete your prompt.\n\nSee
|
168
168
|
# [models](https://docs.anthropic.com/en/docs/models-overview) for additional
|
@@ -225,6 +225,12 @@ module Anthropic
|
|
225
225
|
# those tools using the tool input generated by the model and then optionally
|
226
226
|
# return results back to the model using `tool_result` content blocks.
|
227
227
|
#
|
228
|
+
# There are two types of tools: **client tools** and **server tools**. The
|
229
|
+
# behavior described below applies to client tools. For
|
230
|
+
# [server tools](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/overview#server-tools),
|
231
|
+
# see their individual documentation as each has its own behavior (e.g., the
|
232
|
+
# [web search tool](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/web-search-tool)).
|
233
|
+
#
|
228
234
|
# Each tool definition includes:
|
229
235
|
#
|
230
236
|
# - `name`: Name of the tool.
|
@@ -356,15 +362,15 @@ module Anthropic
|
|
356
362
|
T::Array[
|
357
363
|
T.any(
|
358
364
|
Anthropic::Beta::BetaTool::OrHash,
|
359
|
-
Anthropic::Beta::BetaToolComputerUse20241022::OrHash,
|
360
365
|
Anthropic::Beta::BetaToolBash20241022::OrHash,
|
361
|
-
Anthropic::Beta::BetaToolTextEditor20241022::OrHash,
|
362
|
-
Anthropic::Beta::BetaToolComputerUse20250124::OrHash,
|
363
366
|
Anthropic::Beta::BetaToolBash20250124::OrHash,
|
367
|
+
Anthropic::Beta::BetaCodeExecutionTool20250522::OrHash,
|
368
|
+
Anthropic::Beta::BetaToolComputerUse20241022::OrHash,
|
369
|
+
Anthropic::Beta::BetaToolComputerUse20250124::OrHash,
|
370
|
+
Anthropic::Beta::BetaToolTextEditor20241022::OrHash,
|
364
371
|
Anthropic::Beta::BetaToolTextEditor20250124::OrHash,
|
365
372
|
Anthropic::Beta::BetaToolTextEditor20250429::OrHash,
|
366
|
-
Anthropic::Beta::BetaWebSearchTool20250305::OrHash
|
367
|
-
Anthropic::Beta::BetaCodeExecutionTool20250522::OrHash
|
373
|
+
Anthropic::Beta::BetaWebSearchTool20250305::OrHash
|
368
374
|
)
|
369
375
|
],
|
370
376
|
top_k: Integer,
|
@@ -474,7 +480,7 @@ module Anthropic
|
|
474
480
|
# the top-level `system` parameter — there is no `"system"` role for input
|
475
481
|
# messages in the Messages API.
|
476
482
|
#
|
477
|
-
# There is a limit of
|
483
|
+
# There is a limit of 100,000 messages in a single request.
|
478
484
|
messages:,
|
479
485
|
# Body param: The model that will complete your prompt.\n\nSee
|
480
486
|
# [models](https://docs.anthropic.com/en/docs/models-overview) for additional
|
@@ -537,6 +543,12 @@ module Anthropic
|
|
537
543
|
# those tools using the tool input generated by the model and then optionally
|
538
544
|
# return results back to the model using `tool_result` content blocks.
|
539
545
|
#
|
546
|
+
# There are two types of tools: **client tools** and **server tools**. The
|
547
|
+
# behavior described below applies to client tools. For
|
548
|
+
# [server tools](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/overview#server-tools),
|
549
|
+
# see their individual documentation as each has its own behavior (e.g., the
|
550
|
+
# [web search tool](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/web-search-tool)).
|
551
|
+
#
|
540
552
|
# Each tool definition includes:
|
541
553
|
#
|
542
554
|
# - `name`: Name of the tool.
|
@@ -660,15 +672,15 @@ module Anthropic
|
|
660
672
|
T::Array[
|
661
673
|
T.any(
|
662
674
|
Anthropic::Beta::BetaTool::OrHash,
|
663
|
-
Anthropic::Beta::BetaToolComputerUse20241022::OrHash,
|
664
675
|
Anthropic::Beta::BetaToolBash20241022::OrHash,
|
665
|
-
Anthropic::Beta::BetaToolTextEditor20241022::OrHash,
|
666
|
-
Anthropic::Beta::BetaToolComputerUse20250124::OrHash,
|
667
676
|
Anthropic::Beta::BetaToolBash20250124::OrHash,
|
677
|
+
Anthropic::Beta::BetaCodeExecutionTool20250522::OrHash,
|
678
|
+
Anthropic::Beta::BetaToolComputerUse20241022::OrHash,
|
679
|
+
Anthropic::Beta::BetaToolComputerUse20250124::OrHash,
|
680
|
+
Anthropic::Beta::BetaToolTextEditor20241022::OrHash,
|
668
681
|
Anthropic::Beta::BetaToolTextEditor20250124::OrHash,
|
669
682
|
Anthropic::Beta::BetaToolTextEditor20250429::OrHash,
|
670
|
-
Anthropic::Beta::BetaWebSearchTool20250305::OrHash
|
671
|
-
Anthropic::Beta::BetaCodeExecutionTool20250522::OrHash
|
683
|
+
Anthropic::Beta::BetaWebSearchTool20250305::OrHash
|
672
684
|
)
|
673
685
|
],
|
674
686
|
betas: T::Array[T.any(String, Anthropic::AnthropicBeta::OrSymbol)],
|
@@ -763,7 +775,7 @@ module Anthropic
|
|
763
775
|
# the top-level `system` parameter — there is no `"system"` role for input
|
764
776
|
# messages in the Messages API.
|
765
777
|
#
|
766
|
-
# There is a limit of
|
778
|
+
# There is a limit of 100,000 messages in a single request.
|
767
779
|
messages:,
|
768
780
|
# Body param: The model that will complete your prompt.\n\nSee
|
769
781
|
# [models](https://docs.anthropic.com/en/docs/models-overview) for additional
|
@@ -797,6 +809,12 @@ module Anthropic
|
|
797
809
|
# those tools using the tool input generated by the model and then optionally
|
798
810
|
# return results back to the model using `tool_result` content blocks.
|
799
811
|
#
|
812
|
+
# There are two types of tools: **client tools** and **server tools**. The
|
813
|
+
# behavior described below applies to client tools. For
|
814
|
+
# [server tools](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/overview#server-tools),
|
815
|
+
# see their individual documentation as each has its own behavior (e.g., the
|
816
|
+
# [web search tool](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/web-search-tool)).
|
817
|
+
#
|
800
818
|
# Each tool definition includes:
|
801
819
|
#
|
802
820
|
# - `name`: Name of the tool.
|