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.
Files changed (113) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +44 -0
  3. data/README.md +12 -12
  4. data/lib/anthropic/errors.rb +25 -11
  5. data/lib/anthropic/file_part.rb +10 -7
  6. data/lib/anthropic/helpers/bedrock/client.rb +8 -24
  7. data/lib/anthropic/internal/page.rb +1 -1
  8. data/lib/anthropic/internal/stream.rb +1 -0
  9. data/lib/anthropic/internal/transport/base_client.rb +16 -12
  10. data/lib/anthropic/internal/transport/pooled_net_requester.rb +7 -10
  11. data/lib/anthropic/internal/type/base_page.rb +1 -1
  12. data/lib/anthropic/internal/type/base_stream.rb +8 -17
  13. data/lib/anthropic/internal/type/file_input.rb +7 -4
  14. data/lib/anthropic/internal/util.rb +2 -1
  15. data/lib/anthropic/models/anthropic_beta.rb +6 -0
  16. data/lib/anthropic/models/beta/beta_clear_tool_uses_20250919_edit.rb +98 -0
  17. data/lib/anthropic/models/beta/beta_clear_tool_uses_20250919_edit_response.rb +38 -0
  18. data/lib/anthropic/models/beta/beta_context_management_config.rb +22 -0
  19. data/lib/anthropic/models/beta/beta_context_management_response.rb +23 -0
  20. data/lib/anthropic/models/beta/beta_count_tokens_context_management_response.rb +20 -0
  21. data/lib/anthropic/models/beta/beta_input_tokens_clear_at_least.rb +25 -0
  22. data/lib/anthropic/models/beta/beta_input_tokens_trigger.rb +25 -0
  23. data/lib/anthropic/models/beta/beta_memory_tool_20250818.rb +40 -0
  24. data/lib/anthropic/models/beta/beta_memory_tool_20250818_command.rb +30 -0
  25. data/lib/anthropic/models/beta/beta_memory_tool_20250818_create_command.rb +36 -0
  26. data/lib/anthropic/models/beta/beta_memory_tool_20250818_delete_command.rb +28 -0
  27. data/lib/anthropic/models/beta/beta_memory_tool_20250818_insert_command.rb +44 -0
  28. data/lib/anthropic/models/beta/beta_memory_tool_20250818_rename_command.rb +36 -0
  29. data/lib/anthropic/models/beta/beta_memory_tool_20250818_str_replace_command.rb +44 -0
  30. data/lib/anthropic/models/beta/beta_memory_tool_20250818_view_command.rb +36 -0
  31. data/lib/anthropic/models/beta/beta_message.rb +9 -1
  32. data/lib/anthropic/models/beta/beta_message_tokens_count.rb +13 -1
  33. data/lib/anthropic/models/beta/beta_raw_message_delta_event.rb +9 -1
  34. data/lib/anthropic/models/beta/beta_stop_reason.rb +1 -0
  35. data/lib/anthropic/models/beta/beta_tool_union.rb +3 -1
  36. data/lib/anthropic/models/beta/beta_tool_uses_keep.rb +25 -0
  37. data/lib/anthropic/models/beta/beta_tool_uses_trigger.rb +25 -0
  38. data/lib/anthropic/models/beta/message_count_tokens_params.rb +14 -4
  39. data/lib/anthropic/models/beta/message_create_params.rb +11 -3
  40. data/lib/anthropic/models/beta/messages/batch_create_params.rb +11 -3
  41. data/lib/anthropic/models/model.rb +10 -0
  42. data/lib/anthropic/models/stop_reason.rb +1 -0
  43. data/lib/anthropic/resources/beta/messages.rb +12 -6
  44. data/lib/anthropic/version.rb +1 -1
  45. data/lib/anthropic.rb +17 -0
  46. data/rbi/anthropic/errors.rbi +29 -2
  47. data/rbi/anthropic/file_part.rbi +1 -1
  48. data/rbi/anthropic/internal/transport/base_client.rbi +4 -5
  49. data/rbi/anthropic/internal/type/base_page.rbi +1 -1
  50. data/rbi/anthropic/internal/type/base_stream.rbi +15 -15
  51. data/rbi/anthropic/internal/util.rbi +1 -1
  52. data/rbi/anthropic/models/anthropic_beta.rbi +10 -0
  53. data/rbi/anthropic/models/beta/beta_clear_tool_uses_20250919_edit.rbi +183 -0
  54. data/rbi/anthropic/models/beta/beta_clear_tool_uses_20250919_edit_response.rbi +62 -0
  55. data/rbi/anthropic/models/beta/beta_context_management_config.rbi +56 -0
  56. data/rbi/anthropic/models/beta/beta_context_management_response.rbi +53 -0
  57. data/rbi/anthropic/models/beta/beta_count_tokens_context_management_response.rbi +35 -0
  58. data/rbi/anthropic/models/beta/beta_input_tokens_clear_at_least.rbi +33 -0
  59. data/rbi/anthropic/models/beta/beta_input_tokens_trigger.rbi +33 -0
  60. data/rbi/anthropic/models/beta/beta_memory_tool_20250818.rbi +72 -0
  61. data/rbi/anthropic/models/beta/beta_memory_tool_20250818_command.rbi +33 -0
  62. data/rbi/anthropic/models/beta/beta_memory_tool_20250818_create_command.rbi +53 -0
  63. data/rbi/anthropic/models/beta/beta_memory_tool_20250818_delete_command.rbi +41 -0
  64. data/rbi/anthropic/models/beta/beta_memory_tool_20250818_insert_command.rbi +69 -0
  65. data/rbi/anthropic/models/beta/beta_memory_tool_20250818_rename_command.rbi +55 -0
  66. data/rbi/anthropic/models/beta/beta_memory_tool_20250818_str_replace_command.rbi +64 -0
  67. data/rbi/anthropic/models/beta/beta_memory_tool_20250818_view_command.rbi +59 -0
  68. data/rbi/anthropic/models/beta/beta_message.rbi +20 -0
  69. data/rbi/anthropic/models/beta/beta_message_tokens_count.rbi +40 -2
  70. data/rbi/anthropic/models/beta/beta_raw_message_delta_event.rbi +20 -0
  71. data/rbi/anthropic/models/beta/beta_stop_reason.rbi +5 -0
  72. data/rbi/anthropic/models/beta/beta_tool_union.rbi +1 -0
  73. data/rbi/anthropic/models/beta/beta_tool_uses_keep.rbi +33 -0
  74. data/rbi/anthropic/models/beta/beta_tool_uses_trigger.rbi +33 -0
  75. data/rbi/anthropic/models/beta/message_count_tokens_params.rbi +23 -0
  76. data/rbi/anthropic/models/beta/message_create_params.rbi +22 -0
  77. data/rbi/anthropic/models/beta/messages/batch_create_params.rbi +28 -0
  78. data/rbi/anthropic/models/model.rbi +8 -0
  79. data/rbi/anthropic/models/stop_reason.rbi +5 -0
  80. data/rbi/anthropic/resources/beta/messages.rbi +15 -0
  81. data/sig/anthropic/errors.rbs +7 -0
  82. data/sig/anthropic/file_part.rbs +1 -1
  83. data/sig/anthropic/internal/type/base_stream.rbs +4 -3
  84. data/sig/anthropic/models/anthropic_beta.rbs +4 -0
  85. data/sig/anthropic/models/beta/beta_clear_tool_uses_20250919_edit.rbs +77 -0
  86. data/sig/anthropic/models/beta/beta_clear_tool_uses_20250919_edit_response.rbs +34 -0
  87. data/sig/anthropic/models/beta/beta_context_management_config.rbs +26 -0
  88. data/sig/anthropic/models/beta/beta_context_management_response.rbs +24 -0
  89. data/sig/anthropic/models/beta/beta_count_tokens_context_management_response.rbs +18 -0
  90. data/sig/anthropic/models/beta/beta_input_tokens_clear_at_least.rbs +20 -0
  91. data/sig/anthropic/models/beta/beta_input_tokens_trigger.rbs +19 -0
  92. data/sig/anthropic/models/beta/beta_memory_tool_20250818.rbs +34 -0
  93. data/sig/anthropic/models/beta/beta_memory_tool_20250818_command.rbs +21 -0
  94. data/sig/anthropic/models/beta/beta_memory_tool_20250818_create_command.rbs +26 -0
  95. data/sig/anthropic/models/beta/beta_memory_tool_20250818_delete_command.rbs +20 -0
  96. data/sig/anthropic/models/beta/beta_memory_tool_20250818_insert_command.rbs +39 -0
  97. data/sig/anthropic/models/beta/beta_memory_tool_20250818_rename_command.rbs +26 -0
  98. data/sig/anthropic/models/beta/beta_memory_tool_20250818_str_replace_command.rbs +39 -0
  99. data/sig/anthropic/models/beta/beta_memory_tool_20250818_view_command.rbs +32 -0
  100. data/sig/anthropic/models/beta/beta_message.rbs +5 -0
  101. data/sig/anthropic/models/beta/beta_message_tokens_count.rbs +15 -3
  102. data/sig/anthropic/models/beta/beta_raw_message_delta_event.rbs +5 -0
  103. data/sig/anthropic/models/beta/beta_stop_reason.rbs +2 -0
  104. data/sig/anthropic/models/beta/beta_tool_union.rbs +1 -0
  105. data/sig/anthropic/models/beta/beta_tool_uses_keep.rbs +19 -0
  106. data/sig/anthropic/models/beta/beta_tool_uses_trigger.rbs +19 -0
  107. data/sig/anthropic/models/beta/message_count_tokens_params.rbs +6 -0
  108. data/sig/anthropic/models/beta/message_create_params.rbs +5 -0
  109. data/sig/anthropic/models/beta/messages/batch_create_params.rbs +5 -0
  110. data/sig/anthropic/models/model.rbs +8 -0
  111. data/sig/anthropic/models/stop_reason.rbs +2 -0
  112. data/sig/anthropic/resources/beta/messages.rbs +3 -0
  113. metadata +53 -2
