Module: Anthropic::Models::Beta::BetaContextManagementConfig::Edit

Extended by:
Internal::Type::Union
Defined in:
lib/anthropic/models/beta/beta_context_management_config.rb,
sig/anthropic/models/beta/beta_context_management_config.rbs

Overview

Automatically compact older context when reaching the configured trigger threshold.

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Internal::Type::Union

==, ===, coerce, derefed_variants, dump, hash, inspect, to_sorbet_type, variants

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, #inspect, inspect, meta_info, new_coerce_state, type_info

Class Method Details

.new(type:, **args) ⇒ Anthropic::Models::Beta::BetaClearToolUses20250919Edit, ...

Creates a new instance of the variant class whose type matches the given value, passing the remaining arguments to its constructor.

Some parameter documentations has been truncated, see Anthropic::Models::Beta::BetaContextManagementConfig::Edit for more details.

Parameters:

  • type (Symbol, String)
  • args (Hash{Symbol=>Object})

    Attributes for the chosen variant.

    @option args [Anthropic::Models::Beta::BetaInputTokensClearAtLeast, nil] :clear_at_least Minimum number of tokens that must be cleared when triggered. Context will only

    @option args [Boolean, Array, nil] :clear_tool_inputs Whether to clear all tool inputs (bool) or specific tool inputs to clear (list)

    @option args [Array, nil] :exclude_tools Tool names whose uses are preserved from clearing

    @option args [Anthropic::Models::Beta::BetaToolUsesKeep, Anthropic::Models::Beta::BetaThinkingTurns, Anthropic::Models::Beta::BetaAllThinkingTurns, Symbol, :all] :keep Number of tool uses to retain in the conversation

    @option args [Anthropic::Models::Beta::BetaInputTokensTrigger, Anthropic::Models::Beta::BetaToolUsesTrigger, Anthropic::Models::Beta::BetaInputTokensTrigger, nil] :trigger Condition that triggers the context management strategy

    @option args [String, nil] :instructions Additional instructions for summarization.

    @option args [Boolean] :pause_after_compaction Whether to pause after compaction and return the compaction block to the user.

Returns:

Raises:

  • (ArgumentError)


60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/anthropic/models/beta/beta_context_management_config.rb', line 60

def self.new(type:, **args)
  case type.to_sym
  when :clear_tool_uses_20250919
    Anthropic::Beta::BetaClearToolUses20250919Edit.new(**args)
  when :clear_thinking_20251015
    Anthropic::Beta::BetaClearThinking20251015Edit.new(**args)
  when :compact_20260112
    Anthropic::Beta::BetaCompact20260112Edit.new(**args)
  else
    raise ArgumentError, "unknown type: #{type}"
  end
end

Instance Method Details

#self?.variants::Array[Anthropic::Models::Beta::BetaContextManagementConfig::edit]

Returns:

  • (::Array[Anthropic::Models::Beta::BetaContextManagementConfig::edit])


34
# File 'sig/anthropic/models/beta/beta_context_management_config.rbs', line 34

def self?.variants: -> ::Array[Anthropic::Models::Beta::BetaContextManagementConfig::edit]