Module: Anthropic::Models::Beta::BetaMessageThreadParam

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

Overview

Server-held conversation state (a Thread). {"type": "create"} asks the server to hold this conversation's state under the response's id; {"type": "continue", "previous_message_id": ...} resumes from a previous response so only the new turn's messages are sent. The response shape is unchanged.

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:) ⇒ Anthropic::Beta::BetaThreadCreateParams .new(type:, previous_message_id:) ⇒ Anthropic::Beta::BetaThreadContinueParams .new(type:, previous_message_id:) ⇒ Anthropic::Models::Beta::beta_message_thread_param

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

Overloads:

  • .new(type:) ⇒ Anthropic::Beta::BetaThreadCreateParams

    Parameters:

    • type: (:create, "create")

    Returns:

    • (Anthropic::Beta::BetaThreadCreateParams)
  • .new(type:, previous_message_id:) ⇒ Anthropic::Beta::BetaThreadContinueParams

    Parameters:

    • type: (:continue, "continue")
    • previous_message_id: (String)

    Returns:

    • (Anthropic::Beta::BetaThreadContinueParams)
  • .new(type:, previous_message_id:) ⇒ Anthropic::Models::Beta::beta_message_thread_param

    Parameters:

    • type: (Anthropic::Models::Beta::BetaMessageThreadParam::type_, String)
    • previous_message_id: (String)

    Returns:

    • (Anthropic::Models::Beta::beta_message_thread_param)

Parameters:

Returns:

Raises:

  • (ArgumentError)


46
47
48
49
50
51
52
53
54
55
# File 'lib/anthropic/models/beta/beta_message_thread_param.rb', line 46

def self.new(type:, **args)
  case type.to_sym
  when :create
    Anthropic::Beta::BetaThreadCreateParams.new(**args)
  when :continue
    Anthropic::Beta::BetaThreadContinueParams.new(**args)
  else
    raise ArgumentError, "unknown type: #{type}"
  end
end

.values ⇒ Array<Symbol>

Returns:

  • (Array<Symbol>)


# File 'lib/anthropic/models/beta/beta_message_thread_param.rb', line 28

.variants ⇒ Array(Anthropic::Models::Beta::BetaThreadCreateParams, Anthropic::Models::Beta::BetaThreadContinueParams)



# File 'lib/anthropic/models/beta/beta_message_thread_param.rb', line 32