Module: Anthropic::Models::Beta::Messages::BetaMessageBatchResult

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

Overview

Processing result for this request.

Contains a Message output if processing was successful, an error response if processing failed, or the reason why processing was not attempted, such as cancellation or expiration.

Defined Under Namespace

Modules: Type

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::Messages::BetaMessageBatchSucceededResult, ...

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 [Anthropic::Models::Beta::BetaMessage] :message

    @option args [Anthropic::Models::BetaErrorResponse] :error

Returns:

Raises:

  • (ArgumentError)


53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/anthropic/models/beta/messages/beta_message_batch_result.rb', line 53

def self.new(type:, **args)
  case type.to_sym
  when :succeeded
    Anthropic::Beta::Messages::BetaMessageBatchSucceededResult.new(**args)
  when :errored
    Anthropic::Beta::Messages::BetaMessageBatchErroredResult.new(**args)
  when :canceled
    Anthropic::Beta::Messages::BetaMessageBatchCanceledResult.new(**args)
  when :expired
    Anthropic::Beta::Messages::BetaMessageBatchExpiredResult.new(**args)
  else
    raise ArgumentError, "unknown type: #{type}"
  end
end

.valuesArray<Symbol>

Returns:

  • (Array<Symbol>)


# File 'lib/anthropic/models/beta/messages/beta_message_batch_result.rb', line 33

Instance Method Details

#self?.variants::Array[Anthropic::Models::Beta::Messages::beta_message_batch_result]

Returns:

  • (::Array[Anthropic::Models::Beta::Messages::beta_message_batch_result])


27
# File 'sig/anthropic/models/beta/messages/beta_message_batch_result.rbs', line 27

def self?.variants: -> ::Array[Anthropic::Models::Beta::Messages::beta_message_batch_result]