Module: Anthropic::Models::RawContentBlockDelta

Extended by:
Internal::Type::Union
Defined in:
lib/anthropic/models/raw_content_block_delta.rb,
sig/anthropic/models/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::TextDelta .new(type:, partial_json:) ⇒ Anthropic::InputJSONDelta .new(type:, citation:) ⇒ Anthropic::CitationsDelta .new(type:, thinking:) ⇒ Anthropic::ThinkingDelta .new(type:, signature:) ⇒ Anthropic::SignatureDelta .new(type:, text:, partial_json:, citation:, thinking:, signature:) ⇒ Anthropic::Models::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::RawContentBlockDelta for more details.

Overloads:

  • .new(type:, text:) ⇒ Anthropic::TextDelta

    Parameters:

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

    Returns:

  • .new(type:, partial_json:) ⇒ Anthropic::InputJSONDelta

    Parameters:

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

    Returns:

  • .new(type:, citation:) ⇒ Anthropic::CitationsDelta

    Parameters:

    • type: (:citations_delta, "citations_delta")
    • citation: (Anthropic::Models::CitationsDelta::citation)

    Returns:

  • .new(type:, thinking:) ⇒ Anthropic::ThinkingDelta

    Parameters:

    • type: (:thinking_delta, "thinking_delta")
    • thinking: (String)

    Returns:

  • .new(type:, signature:) ⇒ Anthropic::SignatureDelta

    Parameters:

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

    Returns:

  • .new(type:, text:, partial_json:, citation:, thinking:, signature:) ⇒ Anthropic::Models::raw_content_block_delta

    Parameters:

    • type: (Anthropic::Models::RawContentBlockDelta::type_, String)
    • text: (String)
    • partial_json: (String)
    • citation: (Anthropic::Models::CitationsDelta::citation)
    • thinking: (String)
    • signature: (String)

    Returns:

    • (Anthropic::Models::raw_content_block_delta)

Parameters:

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

    Attributes for the chosen variant.

    @option args [String] :text

    @option args [String] :partial_json

    @option args [Anthropic::Models::CitationCharLocation, Anthropic::Models::CitationPageLocation, Anthropic::Models::CitationContentBlockLocation, Anthropic::Models::CitationsWebSearchResultLocation, Anthropic::Models::CitationsSearchResultLocation] :citation

    @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

Returns:

Raises:

  • (ArgumentError)


58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/anthropic/models/raw_content_block_delta.rb', line 58

def self.new(type:, **args)
  case type.to_sym
  when :text_delta
    Anthropic::TextDelta.new(**args)
  when :input_json_delta
    Anthropic::InputJSONDelta.new(**args)
  when :citations_delta
    Anthropic::CitationsDelta.new(**args)
  when :thinking_delta
    Anthropic::ThinkingDelta.new(**args)
  when :signature_delta
    Anthropic::SignatureDelta.new(**args)
  else
    raise ArgumentError, "unknown type: #{type}"
  end
end

.values ⇒ Array<Symbol>

Returns:

  • (Array<Symbol>)


# File 'lib/anthropic/models/raw_content_block_delta.rb', line 29

.variants ⇒ Array(Anthropic::Models::TextDelta, Anthropic::Models::InputJSONDelta, Anthropic::Models::CitationsDelta, Anthropic::Models::ThinkingDelta, Anthropic::Models::SignatureDelta)



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