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.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +28 -0
  3. data/README.md +12 -12
  4. data/lib/anthropic/errors.rb +25 -11
  5. data/lib/anthropic/internal/page.rb +1 -1
  6. data/lib/anthropic/internal/stream.rb +1 -0
  7. data/lib/anthropic/internal/transport/base_client.rb +11 -7
  8. data/lib/anthropic/internal/type/base_page.rb +1 -1
  9. data/lib/anthropic/internal/type/base_stream.rb +9 -1
  10. data/lib/anthropic/internal/util.rb +2 -1
  11. data/lib/anthropic/models/beta/beta_clear_tool_uses_20250919_edit.rb +98 -0
  12. data/lib/anthropic/models/beta/beta_clear_tool_uses_20250919_edit_response.rb +38 -0
  13. data/lib/anthropic/models/beta/beta_context_management_config.rb +22 -0
  14. data/lib/anthropic/models/beta/beta_context_management_response.rb +23 -0
  15. data/lib/anthropic/models/beta/beta_count_tokens_context_management_response.rb +20 -0
  16. data/lib/anthropic/models/beta/beta_input_tokens_clear_at_least.rb +25 -0
  17. data/lib/anthropic/models/beta/beta_input_tokens_trigger.rb +25 -0
  18. data/lib/anthropic/models/beta/beta_memory_tool_20250818.rb +40 -0
  19. data/lib/anthropic/models/beta/beta_memory_tool_20250818_command.rb +30 -0
  20. data/lib/anthropic/models/beta/beta_memory_tool_20250818_create_command.rb +36 -0
  21. data/lib/anthropic/models/beta/beta_memory_tool_20250818_delete_command.rb +28 -0
  22. data/lib/anthropic/models/beta/beta_memory_tool_20250818_insert_command.rb +44 -0
  23. data/lib/anthropic/models/beta/beta_memory_tool_20250818_rename_command.rb +36 -0
  24. data/lib/anthropic/models/beta/beta_memory_tool_20250818_str_replace_command.rb +44 -0
  25. data/lib/anthropic/models/beta/beta_memory_tool_20250818_view_command.rb +36 -0
  26. data/lib/anthropic/models/beta/beta_message.rb +9 -1
  27. data/lib/anthropic/models/beta/beta_message_tokens_count.rb +13 -1
  28. data/lib/anthropic/models/beta/beta_raw_message_delta_event.rb +9 -1
  29. data/lib/anthropic/models/beta/beta_stop_reason.rb +1 -0
  30. data/lib/anthropic/models/beta/beta_tool_union.rb +3 -1
  31. data/lib/anthropic/models/beta/beta_tool_uses_keep.rb +25 -0
  32. data/lib/anthropic/models/beta/beta_tool_uses_trigger.rb +25 -0
  33. data/lib/anthropic/models/beta/message_count_tokens_params.rb +14 -4
  34. data/lib/anthropic/models/beta/message_create_params.rb +11 -3
  35. data/lib/anthropic/models/beta/messages/batch_create_params.rb +11 -3
  36. data/lib/anthropic/models/model.rb +10 -0
  37. data/lib/anthropic/models/stop_reason.rb +1 -0
  38. data/lib/anthropic/resources/beta/messages.rb +12 -6
  39. data/lib/anthropic/version.rb +1 -1
  40. data/lib/anthropic.rb +17 -0
  41. data/rbi/anthropic/errors.rbi +29 -2
  42. data/rbi/anthropic/internal/transport/base_client.rbi +4 -5
  43. data/rbi/anthropic/internal/type/base_page.rbi +1 -1
  44. data/rbi/anthropic/internal/type/base_stream.rbi +16 -1
  45. data/rbi/anthropic/internal/util.rbi +1 -1
  46. data/rbi/anthropic/models/beta/beta_clear_tool_uses_20250919_edit.rbi +183 -0
  47. data/rbi/anthropic/models/beta/beta_clear_tool_uses_20250919_edit_response.rbi +62 -0
  48. data/rbi/anthropic/models/beta/beta_context_management_config.rbi +56 -0
  49. data/rbi/anthropic/models/beta/beta_context_management_response.rbi +53 -0
  50. data/rbi/anthropic/models/beta/beta_count_tokens_context_management_response.rbi +35 -0
  51. data/rbi/anthropic/models/beta/beta_input_tokens_clear_at_least.rbi +33 -0
  52. data/rbi/anthropic/models/beta/beta_input_tokens_trigger.rbi +33 -0
  53. data/rbi/anthropic/models/beta/beta_memory_tool_20250818.rbi +72 -0
  54. data/rbi/anthropic/models/beta/beta_memory_tool_20250818_command.rbi +33 -0
  55. data/rbi/anthropic/models/beta/beta_memory_tool_20250818_create_command.rbi +53 -0
  56. data/rbi/anthropic/models/beta/beta_memory_tool_20250818_delete_command.rbi +41 -0
  57. data/rbi/anthropic/models/beta/beta_memory_tool_20250818_insert_command.rbi +69 -0
  58. data/rbi/anthropic/models/beta/beta_memory_tool_20250818_rename_command.rbi +55 -0
  59. data/rbi/anthropic/models/beta/beta_memory_tool_20250818_str_replace_command.rbi +64 -0
  60. data/rbi/anthropic/models/beta/beta_memory_tool_20250818_view_command.rbi +59 -0
  61. data/rbi/anthropic/models/beta/beta_message.rbi +20 -0
  62. data/rbi/anthropic/models/beta/beta_message_tokens_count.rbi +40 -2
  63. data/rbi/anthropic/models/beta/beta_raw_message_delta_event.rbi +20 -0
  64. data/rbi/anthropic/models/beta/beta_stop_reason.rbi +5 -0
  65. data/rbi/anthropic/models/beta/beta_tool_union.rbi +1 -0
  66. data/rbi/anthropic/models/beta/beta_tool_uses_keep.rbi +33 -0
  67. data/rbi/anthropic/models/beta/beta_tool_uses_trigger.rbi +33 -0
  68. data/rbi/anthropic/models/beta/message_count_tokens_params.rbi +23 -0
  69. data/rbi/anthropic/models/beta/message_create_params.rbi +22 -0
  70. data/rbi/anthropic/models/beta/messages/batch_create_params.rbi +28 -0
  71. data/rbi/anthropic/models/model.rbi +8 -0
  72. data/rbi/anthropic/models/stop_reason.rbi +5 -0
  73. data/rbi/anthropic/resources/beta/messages.rbi +15 -0
  74. data/sig/anthropic/errors.rbs +7 -0
  75. data/sig/anthropic/internal/type/base_stream.rbs +5 -0
  76. data/sig/anthropic/models/beta/beta_clear_tool_uses_20250919_edit.rbs +77 -0
  77. data/sig/anthropic/models/beta/beta_clear_tool_uses_20250919_edit_response.rbs +34 -0
  78. data/sig/anthropic/models/beta/beta_context_management_config.rbs +26 -0
  79. data/sig/anthropic/models/beta/beta_context_management_response.rbs +24 -0
  80. data/sig/anthropic/models/beta/beta_count_tokens_context_management_response.rbs +18 -0
  81. data/sig/anthropic/models/beta/beta_input_tokens_clear_at_least.rbs +20 -0
  82. data/sig/anthropic/models/beta/beta_input_tokens_trigger.rbs +19 -0
  83. data/sig/anthropic/models/beta/beta_memory_tool_20250818.rbs +34 -0
  84. data/sig/anthropic/models/beta/beta_memory_tool_20250818_command.rbs +21 -0
  85. data/sig/anthropic/models/beta/beta_memory_tool_20250818_create_command.rbs +26 -0
  86. data/sig/anthropic/models/beta/beta_memory_tool_20250818_delete_command.rbs +20 -0
  87. data/sig/anthropic/models/beta/beta_memory_tool_20250818_insert_command.rbs +39 -0
  88. data/sig/anthropic/models/beta/beta_memory_tool_20250818_rename_command.rbs +26 -0
  89. data/sig/anthropic/models/beta/beta_memory_tool_20250818_str_replace_command.rbs +39 -0
  90. data/sig/anthropic/models/beta/beta_memory_tool_20250818_view_command.rbs +32 -0
  91. data/sig/anthropic/models/beta/beta_message.rbs +5 -0
  92. data/sig/anthropic/models/beta/beta_message_tokens_count.rbs +15 -3
  93. data/sig/anthropic/models/beta/beta_raw_message_delta_event.rbs +5 -0
  94. data/sig/anthropic/models/beta/beta_stop_reason.rbs +2 -0
  95. data/sig/anthropic/models/beta/beta_tool_union.rbs +1 -0
  96. data/sig/anthropic/models/beta/beta_tool_uses_keep.rbs +19 -0
  97. data/sig/anthropic/models/beta/beta_tool_uses_trigger.rbs +19 -0
  98. data/sig/anthropic/models/beta/message_count_tokens_params.rbs +6 -0
  99. data/sig/anthropic/models/beta/message_create_params.rbs +5 -0
  100. data/sig/anthropic/models/beta/messages/batch_create_params.rbs +5 -0
  101. data/sig/anthropic/models/model.rbs +8 -0
  102. data/sig/anthropic/models/stop_reason.rbs +2 -0
  103. data/sig/anthropic/resources/beta/messages.rbs +3 -0
  104. metadata +53 -2
