anthropic 1.9.0 → 1.10.1
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 +44 -0
- data/README.md +12 -12
- data/lib/anthropic/errors.rb +25 -11
- data/lib/anthropic/file_part.rb +10 -7
- data/lib/anthropic/helpers/bedrock/client.rb +8 -24
- data/lib/anthropic/internal/page.rb +1 -1
- data/lib/anthropic/internal/stream.rb +1 -0
- data/lib/anthropic/internal/transport/base_client.rb +16 -12
- data/lib/anthropic/internal/transport/pooled_net_requester.rb +7 -10
- data/lib/anthropic/internal/type/base_page.rb +1 -1
- data/lib/anthropic/internal/type/base_stream.rb +8 -17
- data/lib/anthropic/internal/type/file_input.rb +7 -4
- data/lib/anthropic/internal/util.rb +2 -1
- data/lib/anthropic/models/anthropic_beta.rb +6 -0
- data/lib/anthropic/models/beta/beta_clear_tool_uses_20250919_edit.rb +98 -0
- data/lib/anthropic/models/beta/beta_clear_tool_uses_20250919_edit_response.rb +38 -0
- data/lib/anthropic/models/beta/beta_context_management_config.rb +22 -0
- data/lib/anthropic/models/beta/beta_context_management_response.rb +23 -0
- data/lib/anthropic/models/beta/beta_count_tokens_context_management_response.rb +20 -0
- data/lib/anthropic/models/beta/beta_input_tokens_clear_at_least.rb +25 -0
- data/lib/anthropic/models/beta/beta_input_tokens_trigger.rb +25 -0
- data/lib/anthropic/models/beta/beta_memory_tool_20250818.rb +40 -0
- data/lib/anthropic/models/beta/beta_memory_tool_20250818_command.rb +30 -0
- data/lib/anthropic/models/beta/beta_memory_tool_20250818_create_command.rb +36 -0
- data/lib/anthropic/models/beta/beta_memory_tool_20250818_delete_command.rb +28 -0
- data/lib/anthropic/models/beta/beta_memory_tool_20250818_insert_command.rb +44 -0
- data/lib/anthropic/models/beta/beta_memory_tool_20250818_rename_command.rb +36 -0
- data/lib/anthropic/models/beta/beta_memory_tool_20250818_str_replace_command.rb +44 -0
- data/lib/anthropic/models/beta/beta_memory_tool_20250818_view_command.rb +36 -0
- data/lib/anthropic/models/beta/beta_message.rb +9 -1
- data/lib/anthropic/models/beta/beta_message_tokens_count.rb +13 -1
- data/lib/anthropic/models/beta/beta_raw_message_delta_event.rb +9 -1
- data/lib/anthropic/models/beta/beta_stop_reason.rb +1 -0
- data/lib/anthropic/models/beta/beta_tool_union.rb +3 -1
- data/lib/anthropic/models/beta/beta_tool_uses_keep.rb +25 -0
- data/lib/anthropic/models/beta/beta_tool_uses_trigger.rb +25 -0
- data/lib/anthropic/models/beta/message_count_tokens_params.rb +14 -4
- data/lib/anthropic/models/beta/message_create_params.rb +11 -3
- data/lib/anthropic/models/beta/messages/batch_create_params.rb +11 -3
- data/lib/anthropic/models/model.rb +10 -0
- data/lib/anthropic/models/stop_reason.rb +1 -0
- data/lib/anthropic/resources/beta/messages.rb +12 -6
- data/lib/anthropic/version.rb +1 -1
- data/lib/anthropic.rb +17 -0
- data/rbi/anthropic/errors.rbi +29 -2
- data/rbi/anthropic/file_part.rbi +1 -1
- data/rbi/anthropic/internal/transport/base_client.rbi +4 -5
- data/rbi/anthropic/internal/type/base_page.rbi +1 -1
- data/rbi/anthropic/internal/type/base_stream.rbi +15 -15
- data/rbi/anthropic/internal/util.rbi +1 -1
- data/rbi/anthropic/models/anthropic_beta.rbi +10 -0
- data/rbi/anthropic/models/beta/beta_clear_tool_uses_20250919_edit.rbi +183 -0
- data/rbi/anthropic/models/beta/beta_clear_tool_uses_20250919_edit_response.rbi +62 -0
- data/rbi/anthropic/models/beta/beta_context_management_config.rbi +56 -0
- data/rbi/anthropic/models/beta/beta_context_management_response.rbi +53 -0
- data/rbi/anthropic/models/beta/beta_count_tokens_context_management_response.rbi +35 -0
- data/rbi/anthropic/models/beta/beta_input_tokens_clear_at_least.rbi +33 -0
- data/rbi/anthropic/models/beta/beta_input_tokens_trigger.rbi +33 -0
- data/rbi/anthropic/models/beta/beta_memory_tool_20250818.rbi +72 -0
- data/rbi/anthropic/models/beta/beta_memory_tool_20250818_command.rbi +33 -0
- data/rbi/anthropic/models/beta/beta_memory_tool_20250818_create_command.rbi +53 -0
- data/rbi/anthropic/models/beta/beta_memory_tool_20250818_delete_command.rbi +41 -0
- data/rbi/anthropic/models/beta/beta_memory_tool_20250818_insert_command.rbi +69 -0
- data/rbi/anthropic/models/beta/beta_memory_tool_20250818_rename_command.rbi +55 -0
- data/rbi/anthropic/models/beta/beta_memory_tool_20250818_str_replace_command.rbi +64 -0
- data/rbi/anthropic/models/beta/beta_memory_tool_20250818_view_command.rbi +59 -0
- data/rbi/anthropic/models/beta/beta_message.rbi +20 -0
- data/rbi/anthropic/models/beta/beta_message_tokens_count.rbi +40 -2
- data/rbi/anthropic/models/beta/beta_raw_message_delta_event.rbi +20 -0
- data/rbi/anthropic/models/beta/beta_stop_reason.rbi +5 -0
- data/rbi/anthropic/models/beta/beta_tool_union.rbi +1 -0
- data/rbi/anthropic/models/beta/beta_tool_uses_keep.rbi +33 -0
- data/rbi/anthropic/models/beta/beta_tool_uses_trigger.rbi +33 -0
- data/rbi/anthropic/models/beta/message_count_tokens_params.rbi +23 -0
- data/rbi/anthropic/models/beta/message_create_params.rbi +22 -0
- data/rbi/anthropic/models/beta/messages/batch_create_params.rbi +28 -0
- data/rbi/anthropic/models/model.rbi +8 -0
- data/rbi/anthropic/models/stop_reason.rbi +5 -0
- data/rbi/anthropic/resources/beta/messages.rbi +15 -0
- data/sig/anthropic/errors.rbs +7 -0
- data/sig/anthropic/file_part.rbs +1 -1
- data/sig/anthropic/internal/type/base_stream.rbs +4 -3
- data/sig/anthropic/models/anthropic_beta.rbs +4 -0
- data/sig/anthropic/models/beta/beta_clear_tool_uses_20250919_edit.rbs +77 -0
- data/sig/anthropic/models/beta/beta_clear_tool_uses_20250919_edit_response.rbs +34 -0
- data/sig/anthropic/models/beta/beta_context_management_config.rbs +26 -0
- data/sig/anthropic/models/beta/beta_context_management_response.rbs +24 -0
- data/sig/anthropic/models/beta/beta_count_tokens_context_management_response.rbs +18 -0
- data/sig/anthropic/models/beta/beta_input_tokens_clear_at_least.rbs +20 -0
- data/sig/anthropic/models/beta/beta_input_tokens_trigger.rbs +19 -0
- data/sig/anthropic/models/beta/beta_memory_tool_20250818.rbs +34 -0
- data/sig/anthropic/models/beta/beta_memory_tool_20250818_command.rbs +21 -0
- data/sig/anthropic/models/beta/beta_memory_tool_20250818_create_command.rbs +26 -0
- data/sig/anthropic/models/beta/beta_memory_tool_20250818_delete_command.rbs +20 -0
- data/sig/anthropic/models/beta/beta_memory_tool_20250818_insert_command.rbs +39 -0
- data/sig/anthropic/models/beta/beta_memory_tool_20250818_rename_command.rbs +26 -0
- data/sig/anthropic/models/beta/beta_memory_tool_20250818_str_replace_command.rbs +39 -0
- data/sig/anthropic/models/beta/beta_memory_tool_20250818_view_command.rbs +32 -0
- data/sig/anthropic/models/beta/beta_message.rbs +5 -0
- data/sig/anthropic/models/beta/beta_message_tokens_count.rbs +15 -3
- data/sig/anthropic/models/beta/beta_raw_message_delta_event.rbs +5 -0
- data/sig/anthropic/models/beta/beta_stop_reason.rbs +2 -0
- data/sig/anthropic/models/beta/beta_tool_union.rbs +1 -0
- data/sig/anthropic/models/beta/beta_tool_uses_keep.rbs +19 -0
- data/sig/anthropic/models/beta/beta_tool_uses_trigger.rbs +19 -0
- data/sig/anthropic/models/beta/message_count_tokens_params.rbs +6 -0
- data/sig/anthropic/models/beta/message_create_params.rbs +5 -0
- data/sig/anthropic/models/beta/messages/batch_create_params.rbs +5 -0
- data/sig/anthropic/models/model.rbs +8 -0
- data/sig/anthropic/models/stop_reason.rbs +2 -0
- data/sig/anthropic/resources/beta/messages.rbs +3 -0
- metadata +53 -2
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Anthropic
|
|
4
|
+
module Models
|
|
5
|
+
BetaMemoryTool20250818InsertCommand =
|
|
6
|
+
Beta::BetaMemoryTool20250818InsertCommand
|
|
7
|
+
|
|
8
|
+
module Beta
|
|
9
|
+
class BetaMemoryTool20250818InsertCommand < Anthropic::Internal::Type::BaseModel
|
|
10
|
+
OrHash =
|
|
11
|
+
T.type_alias do
|
|
12
|
+
T.any(
|
|
13
|
+
Anthropic::Beta::BetaMemoryTool20250818InsertCommand,
|
|
14
|
+
Anthropic::Internal::AnyHash
|
|
15
|
+
)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Command type identifier
|
|
19
|
+
sig { returns(Symbol) }
|
|
20
|
+
attr_accessor :command
|
|
21
|
+
|
|
22
|
+
# Line number where text should be inserted
|
|
23
|
+
sig { returns(Integer) }
|
|
24
|
+
attr_accessor :insert_line
|
|
25
|
+
|
|
26
|
+
# Text to insert at the specified line
|
|
27
|
+
sig { returns(String) }
|
|
28
|
+
attr_accessor :insert_text
|
|
29
|
+
|
|
30
|
+
# Path to the file where text should be inserted
|
|
31
|
+
sig { returns(String) }
|
|
32
|
+
attr_accessor :path
|
|
33
|
+
|
|
34
|
+
sig do
|
|
35
|
+
params(
|
|
36
|
+
insert_line: Integer,
|
|
37
|
+
insert_text: String,
|
|
38
|
+
path: String,
|
|
39
|
+
command: Symbol
|
|
40
|
+
).returns(T.attached_class)
|
|
41
|
+
end
|
|
42
|
+
def self.new(
|
|
43
|
+
# Line number where text should be inserted
|
|
44
|
+
insert_line:,
|
|
45
|
+
# Text to insert at the specified line
|
|
46
|
+
insert_text:,
|
|
47
|
+
# Path to the file where text should be inserted
|
|
48
|
+
path:,
|
|
49
|
+
# Command type identifier
|
|
50
|
+
command: :insert
|
|
51
|
+
)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
sig do
|
|
55
|
+
override.returns(
|
|
56
|
+
{
|
|
57
|
+
command: Symbol,
|
|
58
|
+
insert_line: Integer,
|
|
59
|
+
insert_text: String,
|
|
60
|
+
path: String
|
|
61
|
+
}
|
|
62
|
+
)
|
|
63
|
+
end
|
|
64
|
+
def to_hash
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Anthropic
|
|
4
|
+
module Models
|
|
5
|
+
BetaMemoryTool20250818RenameCommand =
|
|
6
|
+
Beta::BetaMemoryTool20250818RenameCommand
|
|
7
|
+
|
|
8
|
+
module Beta
|
|
9
|
+
class BetaMemoryTool20250818RenameCommand < Anthropic::Internal::Type::BaseModel
|
|
10
|
+
OrHash =
|
|
11
|
+
T.type_alias do
|
|
12
|
+
T.any(
|
|
13
|
+
Anthropic::Beta::BetaMemoryTool20250818RenameCommand,
|
|
14
|
+
Anthropic::Internal::AnyHash
|
|
15
|
+
)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Command type identifier
|
|
19
|
+
sig { returns(Symbol) }
|
|
20
|
+
attr_accessor :command
|
|
21
|
+
|
|
22
|
+
# New path for the file or directory
|
|
23
|
+
sig { returns(String) }
|
|
24
|
+
attr_accessor :new_path
|
|
25
|
+
|
|
26
|
+
# Current path of the file or directory
|
|
27
|
+
sig { returns(String) }
|
|
28
|
+
attr_accessor :old_path
|
|
29
|
+
|
|
30
|
+
sig do
|
|
31
|
+
params(new_path: String, old_path: String, command: Symbol).returns(
|
|
32
|
+
T.attached_class
|
|
33
|
+
)
|
|
34
|
+
end
|
|
35
|
+
def self.new(
|
|
36
|
+
# New path for the file or directory
|
|
37
|
+
new_path:,
|
|
38
|
+
# Current path of the file or directory
|
|
39
|
+
old_path:,
|
|
40
|
+
# Command type identifier
|
|
41
|
+
command: :rename
|
|
42
|
+
)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
sig do
|
|
46
|
+
override.returns(
|
|
47
|
+
{ command: Symbol, new_path: String, old_path: String }
|
|
48
|
+
)
|
|
49
|
+
end
|
|
50
|
+
def to_hash
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Anthropic
|
|
4
|
+
module Models
|
|
5
|
+
BetaMemoryTool20250818StrReplaceCommand =
|
|
6
|
+
Beta::BetaMemoryTool20250818StrReplaceCommand
|
|
7
|
+
|
|
8
|
+
module Beta
|
|
9
|
+
class BetaMemoryTool20250818StrReplaceCommand < Anthropic::Internal::Type::BaseModel
|
|
10
|
+
OrHash =
|
|
11
|
+
T.type_alias do
|
|
12
|
+
T.any(
|
|
13
|
+
Anthropic::Beta::BetaMemoryTool20250818StrReplaceCommand,
|
|
14
|
+
Anthropic::Internal::AnyHash
|
|
15
|
+
)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Command type identifier
|
|
19
|
+
sig { returns(Symbol) }
|
|
20
|
+
attr_accessor :command
|
|
21
|
+
|
|
22
|
+
# Text to replace with
|
|
23
|
+
sig { returns(String) }
|
|
24
|
+
attr_accessor :new_str
|
|
25
|
+
|
|
26
|
+
# Text to search for and replace
|
|
27
|
+
sig { returns(String) }
|
|
28
|
+
attr_accessor :old_str
|
|
29
|
+
|
|
30
|
+
# Path to the file where text should be replaced
|
|
31
|
+
sig { returns(String) }
|
|
32
|
+
attr_accessor :path
|
|
33
|
+
|
|
34
|
+
sig do
|
|
35
|
+
params(
|
|
36
|
+
new_str: String,
|
|
37
|
+
old_str: String,
|
|
38
|
+
path: String,
|
|
39
|
+
command: Symbol
|
|
40
|
+
).returns(T.attached_class)
|
|
41
|
+
end
|
|
42
|
+
def self.new(
|
|
43
|
+
# Text to replace with
|
|
44
|
+
new_str:,
|
|
45
|
+
# Text to search for and replace
|
|
46
|
+
old_str:,
|
|
47
|
+
# Path to the file where text should be replaced
|
|
48
|
+
path:,
|
|
49
|
+
# Command type identifier
|
|
50
|
+
command: :str_replace
|
|
51
|
+
)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
sig do
|
|
55
|
+
override.returns(
|
|
56
|
+
{ command: Symbol, new_str: String, old_str: String, path: String }
|
|
57
|
+
)
|
|
58
|
+
end
|
|
59
|
+
def to_hash
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Anthropic
|
|
4
|
+
module Models
|
|
5
|
+
BetaMemoryTool20250818ViewCommand = Beta::BetaMemoryTool20250818ViewCommand
|
|
6
|
+
|
|
7
|
+
module Beta
|
|
8
|
+
class BetaMemoryTool20250818ViewCommand < Anthropic::Internal::Type::BaseModel
|
|
9
|
+
OrHash =
|
|
10
|
+
T.type_alias do
|
|
11
|
+
T.any(
|
|
12
|
+
Anthropic::Beta::BetaMemoryTool20250818ViewCommand,
|
|
13
|
+
Anthropic::Internal::AnyHash
|
|
14
|
+
)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# Command type identifier
|
|
18
|
+
sig { returns(Symbol) }
|
|
19
|
+
attr_accessor :command
|
|
20
|
+
|
|
21
|
+
# Path to directory or file to view
|
|
22
|
+
sig { returns(String) }
|
|
23
|
+
attr_accessor :path
|
|
24
|
+
|
|
25
|
+
# Optional line range for viewing specific lines
|
|
26
|
+
sig { returns(T.nilable(T::Array[Integer])) }
|
|
27
|
+
attr_reader :view_range
|
|
28
|
+
|
|
29
|
+
sig { params(view_range: T::Array[Integer]).void }
|
|
30
|
+
attr_writer :view_range
|
|
31
|
+
|
|
32
|
+
sig do
|
|
33
|
+
params(
|
|
34
|
+
path: String,
|
|
35
|
+
view_range: T::Array[Integer],
|
|
36
|
+
command: Symbol
|
|
37
|
+
).returns(T.attached_class)
|
|
38
|
+
end
|
|
39
|
+
def self.new(
|
|
40
|
+
# Path to directory or file to view
|
|
41
|
+
path:,
|
|
42
|
+
# Optional line range for viewing specific lines
|
|
43
|
+
view_range: nil,
|
|
44
|
+
# Command type identifier
|
|
45
|
+
command: :view
|
|
46
|
+
)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
sig do
|
|
50
|
+
override.returns(
|
|
51
|
+
{ command: Symbol, path: String, view_range: T::Array[Integer] }
|
|
52
|
+
)
|
|
53
|
+
end
|
|
54
|
+
def to_hash
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
@@ -64,6 +64,20 @@ module Anthropic
|
|
|
64
64
|
sig { returns(T::Array[Anthropic::Beta::BetaContentBlock::Variants]) }
|
|
65
65
|
attr_accessor :content
|
|
66
66
|
|
|
67
|
+
# Information about context management operations applied during the request.
|
|
68
|
+
sig do
|
|
69
|
+
returns(T.nilable(Anthropic::Beta::BetaContextManagementResponse))
|
|
70
|
+
end
|
|
71
|
+
attr_reader :context_management
|
|
72
|
+
|
|
73
|
+
sig do
|
|
74
|
+
params(
|
|
75
|
+
context_management:
|
|
76
|
+
T.nilable(Anthropic::Beta::BetaContextManagementResponse::OrHash)
|
|
77
|
+
).void
|
|
78
|
+
end
|
|
79
|
+
attr_writer :context_management
|
|
80
|
+
|
|
67
81
|
# The model that will complete your prompt.\n\nSee
|
|
68
82
|
# [models](https://docs.anthropic.com/en/docs/models-overview) for additional
|
|
69
83
|
# details and options.
|
|
@@ -152,6 +166,8 @@ module Anthropic
|
|
|
152
166
|
Anthropic::Beta::BetaContainerUploadBlock::OrHash
|
|
153
167
|
)
|
|
154
168
|
],
|
|
169
|
+
context_management:
|
|
170
|
+
T.nilable(Anthropic::Beta::BetaContextManagementResponse::OrHash),
|
|
155
171
|
model: T.any(Anthropic::Model::OrSymbol, String),
|
|
156
172
|
stop_reason: T.nilable(Anthropic::Beta::BetaStopReason::OrSymbol),
|
|
157
173
|
stop_sequence: T.nilable(String),
|
|
@@ -201,6 +217,8 @@ module Anthropic
|
|
|
201
217
|
# [{ "type": "text", "text": "B)" }]
|
|
202
218
|
# ```
|
|
203
219
|
content:,
|
|
220
|
+
# Information about context management operations applied during the request.
|
|
221
|
+
context_management:,
|
|
204
222
|
# The model that will complete your prompt.\n\nSee
|
|
205
223
|
# [models](https://docs.anthropic.com/en/docs/models-overview) for additional
|
|
206
224
|
# details and options.
|
|
@@ -259,6 +277,8 @@ module Anthropic
|
|
|
259
277
|
id: String,
|
|
260
278
|
container: T.nilable(Anthropic::Beta::BetaContainer),
|
|
261
279
|
content: T::Array[Anthropic::Beta::BetaContentBlock::Variants],
|
|
280
|
+
context_management:
|
|
281
|
+
T.nilable(Anthropic::Beta::BetaContextManagementResponse),
|
|
262
282
|
model: Anthropic::Model::Variants,
|
|
263
283
|
role: Symbol,
|
|
264
284
|
stop_reason:
|
|
@@ -14,20 +14,58 @@ module Anthropic
|
|
|
14
14
|
)
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
+
# Information about context management applied to the message.
|
|
18
|
+
sig do
|
|
19
|
+
returns(
|
|
20
|
+
T.nilable(Anthropic::Beta::BetaCountTokensContextManagementResponse)
|
|
21
|
+
)
|
|
22
|
+
end
|
|
23
|
+
attr_reader :context_management
|
|
24
|
+
|
|
25
|
+
sig do
|
|
26
|
+
params(
|
|
27
|
+
context_management:
|
|
28
|
+
T.nilable(
|
|
29
|
+
Anthropic::Beta::BetaCountTokensContextManagementResponse::OrHash
|
|
30
|
+
)
|
|
31
|
+
).void
|
|
32
|
+
end
|
|
33
|
+
attr_writer :context_management
|
|
34
|
+
|
|
17
35
|
# The total number of tokens across the provided list of messages, system prompt,
|
|
18
36
|
# and tools.
|
|
19
37
|
sig { returns(Integer) }
|
|
20
38
|
attr_accessor :input_tokens
|
|
21
39
|
|
|
22
|
-
sig
|
|
40
|
+
sig do
|
|
41
|
+
params(
|
|
42
|
+
context_management:
|
|
43
|
+
T.nilable(
|
|
44
|
+
Anthropic::Beta::BetaCountTokensContextManagementResponse::OrHash
|
|
45
|
+
),
|
|
46
|
+
input_tokens: Integer
|
|
47
|
+
).returns(T.attached_class)
|
|
48
|
+
end
|
|
23
49
|
def self.new(
|
|
50
|
+
# Information about context management applied to the message.
|
|
51
|
+
context_management:,
|
|
24
52
|
# The total number of tokens across the provided list of messages, system prompt,
|
|
25
53
|
# and tools.
|
|
26
54
|
input_tokens:
|
|
27
55
|
)
|
|
28
56
|
end
|
|
29
57
|
|
|
30
|
-
sig
|
|
58
|
+
sig do
|
|
59
|
+
override.returns(
|
|
60
|
+
{
|
|
61
|
+
context_management:
|
|
62
|
+
T.nilable(
|
|
63
|
+
Anthropic::Beta::BetaCountTokensContextManagementResponse
|
|
64
|
+
),
|
|
65
|
+
input_tokens: Integer
|
|
66
|
+
}
|
|
67
|
+
)
|
|
68
|
+
end
|
|
31
69
|
def to_hash
|
|
32
70
|
end
|
|
33
71
|
end
|
|
@@ -14,6 +14,20 @@ module Anthropic
|
|
|
14
14
|
)
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
+
# Information about context management operations applied during the request.
|
|
18
|
+
sig do
|
|
19
|
+
returns(T.nilable(Anthropic::Beta::BetaContextManagementResponse))
|
|
20
|
+
end
|
|
21
|
+
attr_reader :context_management
|
|
22
|
+
|
|
23
|
+
sig do
|
|
24
|
+
params(
|
|
25
|
+
context_management:
|
|
26
|
+
T.nilable(Anthropic::Beta::BetaContextManagementResponse::OrHash)
|
|
27
|
+
).void
|
|
28
|
+
end
|
|
29
|
+
attr_writer :context_management
|
|
30
|
+
|
|
17
31
|
sig { returns(Anthropic::Beta::BetaRawMessageDeltaEvent::Delta) }
|
|
18
32
|
attr_reader :delta
|
|
19
33
|
|
|
@@ -52,12 +66,16 @@ module Anthropic
|
|
|
52
66
|
|
|
53
67
|
sig do
|
|
54
68
|
params(
|
|
69
|
+
context_management:
|
|
70
|
+
T.nilable(Anthropic::Beta::BetaContextManagementResponse::OrHash),
|
|
55
71
|
delta: Anthropic::Beta::BetaRawMessageDeltaEvent::Delta::OrHash,
|
|
56
72
|
usage: Anthropic::Beta::BetaMessageDeltaUsage::OrHash,
|
|
57
73
|
type: Symbol
|
|
58
74
|
).returns(T.attached_class)
|
|
59
75
|
end
|
|
60
76
|
def self.new(
|
|
77
|
+
# Information about context management operations applied during the request.
|
|
78
|
+
context_management:,
|
|
61
79
|
delta:,
|
|
62
80
|
# Billing and rate-limit usage.
|
|
63
81
|
#
|
|
@@ -82,6 +100,8 @@ module Anthropic
|
|
|
82
100
|
sig do
|
|
83
101
|
override.returns(
|
|
84
102
|
{
|
|
103
|
+
context_management:
|
|
104
|
+
T.nilable(Anthropic::Beta::BetaContextManagementResponse),
|
|
85
105
|
delta: Anthropic::Beta::BetaRawMessageDeltaEvent::Delta,
|
|
86
106
|
type: Symbol,
|
|
87
107
|
usage: Anthropic::Beta::BetaMessageDeltaUsage
|
|
@@ -23,6 +23,11 @@ module Anthropic
|
|
|
23
23
|
PAUSE_TURN =
|
|
24
24
|
T.let(:pause_turn, Anthropic::Beta::BetaStopReason::TaggedSymbol)
|
|
25
25
|
REFUSAL = T.let(:refusal, Anthropic::Beta::BetaStopReason::TaggedSymbol)
|
|
26
|
+
MODEL_CONTEXT_WINDOW_EXCEEDED =
|
|
27
|
+
T.let(
|
|
28
|
+
:model_context_window_exceeded,
|
|
29
|
+
Anthropic::Beta::BetaStopReason::TaggedSymbol
|
|
30
|
+
)
|
|
26
31
|
|
|
27
32
|
sig do
|
|
28
33
|
override.returns(
|
|
@@ -17,6 +17,7 @@ module Anthropic
|
|
|
17
17
|
Anthropic::Beta::BetaCodeExecutionTool20250522,
|
|
18
18
|
Anthropic::Beta::BetaCodeExecutionTool20250825,
|
|
19
19
|
Anthropic::Beta::BetaToolComputerUse20241022,
|
|
20
|
+
Anthropic::Beta::BetaMemoryTool20250818,
|
|
20
21
|
Anthropic::Beta::BetaToolComputerUse20250124,
|
|
21
22
|
Anthropic::Beta::BetaToolTextEditor20241022,
|
|
22
23
|
Anthropic::Beta::BetaToolTextEditor20250124,
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Anthropic
|
|
4
|
+
module Models
|
|
5
|
+
BetaToolUsesKeep = Beta::BetaToolUsesKeep
|
|
6
|
+
|
|
7
|
+
module Beta
|
|
8
|
+
class BetaToolUsesKeep < Anthropic::Internal::Type::BaseModel
|
|
9
|
+
OrHash =
|
|
10
|
+
T.type_alias do
|
|
11
|
+
T.any(
|
|
12
|
+
Anthropic::Beta::BetaToolUsesKeep,
|
|
13
|
+
Anthropic::Internal::AnyHash
|
|
14
|
+
)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
sig { returns(Symbol) }
|
|
18
|
+
attr_accessor :type
|
|
19
|
+
|
|
20
|
+
sig { returns(Integer) }
|
|
21
|
+
attr_accessor :value
|
|
22
|
+
|
|
23
|
+
sig { params(value: Integer, type: Symbol).returns(T.attached_class) }
|
|
24
|
+
def self.new(value:, type: :tool_uses)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
sig { override.returns({ type: Symbol, value: Integer }) }
|
|
28
|
+
def to_hash
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Anthropic
|
|
4
|
+
module Models
|
|
5
|
+
BetaToolUsesTrigger = Beta::BetaToolUsesTrigger
|
|
6
|
+
|
|
7
|
+
module Beta
|
|
8
|
+
class BetaToolUsesTrigger < Anthropic::Internal::Type::BaseModel
|
|
9
|
+
OrHash =
|
|
10
|
+
T.type_alias do
|
|
11
|
+
T.any(
|
|
12
|
+
Anthropic::Beta::BetaToolUsesTrigger,
|
|
13
|
+
Anthropic::Internal::AnyHash
|
|
14
|
+
)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
sig { returns(Symbol) }
|
|
18
|
+
attr_accessor :type
|
|
19
|
+
|
|
20
|
+
sig { returns(Integer) }
|
|
21
|
+
attr_accessor :value
|
|
22
|
+
|
|
23
|
+
sig { params(value: Integer, type: Symbol).returns(T.attached_class) }
|
|
24
|
+
def self.new(value:, type: :tool_uses)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
sig { override.returns({ type: Symbol, value: Integer }) }
|
|
28
|
+
def to_hash
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -89,6 +89,18 @@ module Anthropic
|
|
|
89
89
|
sig { returns(T.any(Anthropic::Model::OrSymbol, String)) }
|
|
90
90
|
attr_accessor :model
|
|
91
91
|
|
|
92
|
+
# Configuration for context management operations.
|
|
93
|
+
sig { returns(T.nilable(Anthropic::Beta::BetaContextManagementConfig)) }
|
|
94
|
+
attr_reader :context_management
|
|
95
|
+
|
|
96
|
+
sig do
|
|
97
|
+
params(
|
|
98
|
+
context_management:
|
|
99
|
+
T.nilable(Anthropic::Beta::BetaContextManagementConfig::OrHash)
|
|
100
|
+
).void
|
|
101
|
+
end
|
|
102
|
+
attr_writer :context_management
|
|
103
|
+
|
|
92
104
|
# MCP servers to be utilized in this request
|
|
93
105
|
sig do
|
|
94
106
|
returns(
|
|
@@ -277,6 +289,7 @@ module Anthropic
|
|
|
277
289
|
Anthropic::Beta::BetaCodeExecutionTool20250522,
|
|
278
290
|
Anthropic::Beta::BetaCodeExecutionTool20250825,
|
|
279
291
|
Anthropic::Beta::BetaToolComputerUse20241022,
|
|
292
|
+
Anthropic::Beta::BetaMemoryTool20250818,
|
|
280
293
|
Anthropic::Beta::BetaToolComputerUse20250124,
|
|
281
294
|
Anthropic::Beta::BetaToolTextEditor20241022,
|
|
282
295
|
Anthropic::Beta::BetaToolTextEditor20250124,
|
|
@@ -302,6 +315,7 @@ module Anthropic
|
|
|
302
315
|
Anthropic::Beta::BetaCodeExecutionTool20250522::OrHash,
|
|
303
316
|
Anthropic::Beta::BetaCodeExecutionTool20250825::OrHash,
|
|
304
317
|
Anthropic::Beta::BetaToolComputerUse20241022::OrHash,
|
|
318
|
+
Anthropic::Beta::BetaMemoryTool20250818::OrHash,
|
|
305
319
|
Anthropic::Beta::BetaToolComputerUse20250124::OrHash,
|
|
306
320
|
Anthropic::Beta::BetaToolTextEditor20241022::OrHash,
|
|
307
321
|
Anthropic::Beta::BetaToolTextEditor20250124::OrHash,
|
|
@@ -336,6 +350,8 @@ module Anthropic
|
|
|
336
350
|
params(
|
|
337
351
|
messages: T::Array[Anthropic::Beta::BetaMessageParam::OrHash],
|
|
338
352
|
model: T.any(Anthropic::Model::OrSymbol, String),
|
|
353
|
+
context_management:
|
|
354
|
+
T.nilable(Anthropic::Beta::BetaContextManagementConfig::OrHash),
|
|
339
355
|
mcp_servers:
|
|
340
356
|
T::Array[
|
|
341
357
|
Anthropic::Beta::BetaRequestMCPServerURLDefinition::OrHash
|
|
@@ -363,6 +379,7 @@ module Anthropic
|
|
|
363
379
|
Anthropic::Beta::BetaCodeExecutionTool20250522::OrHash,
|
|
364
380
|
Anthropic::Beta::BetaCodeExecutionTool20250825::OrHash,
|
|
365
381
|
Anthropic::Beta::BetaToolComputerUse20241022::OrHash,
|
|
382
|
+
Anthropic::Beta::BetaMemoryTool20250818::OrHash,
|
|
366
383
|
Anthropic::Beta::BetaToolComputerUse20250124::OrHash,
|
|
367
384
|
Anthropic::Beta::BetaToolTextEditor20241022::OrHash,
|
|
368
385
|
Anthropic::Beta::BetaToolTextEditor20250124::OrHash,
|
|
@@ -447,6 +464,8 @@ module Anthropic
|
|
|
447
464
|
# [models](https://docs.anthropic.com/en/docs/models-overview) for additional
|
|
448
465
|
# details and options.
|
|
449
466
|
model:,
|
|
467
|
+
# Configuration for context management operations.
|
|
468
|
+
context_management: nil,
|
|
450
469
|
# MCP servers to be utilized in this request
|
|
451
470
|
mcp_servers: nil,
|
|
452
471
|
# System prompt.
|
|
@@ -555,6 +574,8 @@ module Anthropic
|
|
|
555
574
|
{
|
|
556
575
|
messages: T::Array[Anthropic::Beta::BetaMessageParam],
|
|
557
576
|
model: T.any(Anthropic::Model::OrSymbol, String),
|
|
577
|
+
context_management:
|
|
578
|
+
T.nilable(Anthropic::Beta::BetaContextManagementConfig),
|
|
558
579
|
mcp_servers:
|
|
559
580
|
T::Array[Anthropic::Beta::BetaRequestMCPServerURLDefinition],
|
|
560
581
|
system_:
|
|
@@ -580,6 +601,7 @@ module Anthropic
|
|
|
580
601
|
Anthropic::Beta::BetaCodeExecutionTool20250522,
|
|
581
602
|
Anthropic::Beta::BetaCodeExecutionTool20250825,
|
|
582
603
|
Anthropic::Beta::BetaToolComputerUse20241022,
|
|
604
|
+
Anthropic::Beta::BetaMemoryTool20250818,
|
|
583
605
|
Anthropic::Beta::BetaToolComputerUse20250124,
|
|
584
606
|
Anthropic::Beta::BetaToolTextEditor20241022,
|
|
585
607
|
Anthropic::Beta::BetaToolTextEditor20250124,
|
|
@@ -642,6 +664,7 @@ module Anthropic
|
|
|
642
664
|
Anthropic::Beta::BetaCodeExecutionTool20250522,
|
|
643
665
|
Anthropic::Beta::BetaCodeExecutionTool20250825,
|
|
644
666
|
Anthropic::Beta::BetaToolComputerUse20241022,
|
|
667
|
+
Anthropic::Beta::BetaMemoryTool20250818,
|
|
645
668
|
Anthropic::Beta::BetaToolComputerUse20250124,
|
|
646
669
|
Anthropic::Beta::BetaToolTextEditor20241022,
|
|
647
670
|
Anthropic::Beta::BetaToolTextEditor20250124,
|
|
@@ -103,6 +103,18 @@ module Anthropic
|
|
|
103
103
|
sig { returns(T.nilable(String)) }
|
|
104
104
|
attr_accessor :container
|
|
105
105
|
|
|
106
|
+
# Configuration for context management operations.
|
|
107
|
+
sig { returns(T.nilable(Anthropic::Beta::BetaContextManagementConfig)) }
|
|
108
|
+
attr_reader :context_management
|
|
109
|
+
|
|
110
|
+
sig do
|
|
111
|
+
params(
|
|
112
|
+
context_management:
|
|
113
|
+
T.nilable(Anthropic::Beta::BetaContextManagementConfig::OrHash)
|
|
114
|
+
).void
|
|
115
|
+
end
|
|
116
|
+
attr_writer :context_management
|
|
117
|
+
|
|
106
118
|
# MCP servers to be utilized in this request
|
|
107
119
|
sig do
|
|
108
120
|
returns(
|
|
@@ -347,6 +359,7 @@ module Anthropic
|
|
|
347
359
|
Anthropic::Beta::BetaCodeExecutionTool20250522,
|
|
348
360
|
Anthropic::Beta::BetaCodeExecutionTool20250825,
|
|
349
361
|
Anthropic::Beta::BetaToolComputerUse20241022,
|
|
362
|
+
Anthropic::Beta::BetaMemoryTool20250818,
|
|
350
363
|
Anthropic::Beta::BetaToolComputerUse20250124,
|
|
351
364
|
Anthropic::Beta::BetaToolTextEditor20241022,
|
|
352
365
|
Anthropic::Beta::BetaToolTextEditor20250124,
|
|
@@ -372,6 +385,7 @@ module Anthropic
|
|
|
372
385
|
Anthropic::Beta::BetaCodeExecutionTool20250522::OrHash,
|
|
373
386
|
Anthropic::Beta::BetaCodeExecutionTool20250825::OrHash,
|
|
374
387
|
Anthropic::Beta::BetaToolComputerUse20241022::OrHash,
|
|
388
|
+
Anthropic::Beta::BetaMemoryTool20250818::OrHash,
|
|
375
389
|
Anthropic::Beta::BetaToolComputerUse20250124::OrHash,
|
|
376
390
|
Anthropic::Beta::BetaToolTextEditor20241022::OrHash,
|
|
377
391
|
Anthropic::Beta::BetaToolTextEditor20250124::OrHash,
|
|
@@ -436,6 +450,8 @@ module Anthropic
|
|
|
436
450
|
messages: T::Array[Anthropic::Beta::BetaMessageParam::OrHash],
|
|
437
451
|
model: T.any(Anthropic::Model::OrSymbol, String),
|
|
438
452
|
container: T.nilable(String),
|
|
453
|
+
context_management:
|
|
454
|
+
T.nilable(Anthropic::Beta::BetaContextManagementConfig::OrHash),
|
|
439
455
|
mcp_servers:
|
|
440
456
|
T::Array[
|
|
441
457
|
Anthropic::Beta::BetaRequestMCPServerURLDefinition::OrHash
|
|
@@ -467,6 +483,7 @@ module Anthropic
|
|
|
467
483
|
Anthropic::Beta::BetaCodeExecutionTool20250522::OrHash,
|
|
468
484
|
Anthropic::Beta::BetaCodeExecutionTool20250825::OrHash,
|
|
469
485
|
Anthropic::Beta::BetaToolComputerUse20241022::OrHash,
|
|
486
|
+
Anthropic::Beta::BetaMemoryTool20250818::OrHash,
|
|
470
487
|
Anthropic::Beta::BetaToolComputerUse20250124::OrHash,
|
|
471
488
|
Anthropic::Beta::BetaToolTextEditor20241022::OrHash,
|
|
472
489
|
Anthropic::Beta::BetaToolTextEditor20250124::OrHash,
|
|
@@ -563,6 +580,8 @@ module Anthropic
|
|
|
563
580
|
model:,
|
|
564
581
|
# Container identifier for reuse across requests.
|
|
565
582
|
container: nil,
|
|
583
|
+
# Configuration for context management operations.
|
|
584
|
+
context_management: nil,
|
|
566
585
|
# MCP servers to be utilized in this request
|
|
567
586
|
mcp_servers: nil,
|
|
568
587
|
# An object describing metadata about the request.
|
|
@@ -718,6 +737,8 @@ module Anthropic
|
|
|
718
737
|
messages: T::Array[Anthropic::Beta::BetaMessageParam],
|
|
719
738
|
model: T.any(Anthropic::Model::OrSymbol, String),
|
|
720
739
|
container: T.nilable(String),
|
|
740
|
+
context_management:
|
|
741
|
+
T.nilable(Anthropic::Beta::BetaContextManagementConfig),
|
|
721
742
|
mcp_servers:
|
|
722
743
|
T::Array[Anthropic::Beta::BetaRequestMCPServerURLDefinition],
|
|
723
744
|
metadata: Anthropic::Beta::BetaMetadata,
|
|
@@ -747,6 +768,7 @@ module Anthropic
|
|
|
747
768
|
Anthropic::Beta::BetaCodeExecutionTool20250522,
|
|
748
769
|
Anthropic::Beta::BetaCodeExecutionTool20250825,
|
|
749
770
|
Anthropic::Beta::BetaToolComputerUse20241022,
|
|
771
|
+
Anthropic::Beta::BetaMemoryTool20250818,
|
|
750
772
|
Anthropic::Beta::BetaToolComputerUse20250124,
|
|
751
773
|
Anthropic::Beta::BetaToolTextEditor20241022,
|
|
752
774
|
Anthropic::Beta::BetaToolTextEditor20250124,
|