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

Extended by:
Internal::Type::Union
Defined in:
lib/anthropic/models/beta/beta_raw_content_block_delta.rb

Class 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::BetaTextDelta, ...

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.

Parameters:

  • type (Symbol, 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 `thinkin

    @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)


54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/anthropic/models/beta/beta_raw_content_block_delta.rb', line 54

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