@@ -0,0 +1,77 @@
1
+ module Anthropic
2
+ module Models
3
+ class BetaClearToolUses20250919Edit = Beta::BetaClearToolUses20250919Edit
4
+
5
+ module Beta
6
+ type beta_clear_tool_uses20250919_edit =
7
+ {
8
+ type: :clear_tool_uses_20250919,
9
+ clear_at_least: Anthropic::Beta::BetaInputTokensClearAtLeast?,
10
+ clear_tool_inputs: Anthropic::Models::Beta::BetaClearToolUses20250919Edit::clear_tool_inputs?,
11
+ exclude_tools: ::Array[String]?,
12
+ keep: Anthropic::Beta::BetaToolUsesKeep,
13
+ trigger: Anthropic::Models::Beta::BetaClearToolUses20250919Edit::trigger
14
+ }
15
+
16
+ class BetaClearToolUses20250919Edit < Anthropic::Internal::Type::BaseModel
17
+ attr_accessor type: :clear_tool_uses_20250919
18
+
19
+ attr_accessor clear_at_least: Anthropic::Beta::BetaInputTokensClearAtLeast?
20
+
21
+ attr_accessor clear_tool_inputs: Anthropic::Models::Beta::BetaClearToolUses20250919Edit::clear_tool_inputs?
22
+
23
+ attr_accessor exclude_tools: ::Array[String]?
24
+
25
+ attr_reader keep: Anthropic::Beta::BetaToolUsesKeep?
26
+
27
+ def keep=: (
28
+ Anthropic::Beta::BetaToolUsesKeep
29
+ ) -> Anthropic::Beta::BetaToolUsesKeep
30
+
31
+ attr_reader trigger: Anthropic::Models::Beta::BetaClearToolUses20250919Edit::trigger?
32
+
33
+ def trigger=: (
34
+ Anthropic::Models::Beta::BetaClearToolUses20250919Edit::trigger
35
+ ) -> Anthropic::Models::Beta::BetaClearToolUses20250919Edit::trigger
36
+
37
+ def initialize: (
38
+ ?clear_at_least: Anthropic::Beta::BetaInputTokensClearAtLeast?,
39
+ ?clear_tool_inputs: Anthropic::Models::Beta::BetaClearToolUses20250919Edit::clear_tool_inputs?,
40
+ ?exclude_tools: ::Array[String]?,
41
+ ?keep: Anthropic::Beta::BetaToolUsesKeep,
42
+ ?trigger: Anthropic::Models::Beta::BetaClearToolUses20250919Edit::trigger,
43
+ ?type: :clear_tool_uses_20250919
44
+ ) -> void
45
+
46
+ def to_hash: -> {
47
+ type: :clear_tool_uses_20250919,
48
+ clear_at_least: Anthropic::Beta::BetaInputTokensClearAtLeast?,
49
+ clear_tool_inputs: Anthropic::Models::Beta::BetaClearToolUses20250919Edit::clear_tool_inputs?,
50
+ exclude_tools: ::Array[String]?,
51
+ keep: Anthropic::Beta::BetaToolUsesKeep,
52
+ trigger: Anthropic::Models::Beta::BetaClearToolUses20250919Edit::trigger
53
+ }
54
+
55
+ type clear_tool_inputs = bool | ::Array[String]
56
+
57
+ module ClearToolInputs
58
+ extend Anthropic::Internal::Type::Union
59
+
60
+ def self?.variants: -> ::Array[Anthropic::Models::Beta::BetaClearToolUses20250919Edit::clear_tool_inputs]
61
+
62
+ StringArray: Anthropic::Internal::Type::Converter
63
+ end
64
+
65
+ type trigger =
66
+ Anthropic::Beta::BetaInputTokensTrigger
67
+ | Anthropic::Beta::BetaToolUsesTrigger
68
+
69
+ module Trigger
70
+ extend Anthropic::Internal::Type::Union
71
+
72
+ def self?.variants: -> ::Array[Anthropic::Models::Beta::BetaClearToolUses20250919Edit::trigger]
73
+ end
74
+ end
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,34 @@
1
+ module Anthropic
2
+ module Models
3
+ class BetaClearToolUses20250919EditResponse = Beta::BetaClearToolUses20250919EditResponse
4
+
5
+ module Beta
6
+ type beta_clear_tool_uses20250919_edit_response =
7
+ {
8
+ cleared_input_tokens: Integer,
9
+ cleared_tool_uses: Integer,
10
+ type: :clear_tool_uses_20250919
11
+ }
12
+
13
+ class BetaClearToolUses20250919EditResponse < Anthropic::Internal::Type::BaseModel
14
+ attr_accessor cleared_input_tokens: Integer
15
+
16
+ attr_accessor cleared_tool_uses: Integer
17
+
18
+ attr_accessor type: :clear_tool_uses_20250919
19
+
20
+ def initialize: (
21
+ cleared_input_tokens: Integer,
22
+ cleared_tool_uses: Integer,
23
+ ?type: :clear_tool_uses_20250919
24
+ ) -> void
25
+
26
+ def to_hash: -> {
27
+ cleared_input_tokens: Integer,
28
+ cleared_tool_uses: Integer,
29
+ type: :clear_tool_uses_20250919
30
+ }
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,26 @@
1
+ module Anthropic
2
+ module Models
3
+ class BetaContextManagementConfig = Beta::BetaContextManagementConfig
4
+
5
+ module Beta
6
+ type beta_context_management_config =
7
+ { edits: ::Array[Anthropic::Beta::BetaClearToolUses20250919Edit] }
8
+
9
+ class BetaContextManagementConfig < Anthropic::Internal::Type::BaseModel
10
+ attr_reader edits: ::Array[Anthropic::Beta::BetaClearToolUses20250919Edit]?
11
+
12
+ def edits=: (
13
+ ::Array[Anthropic::Beta::BetaClearToolUses20250919Edit]
14
+ ) -> ::Array[Anthropic::Beta::BetaClearToolUses20250919Edit]
15
+
16
+ def initialize: (
17
+ ?edits: ::Array[Anthropic::Beta::BetaClearToolUses20250919Edit]
18
+ ) -> void
19
+
20
+ def to_hash: -> {
21
+ edits: ::Array[Anthropic::Beta::BetaClearToolUses20250919Edit]
22
+ }
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,24 @@
1
+ module Anthropic
2
+ module Models
3
+ class BetaContextManagementResponse = Beta::BetaContextManagementResponse
4
+
5
+ module Beta
6
+ type beta_context_management_response =
7
+ {
8
+ applied_edits: ::Array[Anthropic::Beta::BetaClearToolUses20250919EditResponse]
9
+ }
10
+
11
+ class BetaContextManagementResponse < Anthropic::Internal::Type::BaseModel
12
+ attr_accessor applied_edits: ::Array[Anthropic::Beta::BetaClearToolUses20250919EditResponse]
13
+
14
+ def initialize: (
15
+ applied_edits: ::Array[Anthropic::Beta::BetaClearToolUses20250919EditResponse]
16
+ ) -> void
17
+
18
+ def to_hash: -> {
19
+ applied_edits: ::Array[Anthropic::Beta::BetaClearToolUses20250919EditResponse]
20
+ }
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,18 @@
1
+ module Anthropic
2
+ module Models
3
+ class BetaCountTokensContextManagementResponse = Beta::BetaCountTokensContextManagementResponse
4
+
5
+ module Beta
6
+ type beta_count_tokens_context_management_response =
7
+ { original_input_tokens: Integer }
8
+
9
+ class BetaCountTokensContextManagementResponse < Anthropic::Internal::Type::BaseModel
10
+ attr_accessor original_input_tokens: Integer
11
+
12
+ def initialize: (original_input_tokens: Integer) -> void
13
+
14
+ def to_hash: -> { original_input_tokens: Integer }
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,20 @@
1
+ module Anthropic
2
+ module Models
3
+ class BetaInputTokensClearAtLeast = Beta::BetaInputTokensClearAtLeast
4
+
5
+ module Beta
6
+ type beta_input_tokens_clear_at_least =
7
+ { type: :input_tokens, value: Integer }
8
+
9
+ class BetaInputTokensClearAtLeast < Anthropic::Internal::Type::BaseModel
10
+ attr_accessor type: :input_tokens
11
+
12
+ attr_accessor value: Integer
13
+
14
+ def initialize: (value: Integer, ?type: :input_tokens) -> void
15
+
16
+ def to_hash: -> { type: :input_tokens, value: Integer }
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,19 @@
1
+ module Anthropic
2
+ module Models
3
+ class BetaInputTokensTrigger = Beta::BetaInputTokensTrigger
4
+
5
+ module Beta
6
+ type beta_input_tokens_trigger = { type: :input_tokens, value: Integer }
7
+
8
+ class BetaInputTokensTrigger < Anthropic::Internal::Type::BaseModel
9
+ attr_accessor type: :input_tokens
10
+
11
+ attr_accessor value: Integer
12
+
13
+ def initialize: (value: Integer, ?type: :input_tokens) -> void
14
+
15
+ def to_hash: -> { type: :input_tokens, value: Integer }
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,34 @@
1
+ module Anthropic
2
+ module Models
3
+ class BetaMemoryTool20250818 = Beta::BetaMemoryTool20250818
4
+
5
+ module Beta
6
+ type beta_memory_tool20250818 =
7
+ {
8
+ name: :memory,
9
+ type: :memory_20250818,
10
+ cache_control: Anthropic::Beta::BetaCacheControlEphemeral?
11
+ }
12
+
13
+ class BetaMemoryTool20250818 < Anthropic::Internal::Type::BaseModel
14
+ attr_accessor name: :memory
15
+
16
+ attr_accessor type: :memory_20250818
17
+
18
+ attr_accessor cache_control: Anthropic::Beta::BetaCacheControlEphemeral?
19
+
20
+ def initialize: (
21
+ ?cache_control: Anthropic::Beta::BetaCacheControlEphemeral?,
22
+ ?name: :memory,
23
+ ?type: :memory_20250818
24
+ ) -> void
25
+
26
+ def to_hash: -> {
27
+ name: :memory,
28
+ type: :memory_20250818,
29
+ cache_control: Anthropic::Beta::BetaCacheControlEphemeral?
30
+ }
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,21 @@
1
+ module Anthropic
2
+ module Models
3
+ module BetaMemoryTool20250818Command = Beta::BetaMemoryTool20250818Command
4
+
5
+ module Beta
6
+ type beta_memory_tool20250818_command =
7
+ Anthropic::Beta::BetaMemoryTool20250818ViewCommand
8
+ | Anthropic::Beta::BetaMemoryTool20250818CreateCommand
9
+ | Anthropic::Beta::BetaMemoryTool20250818StrReplaceCommand
10
+ | Anthropic::Beta::BetaMemoryTool20250818InsertCommand
11
+ | Anthropic::Beta::BetaMemoryTool20250818DeleteCommand
12
+ | Anthropic::Beta::BetaMemoryTool20250818RenameCommand
13
+
14
+ module BetaMemoryTool20250818Command
15
+ extend Anthropic::Internal::Type::Union
16
+
17
+ def self?.variants: -> ::Array[Anthropic::Models::Beta::beta_memory_tool20250818_command]
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,26 @@
1
+ module Anthropic
2
+ module Models
3
+ class BetaMemoryTool20250818CreateCommand = Beta::BetaMemoryTool20250818CreateCommand
4
+
5
+ module Beta
6
+ type beta_memory_tool20250818_create_command =
7
+ { command: :create, file_text: String, path: String }
8
+
9
+ class BetaMemoryTool20250818CreateCommand < Anthropic::Internal::Type::BaseModel
10
+ attr_accessor command: :create
11
+
12
+ attr_accessor file_text: String
13
+
14
+ attr_accessor path: String
15
+
16
+ def initialize: (
17
+ file_text: String,
18
+ path: String,
19
+ ?command: :create
20
+ ) -> void
21
+
22
+ def to_hash: -> { command: :create, file_text: String, path: String }
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,20 @@
1
+ module Anthropic
2
+ module Models
3
+ class BetaMemoryTool20250818DeleteCommand = Beta::BetaMemoryTool20250818DeleteCommand
4
+
5
+ module Beta
6
+ type beta_memory_tool20250818_delete_command =
7
+ { command: :delete, path: String }
8
+
9
+ class BetaMemoryTool20250818DeleteCommand < Anthropic::Internal::Type::BaseModel
10
+ attr_accessor command: :delete
11
+
12
+ attr_accessor path: String
13
+
14
+ def initialize: (path: String, ?command: :delete) -> void
15
+
16
+ def to_hash: -> { command: :delete, path: String }
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,39 @@
1
+ module Anthropic
2
+ module Models
3
+ class BetaMemoryTool20250818InsertCommand = Beta::BetaMemoryTool20250818InsertCommand
4
+
5
+ module Beta
6
+ type beta_memory_tool20250818_insert_command =
7
+ {
8
+ command: :insert,
9
+ insert_line: Integer,
10
+ insert_text: String,
11
+ path: String
12
+ }
13
+
14
+ class BetaMemoryTool20250818InsertCommand < Anthropic::Internal::Type::BaseModel
15
+ attr_accessor command: :insert
16
+
17
+ attr_accessor insert_line: Integer
18
+
19
+ attr_accessor insert_text: String
20
+
21
+ attr_accessor path: String
22
+
23
+ def initialize: (
24
+ insert_line: Integer,
25
+ insert_text: String,
26
+ path: String,
27
+ ?command: :insert
28
+ ) -> void
29
+
30
+ def to_hash: -> {
31
+ command: :insert,
32
+ insert_line: Integer,
33
+ insert_text: String,
34
+ path: String
35
+ }
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,26 @@
1
+ module Anthropic
2
+ module Models
3
+ class BetaMemoryTool20250818RenameCommand = Beta::BetaMemoryTool20250818RenameCommand
4
+
5
+ module Beta
6
+ type beta_memory_tool20250818_rename_command =
7
+ { command: :rename, new_path: String, old_path: String }
8
+
9
+ class BetaMemoryTool20250818RenameCommand < Anthropic::Internal::Type::BaseModel
10
+ attr_accessor command: :rename
11
+
12
+ attr_accessor new_path: String
13
+
14
+ attr_accessor old_path: String
15
+
16
+ def initialize: (
17
+ new_path: String,
18
+ old_path: String,
19
+ ?command: :rename
20
+ ) -> void
21
+
22
+ def to_hash: -> { command: :rename, new_path: String, old_path: String }
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,39 @@
1
+ module Anthropic
2
+ module Models
3
+ class BetaMemoryTool20250818StrReplaceCommand = Beta::BetaMemoryTool20250818StrReplaceCommand
4
+
5
+ module Beta
6
+ type beta_memory_tool20250818_str_replace_command =
7
+ {
8
+ command: :str_replace,
9
+ new_str: String,
10
+ old_str: String,
11
+ path: String
12
+ }
13
+
14
+ class BetaMemoryTool20250818StrReplaceCommand < Anthropic::Internal::Type::BaseModel
15
+ attr_accessor command: :str_replace
16
+
17
+ attr_accessor new_str: String
18
+
19
+ attr_accessor old_str: String
20
+
21
+ attr_accessor path: String
22
+
23
+ def initialize: (
24
+ new_str: String,
25
+ old_str: String,
26
+ path: String,
27
+ ?command: :str_replace
28
+ ) -> void
29
+
30
+ def to_hash: -> {
31
+ command: :str_replace,
32
+ new_str: String,
33
+ old_str: String,
34
+ path: String
35
+ }
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,32 @@
1
+ module Anthropic
2
+ module Models
3
+ class BetaMemoryTool20250818ViewCommand = Beta::BetaMemoryTool20250818ViewCommand
4
+
5
+ module Beta
6
+ type beta_memory_tool20250818_view_command =
7
+ { command: :view, path: String, view_range: ::Array[Integer] }
8
+
9
+ class BetaMemoryTool20250818ViewCommand < Anthropic::Internal::Type::BaseModel
10
+ attr_accessor command: :view
11
+
12
+ attr_accessor path: String
13
+
14
+ attr_reader view_range: ::Array[Integer]?
15
+
16
+ def view_range=: (::Array[Integer]) -> ::Array[Integer]
17
+
18
+ def initialize: (
19
+ path: String,
20
+ ?view_range: ::Array[Integer],
21
+ ?command: :view
22
+ ) -> void
23
+
24
+ def to_hash: -> {
25
+ command: :view,
26
+ path: String,
27
+ view_range: ::Array[Integer]
28
+ }
29
+ end
30
+ end
31
+ end
32
+ end
@@ -8,6 +8,7 @@ module Anthropic
8
8
  id: String,
