Module: Anthropic::Models::Beta::BetaRawContentBlockDelta

Extended by:
Internal::Type::Union
Defined in:
lib/anthropic/models/beta/beta_raw_content_block_delta.rb,
sig/anthropic/models/beta/beta_raw_content_block_delta.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:, text:) ⇒ Anthropic::Beta::BetaTextDelta .new(type:, partial_json:) ⇒ Anthropic::Beta::BetaInputJSONDelta .new(type:, citation:) ⇒ Anthropic::Beta::BetaCitationsDelta .new(type:, estimated_tokens:, thinking:) ⇒ Anthropic::Beta::BetaThinkingDelta .new(type:, signature:) ⇒ Anthropic::Beta::BetaSignatureDelta .new(type:, content:, encrypted_content:) ⇒ Anthropic::Beta::BetaCompactionContentBlockDelta .new(type:, text:, partial_json:, citation:, estimated_tokens:, thinking:, signature:, content:, encrypted_content:) ⇒ Anthropic::Models::Beta::beta_raw_content_block_delta

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

Overloads:

  • .new(type:, text:) ⇒ Anthropic::Beta::BetaTextDelta

    Parameters:

    • type: (:text_delta, "text_delta")
    • text: (String)

    Returns:

    • (Anthropic::Beta::BetaTextDelta)
  • .new(type:, partial_json:) ⇒ Anthropic::Beta::BetaInputJSONDelta

    Parameters:

    • type: (:input_json_delta, "input_json_delta")
    • partial_json: (String)

    Returns:

    • (Anthropic::Beta::BetaInputJSONDelta)
  • .new(type:, citation:) ⇒ Anthropic::Beta::BetaCitationsDelta

    Parameters:

    • type: (:citations_delta, "citations_delta")
    • citation: (Anthropic::Models::Beta::BetaCitationsDelta::citation)

    Returns:

    • (Anthropic::Beta::BetaCitationsDelta)
  • .new(type:, estimated_tokens:, thinking:) ⇒ Anthropic::Beta::BetaThinkingDelta

    Parameters:

    • type: (:thinking_delta, "thinking_delta")
    • estimated_tokens: (Integer, nil)
    • thinking: (String)

    Returns:

    • (Anthropic::Beta::BetaThinkingDelta)
  • .new(type:, signature:) ⇒ Anthropic::Beta::BetaSignatureDelta

    Parameters:

    • type: (:signature_delta, "signature_delta")
    • signature: (String)

    Returns:

    • (Anthropic::Beta::BetaSignatureDelta)
  • .new(type:, content:, encrypted_content:) ⇒ Anthropic::Beta::BetaCompactionContentBlockDelta

    Parameters:

    • type: (:compaction_delta, "compaction_delta")
    • content: (String, nil)
    • encrypted_content: (String, nil)

    Returns:

    • (Anthropic::Beta::BetaCompactionContentBlockDelta)
  • .new(type:, text:, partial_json:, citation:, estimated_tokens:, thinking:, signature:, content:, encrypted_content:) ⇒ Anthropic::Models::Beta::beta_raw_content_block_delta

    Parameters:

    • type: (Anthropic::Models::Beta::BetaRawContentBlockDelta::type_, String)
    • text: (String)
    • partial_json: (String)
    • citation: (Anthropic::Models::Beta::BetaCitationsDelta::citation)
    • estimated_tokens: (Integer, nil)
    • thinking: (String)
    • signature: (String)
    • content: (String, nil)
    • encrypted_content: (String, nil)

    Returns:

    • (Anthropic::Models::Beta::beta_raw_content_block_delta)

Parameters:

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

    Attributes for the chosen variant.

    @option args [String] :text

    @option args [String] :partial_json

    @option args [Anthropic::Models::Beta::BetaCitationCharLocation, Anthropic::Models::Beta::BetaCitationPageLocation, Anthropic::Models::Beta::BetaCitationContentBlockLocation, Anthropic::Models::Beta::BetaCitationsWebSearchResultLocation, Anthropic::Models::Beta::BetaCitationSearchResultLocation] :citation

    @option args [Integer, nil] :estimated_tokens Per-frame increment of a coarse, running estimate of the tokens this thinking bl

    @option args [String] :thinking The incremental thinking text for this content block. Concatenate the

    @option args [String] :signature The signature for this thinking block: an opaque value used to verify that the

    @option args [String, nil] :content

    @option args [String, nil] :encrypted_content Opaque metadata from prior compaction, to be round-tripped verbatim

Returns:

Raises:

  • (ArgumentError)


68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/anthropic/models/beta/beta_raw_content_block_delta.rb', line 68

def self.new(type:, **args)
  case type.to_sym
  when :text_delta
    Anthropic::Beta::BetaTextDelta.new(**args)
  when :input_json_delta
    Anthropic::Beta::BetaInputJSONDelta.new(**args)
  when :citations_delta
    Anthropic::Beta::BetaCitationsDelta.new(**args)
  when :thinking_delta
    Anthropic::Beta::BetaThinkingDelta.new(**args)
  when :signature_delta
    Anthropic::Beta::BetaSignatureDelta.new(**args)
  when :compaction_delta
    Anthropic::Beta::BetaCompactionContentBlockDelta.new(**args)
  else
    raise ArgumentError, "unknown type: #{type}"
  end
end

.values ⇒ Array<Symbol>

Returns:

  • (Array<Symbol>)


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

.variants ⇒ Array(Anthropic::Models::Beta::BetaTextDelta, Anthropic::Models::Beta::BetaInputJSONDelta, Anthropic::Models::Beta::BetaCitationsDelta, Anthropic::Models::Beta::BetaThinkingDelta, Anthropic::Models::Beta::BetaSignatureDelta, Anthropic::Models::Beta::BetaCompactionContentBlockDelta)



# File 'lib/anthropic/models/beta/beta_raw_content_block_delta.rb', line 37