anthropic 1.15.2 → 1.16.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 +13 -0
- data/README.md +10 -10
- data/lib/anthropic/helpers/tools/compaction_control.rb +105 -0
- data/lib/anthropic/helpers/tools/runner.rb +126 -13
- data/lib/anthropic/models/anthropic_beta.rb +3 -0
- data/lib/anthropic/models/beta/beta_code_execution_tool_20250522.rb +28 -1
- data/lib/anthropic/models/beta/beta_code_execution_tool_20250825.rb +28 -1
- data/lib/anthropic/models/beta/beta_content_block.rb +3 -1
- data/lib/anthropic/models/beta/beta_content_block_param.rb +3 -1
- data/lib/anthropic/models/beta/beta_direct_caller.rb +21 -0
- data/lib/anthropic/models/beta/beta_mcp_tool_config.rb +27 -0
- data/lib/anthropic/models/beta/beta_mcp_tool_default_config.rb +27 -0
- data/lib/anthropic/models/beta/beta_mcp_toolset.rb +58 -0
- data/lib/anthropic/models/beta/beta_memory_tool_20250818.rb +36 -1
- data/lib/anthropic/models/beta/beta_message.rb +2 -2
- data/lib/anthropic/models/beta/beta_message_param.rb +3 -3
- data/lib/anthropic/models/beta/beta_output_config.rb +34 -0
- data/lib/anthropic/models/beta/beta_raw_content_block_start_event.rb +5 -3
- data/lib/anthropic/models/beta/beta_server_tool_caller.rb +27 -0
- data/lib/anthropic/models/beta/beta_server_tool_use_block.rb +32 -1
- data/lib/anthropic/models/beta/beta_server_tool_use_block_param.rb +33 -1
- data/lib/anthropic/models/beta/beta_tool.rb +36 -1
- data/lib/anthropic/models/beta/beta_tool_bash_20241022.rb +36 -1
- data/lib/anthropic/models/beta/beta_tool_bash_20250124.rb +36 -1
- data/lib/anthropic/models/beta/beta_tool_computer_use_20241022.rb +36 -1
- data/lib/anthropic/models/beta/beta_tool_computer_use_20250124.rb +36 -1
- data/lib/anthropic/models/beta/beta_tool_computer_use_20251124.rb +114 -0
- data/lib/anthropic/models/beta/beta_tool_reference_block.rb +25 -0
- data/lib/anthropic/models/beta/beta_tool_reference_block_param.rb +36 -0
- data/lib/anthropic/models/beta/beta_tool_result_block_param.rb +8 -4
- data/lib/anthropic/models/beta/beta_tool_search_tool_bm25_20251119.rb +85 -0
- data/lib/anthropic/models/beta/beta_tool_search_tool_regex_20251119.rb +85 -0
- data/lib/anthropic/models/beta/beta_tool_search_tool_result_block.rb +43 -0
- data/lib/anthropic/models/beta/beta_tool_search_tool_result_block_param.rb +53 -0
- data/lib/anthropic/models/beta/beta_tool_search_tool_result_error.rb +44 -0
- data/lib/anthropic/models/beta/beta_tool_search_tool_result_error_param.rb +38 -0
- data/lib/anthropic/models/beta/beta_tool_search_tool_search_result_block.rb +26 -0
- data/lib/anthropic/models/beta/beta_tool_search_tool_search_result_block_param.rb +26 -0
- data/lib/anthropic/models/beta/beta_tool_text_editor_20241022.rb +36 -1
- data/lib/anthropic/models/beta/beta_tool_text_editor_20250124.rb +36 -1
- data/lib/anthropic/models/beta/beta_tool_text_editor_20250429.rb +36 -1
- data/lib/anthropic/models/beta/beta_tool_text_editor_20250728.rb +36 -1
- data/lib/anthropic/models/beta/beta_tool_union.rb +17 -1
- data/lib/anthropic/models/beta/beta_tool_use_block.rb +30 -1
- data/lib/anthropic/models/beta/beta_tool_use_block_param.rb +27 -1
- data/lib/anthropic/models/beta/beta_web_fetch_tool_20250910.rb +28 -1
- data/lib/anthropic/models/beta/beta_web_search_tool_20250305.rb +28 -1
- data/lib/anthropic/models/beta/message_count_tokens_params.rb +29 -4
- data/lib/anthropic/models/beta/message_create_params.rb +12 -3
- data/lib/anthropic/models/beta/messages/batch_create_params.rb +16 -7
- data/lib/anthropic/models/messages/batch_create_params.rb +4 -4
- data/lib/anthropic/models/model.rb +10 -0
- data/lib/anthropic/resources/beta/messages.rb +26 -11
- data/lib/anthropic/resources/messages.rb +8 -2
- data/lib/anthropic/version.rb +1 -1
- data/lib/anthropic.rb +19 -0
- data/manifest.yaml +1 -0
- data/rbi/anthropic/models/anthropic_beta.rbi +2 -0
- data/rbi/anthropic/models/beta/beta_code_execution_tool_20250522.rbi +77 -0
- data/rbi/anthropic/models/beta/beta_code_execution_tool_20250825.rbi +77 -0
- data/rbi/anthropic/models/beta/beta_content_block.rbi +1 -0
- data/rbi/anthropic/models/beta/beta_content_block_param.rbi +1 -0
- data/rbi/anthropic/models/beta/beta_direct_caller.rbi +31 -0
- data/rbi/anthropic/models/beta/beta_mcp_tool_config.rbi +46 -0
- data/rbi/anthropic/models/beta/beta_mcp_tool_default_config.rbi +46 -0
- data/rbi/anthropic/models/beta/beta_mcp_toolset.rbi +100 -0
- data/rbi/anthropic/models/beta/beta_memory_tool_20250818.rbi +88 -0
- data/rbi/anthropic/models/beta/beta_message.rbi +1 -0
- data/rbi/anthropic/models/beta/beta_output_config.rbi +82 -0
- data/rbi/anthropic/models/beta/beta_raw_content_block_start_event.rbi +2 -0
- data/rbi/anthropic/models/beta/beta_server_tool_caller.rbi +34 -0
- data/rbi/anthropic/models/beta/beta_server_tool_use_block.rbi +54 -1
- data/rbi/anthropic/models/beta/beta_server_tool_use_block_param.rbi +70 -1
- data/rbi/anthropic/models/beta/beta_tool.rbi +75 -0
- data/rbi/anthropic/models/beta/beta_tool_bash_20241022.rbi +88 -0
- data/rbi/anthropic/models/beta/beta_tool_bash_20250124.rbi +88 -0
- data/rbi/anthropic/models/beta/beta_tool_computer_use_20241022.rbi +88 -0
- data/rbi/anthropic/models/beta/beta_tool_computer_use_20250124.rbi +88 -0
- data/rbi/anthropic/models/beta/beta_tool_computer_use_20251124.rbi +204 -0
- data/rbi/anthropic/models/beta/beta_tool_reference_block.rbi +35 -0
- data/rbi/anthropic/models/beta/beta_tool_reference_block_param.rbi +67 -0
- data/rbi/anthropic/models/beta/beta_tool_result_block_param.rbi +3 -1
- data/rbi/anthropic/models/beta/beta_tool_search_tool_bm25_20251119.rbi +198 -0
- data/rbi/anthropic/models/beta/beta_tool_search_tool_regex_20251119.rbi +198 -0
- data/rbi/anthropic/models/beta/beta_tool_search_tool_result_block.rbi +81 -0
- data/rbi/anthropic/models/beta/beta_tool_search_tool_result_block_param.rbi +110 -0
- data/rbi/anthropic/models/beta/beta_tool_search_tool_result_error.rbi +104 -0
- data/rbi/anthropic/models/beta/beta_tool_search_tool_result_error_param.rbi +96 -0
- data/rbi/anthropic/models/beta/beta_tool_search_tool_search_result_block.rbi +48 -0
- data/rbi/anthropic/models/beta/beta_tool_search_tool_search_result_block_param.rbi +48 -0
- data/rbi/anthropic/models/beta/beta_tool_text_editor_20241022.rbi +88 -0
- data/rbi/anthropic/models/beta/beta_tool_text_editor_20250124.rbi +88 -0
- data/rbi/anthropic/models/beta/beta_tool_text_editor_20250429.rbi +88 -0
- data/rbi/anthropic/models/beta/beta_tool_text_editor_20250728.rbi +88 -0
- data/rbi/anthropic/models/beta/beta_tool_union.rbi +9 -1
- data/rbi/anthropic/models/beta/beta_tool_use_block.rbi +55 -2
- data/rbi/anthropic/models/beta/beta_tool_use_block_param.rbi +58 -1
- data/rbi/anthropic/models/beta/beta_web_fetch_tool_20250910.rbi +77 -0
- data/rbi/anthropic/models/beta/beta_web_search_tool_20250305.rbi +77 -0
- data/rbi/anthropic/models/beta/message_count_tokens_params.rbi +44 -5
- data/rbi/anthropic/models/beta/message_create_params.rbi +35 -4
- data/rbi/anthropic/models/beta/messages/batch_create_params.rbi +43 -10
- data/rbi/anthropic/models/messages/batch_create_params.rbi +6 -6
- data/rbi/anthropic/models/model.rbi +8 -0
- data/rbi/anthropic/resources/beta/messages.rbi +29 -3
- data/sig/anthropic/models/anthropic_beta.rbs +2 -0
- data/sig/anthropic/models/beta/beta_code_execution_tool_20250522.rbs +27 -0
- data/sig/anthropic/models/beta/beta_code_execution_tool_20250825.rbs +27 -0
- data/sig/anthropic/models/beta/beta_content_block.rbs +1 -0
- data/sig/anthropic/models/beta/beta_content_block_param.rbs +1 -0
- data/sig/anthropic/models/beta/beta_direct_caller.rbs +17 -0
- data/sig/anthropic/models/beta/beta_mcp_tool_config.rbs +23 -0
- data/sig/anthropic/models/beta/beta_mcp_tool_default_config.rbs +23 -0
- data/sig/anthropic/models/beta/beta_mcp_toolset.rbs +48 -0
- data/sig/anthropic/models/beta/beta_memory_tool_20250818.rbs +36 -0
- data/sig/anthropic/models/beta/beta_output_config.rbs +34 -0
- data/sig/anthropic/models/beta/beta_raw_content_block_start_event.rbs +1 -0
- data/sig/anthropic/models/beta/beta_server_tool_caller.rbs +23 -0
- data/sig/anthropic/models/beta/beta_server_tool_use_block.rbs +19 -0
- data/sig/anthropic/models/beta/beta_server_tool_use_block_param.rbs +25 -2
- data/sig/anthropic/models/beta/beta_tool.rbs +36 -0
- data/sig/anthropic/models/beta/beta_tool_bash_20241022.rbs +36 -0
- data/sig/anthropic/models/beta/beta_tool_bash_20250124.rbs +36 -0
- data/sig/anthropic/models/beta/beta_tool_computer_use_20241022.rbs +36 -0
- data/sig/anthropic/models/beta/beta_tool_computer_use_20250124.rbs +36 -0
- data/sig/anthropic/models/beta/beta_tool_computer_use_20251124.rbs +99 -0
- data/sig/anthropic/models/beta/beta_tool_reference_block.rbs +20 -0
- data/sig/anthropic/models/beta/beta_tool_reference_block_param.rbs +34 -0
- data/sig/anthropic/models/beta/beta_tool_result_block_param.rbs +1 -0
- data/sig/anthropic/models/beta/beta_tool_search_tool_bm25_20251119.rbs +79 -0
- data/sig/anthropic/models/beta/beta_tool_search_tool_regex_20251119.rbs +79 -0
- data/sig/anthropic/models/beta/beta_tool_search_tool_result_block.rbs +44 -0
- data/sig/anthropic/models/beta/beta_tool_search_tool_result_block_param.rbs +49 -0
- data/sig/anthropic/models/beta/beta_tool_search_tool_result_error.rbs +51 -0
- data/sig/anthropic/models/beta/beta_tool_search_tool_result_error_param.rbs +46 -0
- data/sig/anthropic/models/beta/beta_tool_search_tool_search_result_block.rbs +29 -0
- data/sig/anthropic/models/beta/beta_tool_search_tool_search_result_block_param.rbs +29 -0
- data/sig/anthropic/models/beta/beta_tool_text_editor_20241022.rbs +36 -0
- data/sig/anthropic/models/beta/beta_tool_text_editor_20250124.rbs +36 -0
- data/sig/anthropic/models/beta/beta_tool_text_editor_20250429.rbs +36 -0
- data/sig/anthropic/models/beta/beta_tool_text_editor_20250728.rbs +36 -0
- data/sig/anthropic/models/beta/beta_tool_union.rbs +4 -0
- data/sig/anthropic/models/beta/beta_tool_use_block.rbs +21 -2
- data/sig/anthropic/models/beta/beta_tool_use_block_param.rbs +21 -2
- data/sig/anthropic/models/beta/beta_web_fetch_tool_20250910.rbs +27 -0
- data/sig/anthropic/models/beta/beta_web_search_tool_20250305.rbs +27 -0
- data/sig/anthropic/models/beta/message_count_tokens_params.rbs +13 -0
- data/sig/anthropic/models/beta/message_create_params.rbs +9 -0
- data/sig/anthropic/models/beta/messages/batch_create_params.rbs +9 -0
- data/sig/anthropic/models/model.rbs +9 -1
- data/sig/anthropic/resources/beta/messages.rbs +3 -0
- metadata +54 -2
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Anthropic
|
|
4
|
+
module Models
|
|
5
|
+
BetaOutputConfig = Beta::BetaOutputConfig
|
|
6
|
+
|
|
7
|
+
module Beta
|
|
8
|
+
class BetaOutputConfig < Anthropic::Internal::Type::BaseModel
|
|
9
|
+
OrHash =
|
|
10
|
+
T.type_alias do
|
|
11
|
+
T.any(
|
|
12
|
+
Anthropic::Beta::BetaOutputConfig,
|
|
13
|
+
Anthropic::Internal::AnyHash
|
|
14
|
+
)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# All possible effort levels.
|
|
18
|
+
sig do
|
|
19
|
+
returns(
|
|
20
|
+
T.nilable(Anthropic::Beta::BetaOutputConfig::Effort::OrSymbol)
|
|
21
|
+
)
|
|
22
|
+
end
|
|
23
|
+
attr_accessor :effort
|
|
24
|
+
|
|
25
|
+
sig do
|
|
26
|
+
params(
|
|
27
|
+
effort:
|
|
28
|
+
T.nilable(Anthropic::Beta::BetaOutputConfig::Effort::OrSymbol)
|
|
29
|
+
).returns(T.attached_class)
|
|
30
|
+
end
|
|
31
|
+
def self.new(
|
|
32
|
+
# All possible effort levels.
|
|
33
|
+
effort: nil
|
|
34
|
+
)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
sig do
|
|
38
|
+
override.returns(
|
|
39
|
+
{
|
|
40
|
+
effort:
|
|
41
|
+
T.nilable(Anthropic::Beta::BetaOutputConfig::Effort::OrSymbol)
|
|
42
|
+
}
|
|
43
|
+
)
|
|
44
|
+
end
|
|
45
|
+
def to_hash
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# All possible effort levels.
|
|
49
|
+
module Effort
|
|
50
|
+
extend Anthropic::Internal::Type::Enum
|
|
51
|
+
|
|
52
|
+
TaggedSymbol =
|
|
53
|
+
T.type_alias do
|
|
54
|
+
T.all(Symbol, Anthropic::Beta::BetaOutputConfig::Effort)
|
|
55
|
+
end
|
|
56
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
57
|
+
|
|
58
|
+
LOW =
|
|
59
|
+
T.let(:low, Anthropic::Beta::BetaOutputConfig::Effort::TaggedSymbol)
|
|
60
|
+
MEDIUM =
|
|
61
|
+
T.let(
|
|
62
|
+
:medium,
|
|
63
|
+
Anthropic::Beta::BetaOutputConfig::Effort::TaggedSymbol
|
|
64
|
+
)
|
|
65
|
+
HIGH =
|
|
66
|
+
T.let(
|
|
67
|
+
:high,
|
|
68
|
+
Anthropic::Beta::BetaOutputConfig::Effort::TaggedSymbol
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
sig do
|
|
72
|
+
override.returns(
|
|
73
|
+
T::Array[Anthropic::Beta::BetaOutputConfig::Effort::TaggedSymbol]
|
|
74
|
+
)
|
|
75
|
+
end
|
|
76
|
+
def self.values
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
@@ -42,6 +42,7 @@ module Anthropic
|
|
|
42
42
|
Anthropic::Beta::BetaCodeExecutionToolResultBlock::OrHash,
|
|
43
43
|
Anthropic::Beta::BetaBashCodeExecutionToolResultBlock::OrHash,
|
|
44
44
|
Anthropic::Beta::BetaTextEditorCodeExecutionToolResultBlock::OrHash,
|
|
45
|
+
Anthropic::Beta::BetaToolSearchToolResultBlock::OrHash,
|
|
45
46
|
Anthropic::Beta::BetaMCPToolUseBlock::OrHash,
|
|
46
47
|
Anthropic::Beta::BetaMCPToolResultBlock::OrHash,
|
|
47
48
|
Anthropic::Beta::BetaContainerUploadBlock::OrHash
|
|
@@ -88,6 +89,7 @@ module Anthropic
|
|
|
88
89
|
Anthropic::Beta::BetaCodeExecutionToolResultBlock,
|
|
89
90
|
Anthropic::Beta::BetaBashCodeExecutionToolResultBlock,
|
|
90
91
|
Anthropic::Beta::BetaTextEditorCodeExecutionToolResultBlock,
|
|
92
|
+
Anthropic::Beta::BetaToolSearchToolResultBlock,
|
|
91
93
|
Anthropic::Beta::BetaMCPToolUseBlock,
|
|
92
94
|
Anthropic::Beta::BetaMCPToolResultBlock,
|
|
93
95
|
Anthropic::Beta::BetaContainerUploadBlock
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Anthropic
|
|
4
|
+
module Models
|
|
5
|
+
BetaServerToolCaller = Beta::BetaServerToolCaller
|
|
6
|
+
|
|
7
|
+
module Beta
|
|
8
|
+
class BetaServerToolCaller < Anthropic::Internal::Type::BaseModel
|
|
9
|
+
OrHash =
|
|
10
|
+
T.type_alias do
|
|
11
|
+
T.any(
|
|
12
|
+
Anthropic::Beta::BetaServerToolCaller,
|
|
13
|
+
Anthropic::Internal::AnyHash
|
|
14
|
+
)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
sig { returns(String) }
|
|
18
|
+
attr_accessor :tool_id
|
|
19
|
+
|
|
20
|
+
sig { returns(Symbol) }
|
|
21
|
+
attr_accessor :type
|
|
22
|
+
|
|
23
|
+
# Tool invocation generated by a server-side tool.
|
|
24
|
+
sig { params(tool_id: String, type: Symbol).returns(T.attached_class) }
|
|
25
|
+
def self.new(tool_id:, type: :code_execution_20250825)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
sig { override.returns({ tool_id: String, type: Symbol }) }
|
|
29
|
+
def to_hash
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -17,6 +17,12 @@ module Anthropic
|
|
|
17
17
|
sig { returns(String) }
|
|
18
18
|
attr_accessor :id
|
|
19
19
|
|
|
20
|
+
# Tool invocation directly from the model.
|
|
21
|
+
sig do
|
|
22
|
+
returns(Anthropic::Beta::BetaServerToolUseBlock::Caller::Variants)
|
|
23
|
+
end
|
|
24
|
+
attr_accessor :caller_
|
|
25
|
+
|
|
20
26
|
sig { returns(T::Hash[Symbol, T.anything]) }
|
|
21
27
|
attr_accessor :input
|
|
22
28
|
|
|
@@ -31,18 +37,32 @@ module Anthropic
|
|
|
31
37
|
sig do
|
|
32
38
|
params(
|
|
33
39
|
id: String,
|
|
40
|
+
caller_:
|
|
41
|
+
T.any(
|
|
42
|
+
Anthropic::Beta::BetaDirectCaller::OrHash,
|
|
43
|
+
Anthropic::Beta::BetaServerToolCaller::OrHash
|
|
44
|
+
),
|
|
34
45
|
input: T::Hash[Symbol, T.anything],
|
|
35
46
|
name: Anthropic::Beta::BetaServerToolUseBlock::Name::OrSymbol,
|
|
36
47
|
type: Symbol
|
|
37
48
|
).returns(T.attached_class)
|
|
38
49
|
end
|
|
39
|
-
def self.new(
|
|
50
|
+
def self.new(
|
|
51
|
+
id:,
|
|
52
|
+
# Tool invocation directly from the model.
|
|
53
|
+
caller_:,
|
|
54
|
+
input:,
|
|
55
|
+
name:,
|
|
56
|
+
type: :server_tool_use
|
|
57
|
+
)
|
|
40
58
|
end
|
|
41
59
|
|
|
42
60
|
sig do
|
|
43
61
|
override.returns(
|
|
44
62
|
{
|
|
45
63
|
id: String,
|
|
64
|
+
caller_:
|
|
65
|
+
Anthropic::Beta::BetaServerToolUseBlock::Caller::Variants,
|
|
46
66
|
input: T::Hash[Symbol, T.anything],
|
|
47
67
|
name: Anthropic::Beta::BetaServerToolUseBlock::Name::TaggedSymbol,
|
|
48
68
|
type: Symbol
|
|
@@ -52,6 +72,29 @@ module Anthropic
|
|
|
52
72
|
def to_hash
|
|
53
73
|
end
|
|
54
74
|
|
|
75
|
+
# Tool invocation directly from the model.
|
|
76
|
+
module Caller
|
|
77
|
+
extend Anthropic::Internal::Type::Union
|
|
78
|
+
|
|
79
|
+
Variants =
|
|
80
|
+
T.type_alias do
|
|
81
|
+
T.any(
|
|
82
|
+
Anthropic::Beta::BetaDirectCaller,
|
|
83
|
+
Anthropic::Beta::BetaServerToolCaller
|
|
84
|
+
)
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
sig do
|
|
88
|
+
override.returns(
|
|
89
|
+
T::Array[
|
|
90
|
+
Anthropic::Beta::BetaServerToolUseBlock::Caller::Variants
|
|
91
|
+
]
|
|
92
|
+
)
|
|
93
|
+
end
|
|
94
|
+
def self.variants
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
|
|
55
98
|
module Name
|
|
56
99
|
extend Anthropic::Internal::Type::Enum
|
|
57
100
|
|
|
@@ -86,6 +129,16 @@ module Anthropic
|
|
|
86
129
|
:text_editor_code_execution,
|
|
87
130
|
Anthropic::Beta::BetaServerToolUseBlock::Name::TaggedSymbol
|
|
88
131
|
)
|
|
132
|
+
TOOL_SEARCH_TOOL_REGEX =
|
|
133
|
+
T.let(
|
|
134
|
+
:tool_search_tool_regex,
|
|
135
|
+
Anthropic::Beta::BetaServerToolUseBlock::Name::TaggedSymbol
|
|
136
|
+
)
|
|
137
|
+
TOOL_SEARCH_TOOL_BM25 =
|
|
138
|
+
T.let(
|
|
139
|
+
:tool_search_tool_bm25,
|
|
140
|
+
Anthropic::Beta::BetaServerToolUseBlock::Name::TaggedSymbol
|
|
141
|
+
)
|
|
89
142
|
|
|
90
143
|
sig do
|
|
91
144
|
override.returns(
|
|
@@ -40,6 +40,30 @@ module Anthropic
|
|
|
40
40
|
end
|
|
41
41
|
attr_writer :cache_control
|
|
42
42
|
|
|
43
|
+
# Tool invocation directly from the model.
|
|
44
|
+
sig do
|
|
45
|
+
returns(
|
|
46
|
+
T.nilable(
|
|
47
|
+
T.any(
|
|
48
|
+
Anthropic::Beta::BetaDirectCaller,
|
|
49
|
+
Anthropic::Beta::BetaServerToolCaller
|
|
50
|
+
)
|
|
51
|
+
)
|
|
52
|
+
)
|
|
53
|
+
end
|
|
54
|
+
attr_reader :caller_
|
|
55
|
+
|
|
56
|
+
sig do
|
|
57
|
+
params(
|
|
58
|
+
caller_:
|
|
59
|
+
T.any(
|
|
60
|
+
Anthropic::Beta::BetaDirectCaller::OrHash,
|
|
61
|
+
Anthropic::Beta::BetaServerToolCaller::OrHash
|
|
62
|
+
)
|
|
63
|
+
).void
|
|
64
|
+
end
|
|
65
|
+
attr_writer :caller_
|
|
66
|
+
|
|
43
67
|
sig do
|
|
44
68
|
params(
|
|
45
69
|
id: String,
|
|
@@ -47,6 +71,11 @@ module Anthropic
|
|
|
47
71
|
name: Anthropic::Beta::BetaServerToolUseBlockParam::Name::OrSymbol,
|
|
48
72
|
cache_control:
|
|
49
73
|
T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash),
|
|
74
|
+
caller_:
|
|
75
|
+
T.any(
|
|
76
|
+
Anthropic::Beta::BetaDirectCaller::OrHash,
|
|
77
|
+
Anthropic::Beta::BetaServerToolCaller::OrHash
|
|
78
|
+
),
|
|
50
79
|
type: Symbol
|
|
51
80
|
).returns(T.attached_class)
|
|
52
81
|
end
|
|
@@ -56,6 +85,8 @@ module Anthropic
|
|
|
56
85
|
name:,
|
|
57
86
|
# Create a cache control breakpoint at this content block.
|
|
58
87
|
cache_control: nil,
|
|
88
|
+
# Tool invocation directly from the model.
|
|
89
|
+
caller_: nil,
|
|
59
90
|
type: :server_tool_use
|
|
60
91
|
)
|
|
61
92
|
end
|
|
@@ -69,7 +100,12 @@ module Anthropic
|
|
|
69
100
|
Anthropic::Beta::BetaServerToolUseBlockParam::Name::OrSymbol,
|
|
70
101
|
type: Symbol,
|
|
71
102
|
cache_control:
|
|
72
|
-
T.nilable(Anthropic::Beta::BetaCacheControlEphemeral)
|
|
103
|
+
T.nilable(Anthropic::Beta::BetaCacheControlEphemeral),
|
|
104
|
+
caller_:
|
|
105
|
+
T.any(
|
|
106
|
+
Anthropic::Beta::BetaDirectCaller,
|
|
107
|
+
Anthropic::Beta::BetaServerToolCaller
|
|
108
|
+
)
|
|
73
109
|
}
|
|
74
110
|
)
|
|
75
111
|
end
|
|
@@ -110,6 +146,16 @@ module Anthropic
|
|
|
110
146
|
:text_editor_code_execution,
|
|
111
147
|
Anthropic::Beta::BetaServerToolUseBlockParam::Name::TaggedSymbol
|
|
112
148
|
)
|
|
149
|
+
TOOL_SEARCH_TOOL_REGEX =
|
|
150
|
+
T.let(
|
|
151
|
+
:tool_search_tool_regex,
|
|
152
|
+
Anthropic::Beta::BetaServerToolUseBlockParam::Name::TaggedSymbol
|
|
153
|
+
)
|
|
154
|
+
TOOL_SEARCH_TOOL_BM25 =
|
|
155
|
+
T.let(
|
|
156
|
+
:tool_search_tool_bm25,
|
|
157
|
+
Anthropic::Beta::BetaServerToolUseBlockParam::Name::TaggedSymbol
|
|
158
|
+
)
|
|
113
159
|
|
|
114
160
|
sig do
|
|
115
161
|
override.returns(
|
|
@@ -121,6 +167,29 @@ module Anthropic
|
|
|
121
167
|
def self.values
|
|
122
168
|
end
|
|
123
169
|
end
|
|
170
|
+
|
|
171
|
+
# Tool invocation directly from the model.
|
|
172
|
+
module Caller
|
|
173
|
+
extend Anthropic::Internal::Type::Union
|
|
174
|
+
|
|
175
|
+
Variants =
|
|
176
|
+
T.type_alias do
|
|
177
|
+
T.any(
|
|
178
|
+
Anthropic::Beta::BetaDirectCaller,
|
|
179
|
+
Anthropic::Beta::BetaServerToolCaller
|
|
180
|
+
)
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
sig do
|
|
184
|
+
override.returns(
|
|
185
|
+
T::Array[
|
|
186
|
+
Anthropic::Beta::BetaServerToolUseBlockParam::Caller::Variants
|
|
187
|
+
]
|
|
188
|
+
)
|
|
189
|
+
end
|
|
190
|
+
def self.variants
|
|
191
|
+
end
|
|
192
|
+
end
|
|
124
193
|
end
|
|
125
194
|
end
|
|
126
195
|
end
|
|
@@ -31,6 +31,23 @@ module Anthropic
|
|
|
31
31
|
sig { returns(String) }
|
|
32
32
|
attr_accessor :name
|
|
33
33
|
|
|
34
|
+
sig do
|
|
35
|
+
returns(
|
|
36
|
+
T.nilable(
|
|
37
|
+
T::Array[Anthropic::Beta::BetaTool::AllowedCaller::OrSymbol]
|
|
38
|
+
)
|
|
39
|
+
)
|
|
40
|
+
end
|
|
41
|
+
attr_reader :allowed_callers
|
|
42
|
+
|
|
43
|
+
sig do
|
|
44
|
+
params(
|
|
45
|
+
allowed_callers:
|
|
46
|
+
T::Array[Anthropic::Beta::BetaTool::AllowedCaller::OrSymbol]
|
|
47
|
+
).void
|
|
48
|
+
end
|
|
49
|
+
attr_writer :allowed_callers
|
|
50
|
+
|
|
34
51
|
# Create a cache control breakpoint at this content block.
|
|
35
52
|
sig { returns(T.nilable(Anthropic::Beta::BetaCacheControlEphemeral)) }
|
|
36
53
|
attr_reader :cache_control
|
|
@@ -43,6 +60,14 @@ module Anthropic
|
|
|
43
60
|
end
|
|
44
61
|
attr_writer :cache_control
|
|
45
62
|
|
|
63
|
+
# If true, tool will not be included in initial system prompt. Only loaded when
|
|
64
|
+
# returned via tool_reference from tool search.
|
|
65
|
+
sig { returns(T.nilable(T::Boolean)) }
|
|
66
|
+
attr_reader :defer_loading
|
|
67
|
+
|
|
68
|
+
sig { params(defer_loading: T::Boolean).void }
|
|
69
|
+
attr_writer :defer_loading
|
|
70
|
+
|
|
46
71
|
# Description of what this tool does.
|
|
47
72
|
#
|
|
48
73
|
# Tool descriptions should be as detailed as possible. The more information that
|
|
@@ -55,6 +80,14 @@ module Anthropic
|
|
|
55
80
|
sig { params(description: String).void }
|
|
56
81
|
attr_writer :description
|
|
57
82
|
|
|
83
|
+
sig { returns(T.nilable(T::Array[T::Hash[Symbol, T.anything]])) }
|
|
84
|
+
attr_reader :input_examples
|
|
85
|
+
|
|
86
|
+
sig do
|
|
87
|
+
params(input_examples: T::Array[T::Hash[Symbol, T.anything]]).void
|
|
88
|
+
end
|
|
89
|
+
attr_writer :input_examples
|
|
90
|
+
|
|
58
91
|
sig { returns(T.nilable(T::Boolean)) }
|
|
59
92
|
attr_reader :strict
|
|
60
93
|
|
|
@@ -68,9 +101,13 @@ module Anthropic
|
|
|
68
101
|
params(
|
|
69
102
|
input_schema: Anthropic::Beta::BetaTool::InputSchema::OrHash,
|
|
70
103
|
name: String,
|
|
104
|
+
allowed_callers:
|
|
105
|
+
T::Array[Anthropic::Beta::BetaTool::AllowedCaller::OrSymbol],
|
|
71
106
|
cache_control:
|
|
72
107
|
T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash),
|
|
108
|
+
defer_loading: T::Boolean,
|
|
73
109
|
description: String,
|
|
110
|
+
input_examples: T::Array[T::Hash[Symbol, T.anything]],
|
|
74
111
|
strict: T::Boolean,
|
|
75
112
|
type: T.nilable(Anthropic::Beta::BetaTool::Type::OrSymbol)
|
|
76
113
|
).returns(T.attached_class)
|
|
@@ -85,8 +122,12 @@ module Anthropic
|
|
|
85
122
|
#
|
|
86
123
|
# This is how the tool will be called by the model and in `tool_use` blocks.
|
|
87
124
|
name:,
|
|
125
|
+
allowed_callers: nil,
|
|
88
126
|
# Create a cache control breakpoint at this content block.
|
|
89
127
|
cache_control: nil,
|
|
128
|
+
# If true, tool will not be included in initial system prompt. Only loaded when
|
|
129
|
+
# returned via tool_reference from tool search.
|
|
130
|
+
defer_loading: nil,
|
|
90
131
|
# Description of what this tool does.
|
|
91
132
|
#
|
|
92
133
|
# Tool descriptions should be as detailed as possible. The more information that
|
|
@@ -94,6 +135,7 @@ module Anthropic
|
|
|
94
135
|
# perform. You can use natural language descriptions to reinforce important
|
|
95
136
|
# aspects of the tool input JSON schema.
|
|
96
137
|
description: nil,
|
|
138
|
+
input_examples: nil,
|
|
97
139
|
strict: nil,
|
|
98
140
|
type: nil
|
|
99
141
|
)
|
|
@@ -104,9 +146,13 @@ module Anthropic
|
|
|
104
146
|
{
|
|
105
147
|
input_schema: Anthropic::Beta::BetaTool::InputSchema,
|
|
106
148
|
name: String,
|
|
149
|
+
allowed_callers:
|
|
150
|
+
T::Array[Anthropic::Beta::BetaTool::AllowedCaller::OrSymbol],
|
|
107
151
|
cache_control:
|
|
108
152
|
T.nilable(Anthropic::Beta::BetaCacheControlEphemeral),
|
|
153
|
+
defer_loading: T::Boolean,
|
|
109
154
|
description: String,
|
|
155
|
+
input_examples: T::Array[T::Hash[Symbol, T.anything]],
|
|
110
156
|
strict: T::Boolean,
|
|
111
157
|
type: T.nilable(Anthropic::Beta::BetaTool::Type::OrSymbol)
|
|
112
158
|
}
|
|
@@ -160,6 +206,35 @@ module Anthropic
|
|
|
160
206
|
end
|
|
161
207
|
end
|
|
162
208
|
|
|
209
|
+
module AllowedCaller
|
|
210
|
+
extend Anthropic::Internal::Type::Enum
|
|
211
|
+
|
|
212
|
+
TaggedSymbol =
|
|
213
|
+
T.type_alias do
|
|
214
|
+
T.all(Symbol, Anthropic::Beta::BetaTool::AllowedCaller)
|
|
215
|
+
end
|
|
216
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
217
|
+
|
|
218
|
+
DIRECT =
|
|
219
|
+
T.let(
|
|
220
|
+
:direct,
|
|
221
|
+
Anthropic::Beta::BetaTool::AllowedCaller::TaggedSymbol
|
|
222
|
+
)
|
|
223
|
+
CODE_EXECUTION_20250825 =
|
|
224
|
+
T.let(
|
|
225
|
+
:code_execution_20250825,
|
|
226
|
+
Anthropic::Beta::BetaTool::AllowedCaller::TaggedSymbol
|
|
227
|
+
)
|
|
228
|
+
|
|
229
|
+
sig do
|
|
230
|
+
override.returns(
|
|
231
|
+
T::Array[Anthropic::Beta::BetaTool::AllowedCaller::TaggedSymbol]
|
|
232
|
+
)
|
|
233
|
+
end
|
|
234
|
+
def self.values
|
|
235
|
+
end
|
|
236
|
+
end
|
|
237
|
+
|
|
163
238
|
module Type
|
|
164
239
|
extend Anthropic::Internal::Type::Enum
|
|
165
240
|
|
|
@@ -23,6 +23,27 @@ module Anthropic
|
|
|
23
23
|
sig { returns(Symbol) }
|
|
24
24
|
attr_accessor :type
|
|
25
25
|
|
|
26
|
+
sig do
|
|
27
|
+
returns(
|
|
28
|
+
T.nilable(
|
|
29
|
+
T::Array[
|
|
30
|
+
Anthropic::Beta::BetaToolBash20241022::AllowedCaller::OrSymbol
|
|
31
|
+
]
|
|
32
|
+
)
|
|
33
|
+
)
|
|
34
|
+
end
|
|
35
|
+
attr_reader :allowed_callers
|
|
36
|
+
|
|
37
|
+
sig do
|
|
38
|
+
params(
|
|
39
|
+
allowed_callers:
|
|
40
|
+
T::Array[
|
|
41
|
+
Anthropic::Beta::BetaToolBash20241022::AllowedCaller::OrSymbol
|
|
42
|
+
]
|
|
43
|
+
).void
|
|
44
|
+
end
|
|
45
|
+
attr_writer :allowed_callers
|
|
46
|
+
|
|
26
47
|
# Create a cache control breakpoint at this content block.
|
|
27
48
|
sig { returns(T.nilable(Anthropic::Beta::BetaCacheControlEphemeral)) }
|
|
28
49
|
attr_reader :cache_control
|
|
@@ -35,6 +56,22 @@ module Anthropic
|
|
|
35
56
|
end
|
|
36
57
|
attr_writer :cache_control
|
|
37
58
|
|
|
59
|
+
# If true, tool will not be included in initial system prompt. Only loaded when
|
|
60
|
+
# returned via tool_reference from tool search.
|
|
61
|
+
sig { returns(T.nilable(T::Boolean)) }
|
|
62
|
+
attr_reader :defer_loading
|
|
63
|
+
|
|
64
|
+
sig { params(defer_loading: T::Boolean).void }
|
|
65
|
+
attr_writer :defer_loading
|
|
66
|
+
|
|
67
|
+
sig { returns(T.nilable(T::Array[T::Hash[Symbol, T.anything]])) }
|
|
68
|
+
attr_reader :input_examples
|
|
69
|
+
|
|
70
|
+
sig do
|
|
71
|
+
params(input_examples: T::Array[T::Hash[Symbol, T.anything]]).void
|
|
72
|
+
end
|
|
73
|
+
attr_writer :input_examples
|
|
74
|
+
|
|
38
75
|
sig { returns(T.nilable(T::Boolean)) }
|
|
39
76
|
attr_reader :strict
|
|
40
77
|
|
|
@@ -43,16 +80,27 @@ module Anthropic
|
|
|
43
80
|
|
|
44
81
|
sig do
|
|
45
82
|
params(
|
|
83
|
+
allowed_callers:
|
|
84
|
+
T::Array[
|
|
85
|
+
Anthropic::Beta::BetaToolBash20241022::AllowedCaller::OrSymbol
|
|
86
|
+
],
|
|
46
87
|
cache_control:
|
|
47
88
|
T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash),
|
|
89
|
+
defer_loading: T::Boolean,
|
|
90
|
+
input_examples: T::Array[T::Hash[Symbol, T.anything]],
|
|
48
91
|
strict: T::Boolean,
|
|
49
92
|
name: Symbol,
|
|
50
93
|
type: Symbol
|
|
51
94
|
).returns(T.attached_class)
|
|
52
95
|
end
|
|
53
96
|
def self.new(
|
|
97
|
+
allowed_callers: nil,
|
|
54
98
|
# Create a cache control breakpoint at this content block.
|
|
55
99
|
cache_control: nil,
|
|
100
|
+
# If true, tool will not be included in initial system prompt. Only loaded when
|
|
101
|
+
# returned via tool_reference from tool search.
|
|
102
|
+
defer_loading: nil,
|
|
103
|
+
input_examples: nil,
|
|
56
104
|
strict: nil,
|
|
57
105
|
# Name of the tool.
|
|
58
106
|
#
|
|
@@ -67,14 +115,54 @@ module Anthropic
|
|
|
67
115
|
{
|
|
68
116
|
name: Symbol,
|
|
69
117
|
type: Symbol,
|
|
118
|
+
allowed_callers:
|
|
119
|
+
T::Array[
|
|
120
|
+
Anthropic::Beta::BetaToolBash20241022::AllowedCaller::OrSymbol
|
|
121
|
+
],
|
|
70
122
|
cache_control:
|
|
71
123
|
T.nilable(Anthropic::Beta::BetaCacheControlEphemeral),
|
|
124
|
+
defer_loading: T::Boolean,
|
|
125
|
+
input_examples: T::Array[T::Hash[Symbol, T.anything]],
|
|
72
126
|
strict: T::Boolean
|
|
73
127
|
}
|
|
74
128
|
)
|
|
75
129
|
end
|
|
76
130
|
def to_hash
|
|
77
131
|
end
|
|
132
|
+
|
|
133
|
+
module AllowedCaller
|
|
134
|
+
extend Anthropic::Internal::Type::Enum
|
|
135
|
+
|
|
136
|
+
TaggedSymbol =
|
|
137
|
+
T.type_alias do
|
|
138
|
+
T.all(
|
|
139
|
+
Symbol,
|
|
140
|
+
Anthropic::Beta::BetaToolBash20241022::AllowedCaller
|
|
141
|
+
)
|
|
142
|
+
end
|
|
143
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
144
|
+
|
|
145
|
+
DIRECT =
|
|
146
|
+
T.let(
|
|
147
|
+
:direct,
|
|
148
|
+
Anthropic::Beta::BetaToolBash20241022::AllowedCaller::TaggedSymbol
|
|
149
|
+
)
|
|
150
|
+
CODE_EXECUTION_20250825 =
|
|
151
|
+
T.let(
|
|
152
|
+
:code_execution_20250825,
|
|
153
|
+
Anthropic::Beta::BetaToolBash20241022::AllowedCaller::TaggedSymbol
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
sig do
|
|
157
|
+
override.returns(
|
|
158
|
+
T::Array[
|
|
159
|
+
Anthropic::Beta::BetaToolBash20241022::AllowedCaller::TaggedSymbol
|
|
160
|
+
]
|
|
161
|
+
)
|
|
162
|
+
end
|
|
163
|
+
def self.values
|
|
164
|
+
end
|
|
165
|
+
end
|
|
78
166
|
end
|
|
79
167
|
end
|
|
80
168
|
end
|