Module: Anthropic::Models::CacheMissReason

Extended by:
Internal::Type::Union
Defined in:
lib/anthropic/models/cache_miss_reason.rb,
sig/anthropic/models/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::CacheMissModelChanged .new(type:, cache_missed_input_tokens:) ⇒ Anthropic::CacheMissSystemChanged .new(type:, cache_missed_input_tokens:) ⇒ Anthropic::CacheMissToolsChanged .new(type:, cache_missed_input_tokens:) ⇒ Anthropic::CacheMissMessagesChanged .new(type:) ⇒ Anthropic::CacheMissPreviousMessageNotFound .new(type:) ⇒ Anthropic::CacheMissUnavailable .new(type:, cache_missed_input_tokens:) ⇒ Anthropic::Models::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::CacheMissReason for more details.

Overloads:

Parameters:

  • type (Symbol, Anthropic::Models::CacheMissReason::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)


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

def self.new(type:, **args)
  case type.to_sym
  when :model_changed
    Anthropic::CacheMissModelChanged.new(**args)
  when :system_changed
    Anthropic::CacheMissSystemChanged.new(**args)
  when :tools_changed
    Anthropic::CacheMissToolsChanged.new(**args)
  when :messages_changed
    Anthropic::CacheMissMessagesChanged.new(**args)
  when :previous_message_not_found
    Anthropic::CacheMissPreviousMessageNotFound.new(**args)
  when :unavailable
    Anthropic::CacheMissUnavailable.new(**args)
  else
    raise ArgumentError, "unknown type: #{type}"
  end
end

.values ⇒ Array<Symbol>

Returns:

  • (Array<Symbol>)


# File 'lib/anthropic/models/cache_miss_reason.rb', line 54