9
9
  container: Anthropic::Beta::BetaContainer?,
10
10
  content: ::Array[Anthropic::Models::Beta::beta_content_block],
11
+ context_management: Anthropic::Beta::BetaContextManagementResponse?,
11
12
  model: Anthropic::Models::model,
12
13
  role: :assistant,
13
14
  stop_reason: Anthropic::Models::Beta::beta_stop_reason?,
@@ -23,6 +24,8 @@ module Anthropic
23
24
 
24
25
  attr_accessor content: ::Array[Anthropic::Models::Beta::beta_content_block]
25
26
 
27
+ attr_accessor context_management: Anthropic::Beta::BetaContextManagementResponse?
28
+
26
29
  attr_accessor model: Anthropic::Models::model
27
30
 
28
31
  attr_accessor role: :assistant
@@ -39,6 +42,7 @@ module Anthropic
39
42
  id: String,
40
43
  container: Anthropic::Beta::BetaContainer?,
41
44
  content: ::Array[Anthropic::Models::Beta::beta_content_block],
45
+ context_management: Anthropic::Beta::BetaContextManagementResponse?,
42
46
  model: Anthropic::Models::model,
43
47
  stop_reason: Anthropic::Models::Beta::beta_stop_reason?,
44
48
  stop_sequence: String?,
