Module: Anthropic::Models::Beta::BetaContextManagementResponse::AppliedEdit

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

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::BetaClearToolUses20250919EditResponse, Anthropic::Models::Beta::BetaClearThinking20251015EditResponse

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

Parameters:

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

    Attributes for the chosen variant.

    @option args [Integer] :cleared_input_tokens Number of input tokens cleared by this edit.

    @option args [Integer] :cleared_tool_uses Number of tool uses that were cleared.

    @option args [Integer] :cleared_thinking_turns Number of thinking turns that were cleared.

Returns:

Raises:

  • (ArgumentError)


44
45
46
47
48
49
50
51
52
53
# File 'lib/anthropic/models/beta/beta_context_management_response.rb', line 44

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

Instance Method Details

#initialize(applied_edits:) ⇒ Object

Parameters:



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/anthropic/models/beta/beta_context_management_response.rb', line 17

module AppliedEdit
  extend Anthropic::Internal::Type::Union

  discriminator :type

  variant :clear_tool_uses_20250919, -> { Anthropic::Beta::BetaClearToolUses20250919EditResponse }

  variant :clear_thinking_20251015, -> { Anthropic::Beta::BetaClearThinking20251015EditResponse }

  # @!method self.variants
  #   @return [Array(Anthropic::Models::Beta::BetaClearToolUses20250919EditResponse, Anthropic::Models::Beta::BetaClearThinking20251015EditResponse)]

  # Creates a new instance of the variant class whose `type` matches the given
  # value, passing the remaining arguments to its constructor.
  #
  # @param type [Symbol, String]
  #
  # @param args [Hash{Symbol=>Object}] Attributes for the chosen variant.
  #
  #   @option args [Integer] :cleared_input_tokens Number of input tokens cleared by this edit.
  #
  #   @option args [Integer] :cleared_tool_uses Number of tool uses that were cleared.
  #
  #   @option args [Integer] :cleared_thinking_turns Number of thinking turns that were cleared.
  #
  # @raise [ArgumentError]
  # @return [Anthropic::Models::Beta::BetaClearToolUses20250919EditResponse, Anthropic::Models::Beta::BetaClearThinking20251015EditResponse]
  def self.new(type:, **args)
    case type.to_sym
    when :clear_tool_uses_20250919
      Anthropic::Beta::BetaClearToolUses20250919EditResponse.new(**args)
    when :clear_thinking_20251015
      Anthropic::Beta::BetaClearThinking20251015EditResponse.new(**args)
    else
      raise ArgumentError, "unknown type: #{type}"
    end
  end
end

#self?.variants::Array[Anthropic::Models::Beta::BetaContextManagementResponse::applied_edit]

Returns:

  • (::Array[Anthropic::Models::Beta::BetaContextManagementResponse::applied_edit])


29
# File 'sig/anthropic/models/beta/beta_context_management_response.rbs', line 29

def self?.variants: -> ::Array[Anthropic::Models::Beta::BetaContextManagementResponse::applied_edit]