Module: Anthropic::Models::RawContentBlockStartEvent::ContentBlock

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

Overview

Response model for a file uploaded to the container.

See Also:

  • Anthropic::Models::RawContentBlockStartEvent#content_block

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::TextBlock, ...

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

Parameters:

  • type (Symbol, String)
  • args (Hash{Symbol=>Object})

    Attributes for the chosen variant.

    @option args [Array<Anthropic::Models::CitationCharLocation, Anthropic::Models::CitationPageLocation, Anthropic::Models::CitationContentBlockLocation, Anthropic::Models::CitationsWebSearchResultLocation, Anthropic::Models::CitationsSearchResultLocation>, nil] :citations Citations supporting the text block.

    @option args [String] :text

    @option args [String] :signature A value used to verify that this thinking block was generated by Claude when it

    @option args [String] :thinking The text of Claude's thinking process for this block.

    @option args [String] :data The contents of this redacted thinking block, returned when portions of the mode

    @option args [String] :id

    @option args [Anthropic::Models::DirectCaller, Anthropic::Models::ServerToolCaller, Anthropic::Models::ServerToolCaller20260120] :caller_ Tool invocation directly from the model.

    @option args [HashSymbol=>Object] :input

    @option args [String, Symbol, Anthropic::Models::ServerToolUseBlock::Name] :name

    @option args [Anthropic::Models::WebSearchToolResultError, ArrayAnthropic::Models::WebSearchResultBlock, Anthropic::Models::WebFetchToolResultErrorBlock, Anthropic::Models::WebFetchBlock, Anthropic::Models::CodeExecutionToolResultError, Anthropic::Models::CodeExecutionResultBlock, Anthropic::Models::EncryptedCodeExecutionResultBlock, Anthropic::Models::BashCodeExecutionToolResultError, Anthropic::Models::BashCodeExecutionResultBlock, Anthropic::Models::TextEditorCodeExecutionToolResultError, Anthropic::Models::TextEditorCodeExecutionViewResultBlock, Anthropic::Models::TextEditorCodeExecutionCreateResultBlock, Anthropic::Models::TextEditorCodeExecutionStrReplaceResultBlock, Anthropic::Models::ToolSearchToolResultError, Anthropic::Models::ToolSearchToolSearchResultBlock] :content Code execution result with encrypted stdout for PFC + web_search results.

    @option args [String] :tool_use_id

    @option args [String] :file_id

Returns:

Raises:

  • (ArgumentError)


101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/anthropic/models/raw_content_block_start_event.rb', line 101

def self.new(type:, **args)
  case type.to_sym
  when :text
    Anthropic::TextBlock.new(**args)
  when :thinking
    Anthropic::ThinkingBlock.new(**args)
  when :redacted_thinking
    Anthropic::RedactedThinkingBlock.new(**args)
  when :tool_use
    Anthropic::ToolUseBlock.new(**args)
  when :server_tool_use
    Anthropic::ServerToolUseBlock.new(**args)
  when :web_search_tool_result
    Anthropic::WebSearchToolResultBlock.new(**args)
  when :web_fetch_tool_result
    Anthropic::WebFetchToolResultBlock.new(**args)
  when :code_execution_tool_result
    Anthropic::CodeExecutionToolResultBlock.new(**args)
  when :bash_code_execution_tool_result
    Anthropic::BashCodeExecutionToolResultBlock.new(**args)
  when :text_editor_code_execution_tool_result
    Anthropic::TextEditorCodeExecutionToolResultBlock.new(**args)
  when :tool_search_tool_result
    Anthropic::ToolSearchToolResultBlock.new(**args)
  when :container_upload
    Anthropic::ContainerUploadBlock.new(**args)
  else
    raise ArgumentError, "unknown type: #{type}"
  end
end

Instance Method Details

#self?.variants::Array[Anthropic::Models::RawContentBlockStartEvent::content_block]

Returns:

  • (::Array[Anthropic::Models::RawContentBlockStartEvent::content_block])


46
# File 'sig/anthropic/models/raw_content_block_start_event.rbs', line 46

def self?.variants: -> ::Array[Anthropic::Models::RawContentBlockStartEvent::content_block]