@@ -51,6 +55,7 @@ module Anthropic
51
55
  id: String,
52
56
  container: Anthropic::Beta::BetaContainer?,
53
57
  content: ::Array[Anthropic::Models::Beta::beta_content_block],
58
+ context_management: Anthropic::Beta::BetaContextManagementResponse?,
54
59
  model: Anthropic::Models::model,
55
60
  role: :assistant,
56
61
  stop_reason: Anthropic::Models::Beta::beta_stop_reason?,
@@ -3,14 +3,26 @@ module Anthropic
3
3
  class BetaMessageTokensCount = Beta::BetaMessageTokensCount
4
4
 
5
5
  module Beta
6
- type beta_message_tokens_count = { input_tokens: Integer }
6
+ type beta_message_tokens_count =
7
+ {
8
+ context_management: Anthropic::Beta::BetaCountTokensContextManagementResponse?,
9
+ input_tokens: Integer
10
+ }
7
11
 
8
12
  class BetaMessageTokensCount < Anthropic::Internal::Type::BaseModel
13
+ attr_accessor context_management: Anthropic::Beta::BetaCountTokensContextManagementResponse?
14
+
9
15
  attr_accessor input_tokens: Integer
10
16
 
11
- def initialize: (input_tokens: Integer) -> void
17
+ def initialize: (
18
+ context_management: Anthropic::Beta::BetaCountTokensContextManagementResponse?,
19
+ input_tokens: Integer
20
+ ) -> void
12
21
 
