Module: Anthropic::Models::Beta::BetaContentBlock

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

Overview

Response model for a file uploaded to the container.

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

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

Parameters:

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

    Attributes for the chosen variant.

    @option args [Array<Anthropic::Models::Beta::BetaCitationCharLocation, Anthropic::Models::Beta::BetaCitationPageLocation, Anthropic::Models::Beta::BetaCitationContentBlockLocation, Anthropic::Models::Beta::BetaCitationsWebSearchResultLocation, Anthropic::Models::Beta::BetaCitationSearchResultLocation>, 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 [HashSymbol=>Object] :input

    @option args [String, Symbol, Anthropic::Models::Beta::BetaServerToolUseBlock::Name] :name The name of the MCP tool

    @option args [Anthropic::Models::Beta::BetaDirectCaller, Anthropic::Models::Beta::BetaServerToolCaller, Anthropic::Models::Beta::BetaServerToolCaller20260120] :caller_ Tool invocation directly from the model.

    @option args [Anthropic::Models::Beta::BetaWebSearchToolResultError, ArrayAnthropic::Models::Beta::BetaWebSearchResultBlock, Anthropic::Models::Beta::BetaWebFetchToolResultErrorBlock, Anthropic::Models::Beta::BetaWebFetchBlock, Anthropic::Models::Beta::BetaAdvisorToolResultError, Anthropic::Models::Beta::BetaAdvisorResultBlock, Anthropic::Models::Beta::BetaAdvisorRedactedResultBlock, Anthropic::Models::Beta::BetaCodeExecutionToolResultError, Anthropic::Models::Beta::BetaCodeExecutionResultBlock, Anthropic::Models::Beta::BetaEncryptedCodeExecutionResultBlock, Anthropic::Models::Beta::BetaBashCodeExecutionToolResultError, Anthropic::Models::Beta::BetaBashCodeExecutionResultBlock, Anthropic::Models::Beta::BetaTextEditorCodeExecutionToolResultError, Anthropic::Models::Beta::BetaTextEditorCodeExecutionViewResultBlock, Anthropic::Models::Beta::BetaTextEditorCodeExecutionCreateResultBlock, Anthropic::Models::Beta::BetaTextEditorCodeExecutionStrReplaceResultBlock, Anthropic::Models::Beta::BetaToolSearchToolResultError, Anthropic::Models::Beta::BetaToolSearchToolSearchResultBlock, String, ArrayAnthropic::Models::Beta::BetaTextBlock, String, nil] :content Code execution result with encrypted stdout for PFC + web_search results.

    @option args [String] :tool_use_id

    @option args [String] :server_name The name of the MCP server

    @option args [Boolean] :is_error

    @option args [String] :file_id

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

    @option args [Anthropic::Models::Beta::BetaFallbackInfo] :from The model whose output ends at this point — the model that declined at this hop.

    @option args [Anthropic::Models::Beta::BetaFallbackInfo] :to The fallback model producing the content that follows this block. Its model is

    @option args [Anthropic::Models::Beta::BetaFallbackRefusalTrigger] :trigger What caused the from model to hand over at this hop.

Returns:

Raises:

  • (ArgumentError)


115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/anthropic/models/beta/beta_content_block.rb', line 115

def self.new(type:, **args)
  case type.to_sym
  when :text
    Anthropic::Beta::BetaTextBlock.new(**args)
  when :thinking
    Anthropic::Beta::BetaThinkingBlock.new(**args)
  when :redacted_thinking
    Anthropic::Beta::BetaRedactedThinkingBlock.new(**args)
  when :tool_use
    Anthropic::Beta::BetaToolUseBlock.new(**args)
  when :server_tool_use
    Anthropic::Beta::BetaServerToolUseBlock.new(**args)
  when :web_search_tool_result
    Anthropic::Beta::BetaWebSearchToolResultBlock.new(**args)
  when :web_fetch_tool_result
    Anthropic::Beta::BetaWebFetchToolResultBlock.new(**args)
  when :advisor_tool_result
    Anthropic::Beta::BetaAdvisorToolResultBlock.new(**args)
  when :code_execution_tool_result
    Anthropic::Beta::BetaCodeExecutionToolResultBlock.new(**args)
  when :bash_code_execution_tool_result
    Anthropic::Beta::BetaBashCodeExecutionToolResultBlock.new(**args)
  when :text_editor_code_execution_tool_result
    Anthropic::Beta::BetaTextEditorCodeExecutionToolResultBlock.new(**args)
  when :tool_search_tool_result
    Anthropic::Beta::BetaToolSearchToolResultBlock.new(**args)
  when :mcp_tool_use
    Anthropic::Beta::BetaMCPToolUseBlock.new(**args)
  when :mcp_tool_result
    Anthropic::Beta::BetaMCPToolResultBlock.new(**args)
  when :container_upload
    Anthropic::Beta::BetaContainerUploadBlock.new(**args)
  when :compaction
    Anthropic::Beta::BetaCompactionBlock.new(**args)
  when :fallback
    Anthropic::Beta::BetaFallbackBlock.new(**args)
  else
    raise ArgumentError, "unknown type: #{type}"
  end
end

.variantsArray(Anthropic::Models::Beta::BetaTextBlock, Anthropic::Models::Beta::BetaThinkingBlock, Anthropic::Models::Beta::BetaRedactedThinkingBlock, Anthropic::Models::Beta::BetaToolUseBlock, Anthropic::Models::Beta::BetaServerToolUseBlock, Anthropic::Models::Beta::BetaWebSearchToolResultBlock, Anthropic::Models::Beta::BetaWebFetchToolResultBlock, Anthropic::Models::Beta::BetaAdvisorToolResultBlock, Anthropic::Models::Beta::BetaCodeExecutionToolResultBlock, Anthropic::Models::Beta::BetaBashCodeExecutionToolResultBlock, Anthropic::Models::Beta::BetaTextEditorCodeExecutionToolResultBlock, Anthropic::Models::Beta::BetaToolSearchToolResultBlock, Anthropic::Models::Beta::BetaMCPToolUseBlock, Anthropic::Models::Beta::BetaMCPToolResultBlock, Anthropic::Models::Beta::BetaContainerUploadBlock, Anthropic::Models::Beta::BetaCompactionBlock, Anthropic::Models::Beta::BetaFallbackBlock)



# File 'lib/anthropic/models/beta/beta_content_block.rb', line 64