anthropic 1.9.0 → 1.10.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 +28 -0
- data/README.md +12 -12
- data/lib/anthropic/errors.rb +25 -11
- data/lib/anthropic/internal/page.rb +1 -1
- data/lib/anthropic/internal/stream.rb +1 -0
- data/lib/anthropic/internal/transport/base_client.rb +11 -7
- data/lib/anthropic/internal/type/base_page.rb +1 -1
- data/lib/anthropic/internal/type/base_stream.rb +9 -1
- data/lib/anthropic/internal/util.rb +2 -1
- 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/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 +16 -1
- data/rbi/anthropic/internal/util.rbi +1 -1
- 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/internal/type/base_stream.rbs +5 -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
@@ -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,
|
@@ -244,6 +244,22 @@ module Anthropic
|
|
244
244
|
sig { returns(T.nilable(String)) }
|
245
245
|
attr_accessor :container
|
246
246
|
|
247
|
+
# Configuration for context management operations.
|
248
|
+
sig do
|
249
|
+
returns(T.nilable(Anthropic::Beta::BetaContextManagementConfig))
|
250
|
+
end
|
251
|
+
attr_reader :context_management
|
252
|
+
|
253
|
+
sig do
|
254
|
+
params(
|
255
|
+
context_management:
|
256
|
+
T.nilable(
|
257
|
+
Anthropic::Beta::BetaContextManagementConfig::OrHash
|
258
|
+
)
|
259
|
+
).void
|
260
|
+
end
|
261
|
+
attr_writer :context_management
|
262
|
+
|
247
263
|
# MCP servers to be utilized in this request
|
248
264
|
sig do
|
249
265
|
returns(
|
@@ -503,6 +519,7 @@ module Anthropic
|
|
503
519
|
Anthropic::Beta::BetaCodeExecutionTool20250522,
|
504
520
|
Anthropic::Beta::BetaCodeExecutionTool20250825,
|
505
521
|
Anthropic::Beta::BetaToolComputerUse20241022,
|
522
|
+
Anthropic::Beta::BetaMemoryTool20250818,
|
506
523
|
Anthropic::Beta::BetaToolComputerUse20250124,
|
507
524
|
Anthropic::Beta::BetaToolTextEditor20241022,
|
508
525
|
Anthropic::Beta::BetaToolTextEditor20250124,
|
@@ -528,6 +545,7 @@ module Anthropic
|
|
528
545
|
Anthropic::Beta::BetaCodeExecutionTool20250522::OrHash,
|
529
546
|
Anthropic::Beta::BetaCodeExecutionTool20250825::OrHash,
|
530
547
|
Anthropic::Beta::BetaToolComputerUse20241022::OrHash,
|
548
|
+
Anthropic::Beta::BetaMemoryTool20250818::OrHash,
|
531
549
|
Anthropic::Beta::BetaToolComputerUse20250124::OrHash,
|
532
550
|
Anthropic::Beta::BetaToolTextEditor20241022::OrHash,
|
533
551
|
Anthropic::Beta::BetaToolTextEditor20250124::OrHash,
|
@@ -579,6 +597,10 @@ module Anthropic
|
|
579
597
|
messages: T::Array[Anthropic::Beta::BetaMessageParam::OrHash],
|
580
598
|
model: T.any(Anthropic::Model::OrSymbol, String),
|
581
599
|
container: T.nilable(String),
|
600
|
+
context_management:
|
601
|
+
T.nilable(
|
602
|
+
Anthropic::Beta::BetaContextManagementConfig::OrHash
|
603
|
+
),
|
582
604
|
mcp_servers:
|
583
605
|
T::Array[
|
584
606
|
Anthropic::Beta::BetaRequestMCPServerURLDefinition::OrHash
|
@@ -612,6 +634,7 @@ module Anthropic
|
|
612
634
|
Anthropic::Beta::BetaCodeExecutionTool20250522::OrHash,
|
613
635
|
Anthropic::Beta::BetaCodeExecutionTool20250825::OrHash,
|
614
636
|
Anthropic::Beta::BetaToolComputerUse20241022::OrHash,
|
637
|
+
Anthropic::Beta::BetaMemoryTool20250818::OrHash,
|
615
638
|
Anthropic::Beta::BetaToolComputerUse20250124::OrHash,
|
616
639
|
Anthropic::Beta::BetaToolTextEditor20241022::OrHash,
|
617
640
|
Anthropic::Beta::BetaToolTextEditor20250124::OrHash,
|
@@ -706,6 +729,8 @@ module Anthropic
|
|
706
729
|
model:,
|
707
730
|
# Container identifier for reuse across requests.
|
708
731
|
container: nil,
|
732
|
+
# Configuration for context management operations.
|
733
|
+
context_management: nil,
|
709
734
|
# MCP servers to be utilized in this request
|
710
735
|
mcp_servers: nil,
|
711
736
|
# An object describing metadata about the request.
|
@@ -863,6 +888,8 @@ module Anthropic
|
|
863
888
|
messages: T::Array[Anthropic::Beta::BetaMessageParam],
|
864
889
|
model: T.any(Anthropic::Model::OrSymbol, String),
|
865
890
|
container: T.nilable(String),
|
891
|
+
context_management:
|
892
|
+
T.nilable(Anthropic::Beta::BetaContextManagementConfig),
|
866
893
|
mcp_servers:
|
867
894
|
T::Array[
|
868
895
|
Anthropic::Beta::BetaRequestMCPServerURLDefinition
|
@@ -896,6 +923,7 @@ module Anthropic
|
|
896
923
|
Anthropic::Beta::BetaCodeExecutionTool20250522,
|
897
924
|
Anthropic::Beta::BetaCodeExecutionTool20250825,
|
898
925
|
Anthropic::Beta::BetaToolComputerUse20241022,
|
926
|
+
Anthropic::Beta::BetaMemoryTool20250818,
|
899
927
|
Anthropic::Beta::BetaToolComputerUse20250124,
|
900
928
|
Anthropic::Beta::BetaToolTextEditor20241022,
|
901
929
|
Anthropic::Beta::BetaToolTextEditor20250124,
|
@@ -45,6 +45,14 @@ module Anthropic
|
|
45
45
|
CLAUDE_4_SONNET_20250514 =
|
46
46
|
T.let(:"claude-4-sonnet-20250514", Anthropic::Model::TaggedSymbol)
|
47
47
|
|
48
|
+
# Our best model for real-world agents and coding
|
49
|
+
CLAUDE_SONNET_4_5 =
|
50
|
+
T.let(:"claude-sonnet-4-5", Anthropic::Model::TaggedSymbol)
|
51
|
+
|
52
|
+
# Our best model for real-world agents and coding
|
53
|
+
CLAUDE_SONNET_4_5_20250929 =
|
54
|
+
T.let(:"claude-sonnet-4-5-20250929", Anthropic::Model::TaggedSymbol)
|
55
|
+
|
48
56
|
# Our previous most intelligent model
|
49
57
|
CLAUDE_3_5_SONNET_LATEST =
|
50
58
|
T.let(:"claude-3-5-sonnet-latest", Anthropic::Model::TaggedSymbol)
|
@@ -14,6 +14,11 @@ module Anthropic
|
|
14
14
|
TOOL_USE = T.let(:tool_use, Anthropic::StopReason::TaggedSymbol)
|
15
15
|
PAUSE_TURN = T.let(:pause_turn, Anthropic::StopReason::TaggedSymbol)
|
16
16
|
REFUSAL = T.let(:refusal, Anthropic::StopReason::TaggedSymbol)
|
17
|
+
MODEL_CONTEXT_WINDOW_EXCEEDED =
|
18
|
+
T.let(
|
19
|
+
:model_context_window_exceeded,
|
20
|
+
Anthropic::StopReason::TaggedSymbol
|
21
|
+
)
|
17
22
|
|
18
23
|
sig { override.returns(T::Array[Anthropic::StopReason::TaggedSymbol]) }
|
19
24
|
def self.values
|
@@ -22,6 +22,8 @@ module Anthropic
|
|
22
22
|
messages: T::Array[Anthropic::Beta::BetaMessageParam::OrHash],
|
23
23
|
model: T.any(Anthropic::Model::OrSymbol, String),
|
24
24
|
container: T.nilable(String),
|
25
|
+
context_management:
|
26
|
+
T.nilable(Anthropic::Beta::BetaContextManagementConfig::OrHash),
|
25
27
|
mcp_servers:
|
26
28
|
T::Array[
|
27
29
|
Anthropic::Beta::BetaRequestMCPServerURLDefinition::OrHash
|
@@ -53,6 +55,7 @@ module Anthropic
|
|
53
55
|
Anthropic::Beta::BetaCodeExecutionTool20250522::OrHash,
|
54
56
|
Anthropic::Beta::BetaCodeExecutionTool20250825::OrHash,
|
55
57
|
Anthropic::Beta::BetaToolComputerUse20241022::OrHash,
|
58
|
+
Anthropic::Beta::BetaMemoryTool20250818::OrHash,
|
56
59
|
Anthropic::Beta::BetaToolComputerUse20250124::OrHash,
|
57
60
|
Anthropic::Beta::BetaToolTextEditor20241022::OrHash,
|
58
61
|
Anthropic::Beta::BetaToolTextEditor20250124::OrHash,
|
@@ -150,6 +153,8 @@ module Anthropic
|
|
150
153
|
model:,
|
151
154
|
# Body param: Container identifier for reuse across requests.
|
152
155
|
container: nil,
|
156
|
+
# Body param: Configuration for context management operations.
|
157
|
+
context_management: nil,
|
153
158
|
# Body param: MCP servers to be utilized in this request
|
154
159
|
mcp_servers: nil,
|
155
160
|
# Body param: An object describing metadata about the request.
|
@@ -316,6 +321,8 @@ module Anthropic
|
|
316
321
|
messages: T::Array[Anthropic::Beta::BetaMessageParam::OrHash],
|
317
322
|
model: T.any(Anthropic::Model::OrSymbol, String),
|
318
323
|
container: T.nilable(String),
|
324
|
+
context_management:
|
325
|
+
T.nilable(Anthropic::Beta::BetaContextManagementConfig::OrHash),
|
319
326
|
mcp_servers:
|
320
327
|
T::Array[
|
321
328
|
Anthropic::Beta::BetaRequestMCPServerURLDefinition::OrHash
|
@@ -347,6 +354,7 @@ module Anthropic
|
|
347
354
|
Anthropic::Beta::BetaCodeExecutionTool20250522::OrHash,
|
348
355
|
Anthropic::Beta::BetaCodeExecutionTool20250825::OrHash,
|
349
356
|
Anthropic::Beta::BetaToolComputerUse20241022::OrHash,
|
357
|
+
Anthropic::Beta::BetaMemoryTool20250818::OrHash,
|
350
358
|
Anthropic::Beta::BetaToolComputerUse20250124::OrHash,
|
351
359
|
Anthropic::Beta::BetaToolTextEditor20241022::OrHash,
|
352
360
|
Anthropic::Beta::BetaToolTextEditor20250124::OrHash,
|
@@ -448,6 +456,8 @@ module Anthropic
|
|
448
456
|
model:,
|
449
457
|
# Body param: Container identifier for reuse across requests.
|
450
458
|
container: nil,
|
459
|
+
# Body param: Configuration for context management operations.
|
460
|
+
context_management: nil,
|
451
461
|
# Body param: MCP servers to be utilized in this request
|
452
462
|
mcp_servers: nil,
|
453
463
|
# Body param: An object describing metadata about the request.
|
@@ -610,6 +620,8 @@ module Anthropic
|
|
610
620
|
params(
|
611
621
|
messages: T::Array[Anthropic::Beta::BetaMessageParam::OrHash],
|
612
622
|
model: T.any(Anthropic::Model::OrSymbol, String),
|
623
|
+
context_management:
|
624
|
+
T.nilable(Anthropic::Beta::BetaContextManagementConfig::OrHash),
|
613
625
|
mcp_servers:
|
614
626
|
T::Array[
|
615
627
|
Anthropic::Beta::BetaRequestMCPServerURLDefinition::OrHash
|
@@ -637,6 +649,7 @@ module Anthropic
|
|
637
649
|
Anthropic::Beta::BetaCodeExecutionTool20250522::OrHash,
|
638
650
|
Anthropic::Beta::BetaCodeExecutionTool20250825::OrHash,
|
639
651
|
Anthropic::Beta::BetaToolComputerUse20241022::OrHash,
|
652
|
+
Anthropic::Beta::BetaMemoryTool20250818::OrHash,
|
640
653
|
Anthropic::Beta::BetaToolComputerUse20250124::OrHash,
|
641
654
|
Anthropic::Beta::BetaToolTextEditor20241022::OrHash,
|
642
655
|
Anthropic::Beta::BetaToolTextEditor20250124::OrHash,
|
@@ -721,6 +734,8 @@ module Anthropic
|
|
721
734
|
# [models](https://docs.anthropic.com/en/docs/models-overview) for additional
|
722
735
|
# details and options.
|
723
736
|
model:,
|
737
|
+
# Body param: Configuration for context management operations.
|
738
|
+
context_management: nil,
|
724
739
|
# Body param: MCP servers to be utilized in this request
|
725
740
|
mcp_servers: nil,
|
726
741
|
# Body param: System prompt.
|
data/sig/anthropic/errors.rbs
CHANGED
@@ -21,11 +21,14 @@ module Anthropic
|
|
21
21
|
|
22
22
|
attr_accessor status: Integer?
|
23
23
|
|
24
|
+
attr_accessor headers: ::Hash[String, String]?
|
25
|
+
|
24
26
|
attr_accessor body: top?
|
25
27
|
|
26
28
|
def initialize: (
|
27
29
|
url: URI::Generic,
|
28
30
|
?status: Integer?,
|
31
|
+
?headers: ::Hash[String, String]?,
|
29
32
|
?body: Object?,
|
30
33
|
?request: nil,
|
31
34
|
?response: nil,
|
@@ -37,6 +40,7 @@ module Anthropic
|
|
37
40
|
def initialize: (
|
38
41
|
url: URI::Generic,
|
39
42
|
?status: nil,
|
43
|
+
?headers: ::Hash[String, String]?,
|
40
44
|
?body: nil,
|
41
45
|
?request: nil,
|
42
46
|
?response: nil,
|
@@ -48,6 +52,7 @@ module Anthropic
|
|
48
52
|
def initialize: (
|
49
53
|
url: URI::Generic,
|
50
54
|
?status: nil,
|
55
|
+
?headers: ::Hash[String, String]?,
|
51
56
|
?body: nil,
|
52
57
|
?request: nil,
|
53
58
|
?response: nil,
|
@@ -59,6 +64,7 @@ module Anthropic
|
|
59
64
|
def self.for: (
|
60
65
|
url: URI::Generic,
|
61
66
|
status: Integer,
|
67
|
+
headers: ::Hash[String, String]?,
|
62
68
|
body: Object?,
|
63
69
|
request: nil,
|
64
70
|
response: nil,
|
@@ -68,6 +74,7 @@ module Anthropic
|
|
68
74
|
def initialize: (
|
69
75
|
url: URI::Generic,
|
70
76
|
status: Integer,
|
77
|
+
headers: ::Hash[String, String]?,
|
71
78
|
body: Object?,
|
72
79
|
request: nil,
|
73
80
|
response: nil,
|
@@ -8,6 +8,10 @@ module Anthropic
|
|
8
8
|
Enumerable[top] stream
|
9
9
|
) -> (^(Integer arg0) -> void)
|
10
10
|
|
11
|
+
attr_reader status: Integer
|
12
|
+
|
13
|
+
attr_reader headers: ::Hash[String, String]
|
14
|
+
|
11
15
|
def close: -> void
|
12
16
|
|
13
17
|
private def iterator: -> Enumerable[Elem]
|
@@ -22,6 +26,7 @@ module Anthropic
|
|
22
26
|
model: Class | Anthropic::Internal::Type::Converter,
|
23
27
|
url: URI::Generic,
|
24
28
|
status: Integer,
|
29
|
+
headers: ::Hash[String, String],
|
25
30
|
response: top,
|
26
31
|
unwrap: Symbol
|
27
32
|
| Integer
|