13
- def to_hash: -> { input_tokens: Integer }
22
+ def to_hash: -> {
23
+ context_management: Anthropic::Beta::BetaCountTokensContextManagementResponse?,
24
+ input_tokens: Integer
25
+ }
14
26
  end
15
27
  end
16
28
  end
@@ -5,12 +5,15 @@ module Anthropic
5
5
  module Beta
6
6
  type beta_raw_message_delta_event =
7
7
  {
8
+ context_management: Anthropic::Beta::BetaContextManagementResponse?,
8
9
  delta: Anthropic::Beta::BetaRawMessageDeltaEvent::Delta,
9
10
  type: :message_delta,
10
11
  usage: Anthropic::Beta::BetaMessageDeltaUsage
11
12
  }
12
13
 
13
14
  class BetaRawMessageDeltaEvent < Anthropic::Internal::Type::BaseModel
15
+ attr_accessor context_management: Anthropic::Beta::BetaContextManagementResponse?
16
+
14
17
  attr_accessor delta: Anthropic::Beta::BetaRawMessageDeltaEvent::Delta
15
18
 
16
19
  attr_accessor type: :message_delta
@@ -18,12 +21,14 @@ module Anthropic
18
21
  attr_accessor usage: Anthropic::Beta::BetaMessageDeltaUsage
