Module: Anthropic::Models::Beta::BetaCacheMissReason

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

Defined Under Namespace

Modules: Type

Class Method Summary collapse

Methods included from Internal::Type::Union

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

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:, cache_missed_input_tokens:) ⇒ Anthropic::Beta::BetaCacheMissModelChanged .new(type:, cache_missed_input_tokens:) ⇒ Anthropic::Beta::BetaCacheMissSystemChanged .new(type:, cache_missed_input_tokens:) ⇒ Anthropic::Beta::BetaCacheMissToolsChanged .new(type:, cache_missed_input_tokens:) ⇒ Anthropic::Beta::BetaCacheMissMessagesChanged .new(type:) ⇒ Anthropic::Beta::BetaCacheMissPreviousMessageNotFound .new(type:) ⇒ Anthropic::Beta::BetaCacheMissUnavailable .new(type:, cache_missed_input_tokens:) ⇒ Anthropic::Models::Beta::beta_cache_miss_reason

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::BetaCacheMissReason for more details.

Overloads:

  • .new(type:, cache_missed_input_tokens:) ⇒ Anthropic::Beta::BetaCacheMissModelChanged

    Parameters:

    • type: (:model_changed, "model_changed")
    • cache_missed_input_tokens: (Integer)

    Returns:

    • (Anthropic::Beta::BetaCacheMissModelChanged)
  • .new(type:, cache_missed_input_tokens:) ⇒ Anthropic::Beta::BetaCacheMissSystemChanged

    Parameters:

    • type: (:system_changed, "system_changed")
    • cache_missed_input_tokens: (Integer)

    Returns:

    • (Anthropic::Beta::BetaCacheMissSystemChanged)
  • .new(type:, cache_missed_input_tokens:) ⇒ Anthropic::Beta::BetaCacheMissToolsChanged

    Parameters:

    • type: (:tools_changed, "tools_changed")
    • cache_missed_input_tokens: (Integer)

    Returns:

    • (Anthropic::Beta::BetaCacheMissToolsChanged)
  • .new(type:, cache_missed_input_tokens:) ⇒ Anthropic::Beta::BetaCacheMissMessagesChanged

    Parameters:

    • type: (:messages_changed, "messages_changed")
    • cache_missed_input_tokens: (Integer)

    Returns:

    • (Anthropic::Beta::BetaCacheMissMessagesChanged)
  • .new(type:) ⇒ Anthropic::Beta::BetaCacheMissPreviousMessageNotFound

    Parameters:

    • type: (:previous_message_not_found, "previous_message_not_found")

    Returns:

    • (Anthropic::Beta::BetaCacheMissPreviousMessageNotFound)
  • .new(type:) ⇒ Anthropic::Beta::BetaCacheMissUnavailable

    Parameters:

    • type: (:unavailable, "unavailable")

    Returns:

    • (Anthropic::Beta::BetaCacheMissUnavailable)
  • .new(type:, cache_missed_input_tokens:) ⇒ Anthropic::Models::Beta::beta_cache_miss_reason

    Parameters:

    • type: (Anthropic::Models::Beta::BetaCacheMissReason::type_, String)
    • cache_missed_input_tokens: (Integer)

    Returns:

    • (Anthropic::Models::Beta::beta_cache_miss_reason)

Parameters:

  • type (Symbol, Anthropic::Models::Beta::BetaCacheMissReason::Type, String)
  • args (Hash{Symbol=>Object}) —

    Attributes for the chosen variant.

    @option args [Integer] :cache_missed_input_tokens Approximate number of input tokens that would have been read from cache had the

Returns:

Raises:

  • (ArgumentError)


76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/anthropic/models/beta/beta_cache_miss_reason.rb', line 76

def self.new(type:, **args)
  case type.to_sym
  when :model_changed
    Anthropic::Beta::BetaCacheMissModelChanged.new(**args)
  when :system_changed
    Anthropic::Beta::BetaCacheMissSystemChanged.new(**args)
  when :tools_changed
    Anthropic::Beta::BetaCacheMissToolsChanged.new(**args)
  when :messages_changed
    Anthropic::Beta::BetaCacheMissMessagesChanged.new(**args)
  when :previous_message_not_found
    Anthropic::Beta::BetaCacheMissPreviousMessageNotFound.new(**args)
  when :unavailable
    Anthropic::Beta::BetaCacheMissUnavailable.new(**args)
  else
    raise ArgumentError, "unknown type: #{type}"
  end
end

.values ⇒ Array<Symbol>

Returns:

  • (Array<Symbol>)


# File 'lib/anthropic/models/beta/beta_cache_miss_reason.rb', line 55