@@ -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.
@@ -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,
@@ -14,7 +14,7 @@ module Anthropic
14
14
 
15
15
  def initialize: (
16
16
  Pathname | StringIO | IO | String content,
17
- ?filename: String?,
17
+ ?filename: (Pathname | String)?,
18
18
  ?content_type: String?
19
19
  ) -> void
20
20
  end
@@ -4,9 +4,9 @@ module Anthropic
4
4
  module BaseStream[Message, Elem]
5
5
  include Enumerable[Elem]
6
6
 
7
- def self.defer_closing: (
8
- Enumerable[top] stream
9
- ) -> (^(Integer arg0) -> void)
7
+ attr_reader status: Integer
8
+
9
+ attr_reader headers: ::Hash[String, String]
10
10
 
11
11
  def close: -> void
12
12
 
@@ -22,6 +22,7 @@ module Anthropic
22
22
  model: Class | Anthropic::Internal::Type::Converter,
23
23
  url: URI::Generic,
24
24
  status: Integer,
25
+ headers: ::Hash[String, String],
25
26
  response: top,
26
27
  unwrap: Symbol
27
28
  | Integer
@@ -17,6 +17,8 @@ module Anthropic
17
17
  | :"code-execution-2025-05-22"
18
18
  | :"extended-cache-ttl-2025-04-11"
19
19
  | :"context-1m-2025-08-07"
20
+ | :"context-management-2025-06-27"
21
+ | :"model-context-window-exceeded-2025-08-26"
20
22
 
21
23
  module AnthropicBeta
22
24
  extend Anthropic::Internal::Type::Union
@@ -38,6 +40,8 @@ module Anthropic
38
40
  CODE_EXECUTION_2025_05_22: :"code-execution-2025-05-22"
39
41
  EXTENDED_CACHE_TTL_2025_04_11: :"extended-cache-ttl-2025-04-11"
40
42
  CONTEXT_1M_2025_08_07: :"context-1m-2025-08-07"
43
+ CONTEXT_MANAGEMENT_2025_06_27: :"context-management-2025-06-27"
44
+ MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26: :"model-context-window-exceeded-2025-08-26"
41
45
  end
42
46
  end
43
47
  end
@@ -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