19
22
 
20
23
  def initialize: (
24
+ context_management: Anthropic::Beta::BetaContextManagementResponse?,
21
25
  delta: Anthropic::Beta::BetaRawMessageDeltaEvent::Delta,
22
26
  usage: Anthropic::Beta::BetaMessageDeltaUsage,
23
27
  ?type: :message_delta
24
28
  ) -> void
25
29
 
26
30
  def to_hash: -> {
31
+ context_management: Anthropic::Beta::BetaContextManagementResponse?,
27
32
  delta: Anthropic::Beta::BetaRawMessageDeltaEvent::Delta,
28
33
  type: :message_delta,
29
34
  usage: Anthropic::Beta::BetaMessageDeltaUsage
@@ -10,6 +10,7 @@ module Anthropic
10
10
  | :tool_use
11
11
  | :pause_turn
12
12
  | :refusal
13
+ | :model_context_window_exceeded
13
14
 
14
15
  module BetaStopReason
15
16
  extend Anthropic::Internal::Type::Enum
@@ -20,6 +21,7 @@ module Anthropic
20
21
  TOOL_USE: :tool_use
21
22
  PAUSE_TURN: :pause_turn
22
23
  REFUSAL: :refusal
24
+ MODEL_CONTEXT_WINDOW_EXCEEDED: :model_context_window_exceeded
23
25
 
24
26
  def self?.values: -> ::Array[Anthropic::Models::Beta::beta_stop_reason]
25
27
  end
@@ -10,6 +10,7 @@ module Anthropic
10
10
  | Anthropic::Beta::BetaCodeExecutionTool20250522
11
11
  | Anthropic::Beta::BetaCodeExecutionTool20250825
12
12
  | Anthropic::Beta::BetaToolComputerUse20241022
13
+ | Anthropic::Beta::BetaMemoryTool20250818
13
14
  | Anthropic::Beta::BetaToolComputerUse20250124
14
15
  | Anthropic::Beta::BetaToolTextEditor20241022
15
16
  | Anthropic::Beta::BetaToolTextEditor20250124
@@ -0,0 +1,19 @@
1
+ module Anthropic
2
+ module Models
3
+ class BetaToolUsesKeep = Beta::BetaToolUsesKeep
4
+
5
+ module Beta
6
+ type beta_tool_uses_keep = { type: :tool_uses, value: Integer }
7
+
8
+ class BetaToolUsesKeep < Anthropic::Internal::Type::BaseModel
9
+ attr_accessor type: :tool_uses
10
+
11
+ attr_accessor value: Integer
12
+
13
+ def initialize: (value: Integer, ?type: :tool_uses) -> void
14
+
15
+ def to_hash: -> { type: :tool_uses, value: Integer }
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ module Anthropic
2
+ module Models
3
+ class BetaToolUsesTrigger = Beta::BetaToolUsesTrigger
4
+
5
+ module Beta
6
+ type beta_tool_uses_trigger = { type: :tool_uses, value: Integer }
7
+
8
+ class BetaToolUsesTrigger < Anthropic::Internal::Type::BaseModel
9
+ attr_accessor type: :tool_uses
10
+
11
+ attr_accessor value: Integer
12
+
13
+ def initialize: (value: Integer, ?type: :tool_uses) -> void
14
+
15
+ def to_hash: -> { type: :tool_uses, value: Integer }
16
+ end
17
+ end
18
+ end
19
+ end
@@ -5,6 +5,7 @@ module Anthropic
5
5
  {
6
6
  messages: ::Array[Anthropic::Beta::BetaMessageParam],
7
7
  model: Anthropic::Models::model,
8
+ context_management: Anthropic::Beta::BetaContextManagementConfig?,
8
9
  mcp_servers: ::Array[Anthropic::Beta::BetaRequestMCPServerURLDefinition],
9
10
  system_: Anthropic::Models::Beta::MessageCountTokensParams::system_,
10
11
  thinking: Anthropic::Models::Beta::beta_thinking_config_param,
@@ -22,6 +23,8 @@ module Anthropic
22
23
 
23
24
  attr_accessor model: Anthropic::Models::model
24
25
 
26
+ attr_accessor context_management: Anthropic::Beta::BetaContextManagementConfig?
27
+
25
28
  attr_reader mcp_servers: ::Array[Anthropic::Beta::BetaRequestMCPServerURLDefinition]?
26
29
 
27
30
  def mcp_servers=: (
@@ -61,6 +64,7 @@ module Anthropic
61
64
  def initialize: (
62
65
  messages: ::Array[Anthropic::Beta::BetaMessageParam],
63
66
  model: Anthropic::Models::model,
67
+ ?context_management: Anthropic::Beta::BetaContextManagementConfig?,
64
68
  ?mcp_servers: ::Array[Anthropic::Beta::BetaRequestMCPServerURLDefinition],
65
69
  ?system_: Anthropic::Models::Beta::MessageCountTokensParams::system_,
66
70
  ?thinking: Anthropic::Models::Beta::beta_thinking_config_param,
@@ -73,6 +77,7 @@ module Anthropic
73
77
  def to_hash: -> {
74
78
  messages: ::Array[Anthropic::Beta::BetaMessageParam],
75
79
  model: Anthropic::Models::model,
80
+ context_management: Anthropic::Beta::BetaContextManagementConfig?,
76
81
  mcp_servers: ::Array[Anthropic::Beta::BetaRequestMCPServerURLDefinition],
77
82
  system_: Anthropic::Models::Beta::MessageCountTokensParams::system_,
78
83
  thinking: Anthropic::Models::Beta::beta_thinking_config_param,
@@ -99,6 +104,7 @@ module Anthropic
99
104
  | Anthropic::Beta::BetaCodeExecutionTool20250522
100
105
  | Anthropic::Beta::BetaCodeExecutionTool20250825
101
106
  | Anthropic::Beta::BetaToolComputerUse20241022
107
+ | Anthropic::Beta::BetaMemoryTool20250818
102
108
  | Anthropic::Beta::BetaToolComputerUse20250124
103
109
  | Anthropic::Beta::BetaToolTextEditor20241022
104
110
  | Anthropic::Beta::BetaToolTextEditor20250124