Module: Anthropic::Models::Beta::BetaContentBlockParam

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

Overview

Regular text content.

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

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

Parameters:

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

    Attributes for the chosen variant.

    @option args [String] :text

    @option args [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil] :cache_control Create a cache control breakpoint at this content block.

    @option args [Array<Anthropic::Models::Beta::BetaCitationCharLocationParam, Anthropic::Models::Beta::BetaCitationPageLocationParam, Anthropic::Models::Beta::BetaCitationContentBlockLocationParam, Anthropic::Models::Beta::BetaCitationWebSearchResultLocationParam, Anthropic::Models::Beta::BetaCitationSearchResultLocationParam>, nil, Anthropic::Models::Beta::BetaCitationsConfigParam, nil, Anthropic::Models::Beta::BetaCitationsConfigParam] :citations

    @option args [Anthropic::Models::Beta::BetaBase64ImageSource, Anthropic::Models::Beta::BetaURLImageSource, Anthropic::Models::Beta::BetaFileImageSource, Anthropic::Models::Beta::BetaBase64PDFSource, Anthropic::Models::Beta::BetaPlainTextSource, Anthropic::Models::Beta::BetaContentBlockSource, Anthropic::Models::Beta::BetaURLPDFSource, Anthropic::Models::Beta::BetaFileDocumentSource, String] :source

    @option args [String, nil] :context

    @option args [String, nil, String] :title

    @option args [ArrayAnthropic::Models::Beta::BetaTextBlockParam, String, Array<Anthropic::Models::Beta::BetaTextBlockParam, Anthropic::Models::Beta::BetaImageBlockParam, Anthropic::Models::Beta::BetaSearchResultBlockParam, Anthropic::Models::Beta::BetaRequestDocumentBlock, Anthropic::Models::Beta::BetaToolReferenceBlockParam>, ArrayAnthropic::Models::Beta::BetaWebSearchResultBlockParam, Anthropic::Models::Beta::BetaWebSearchToolRequestError, Anthropic::Models::Beta::BetaWebFetchToolResultErrorBlockParam, Anthropic::Models::Beta::BetaWebFetchBlockParam, Anthropic::Models::Beta::BetaAdvisorToolResultErrorParam, Anthropic::Models::Beta::BetaAdvisorResultBlockParam, Anthropic::Models::Beta::BetaAdvisorRedactedResultBlockParam, Anthropic::Models::Beta::BetaCodeExecutionToolResultErrorParam, Anthropic::Models::Beta::BetaCodeExecutionResultBlockParam, Anthropic::Models::Beta::BetaEncryptedCodeExecutionResultBlockParam, Anthropic::Models::Beta::BetaBashCodeExecutionToolResultErrorParam, Anthropic::Models::Beta::BetaBashCodeExecutionResultBlockParam, Anthropic::Models::Beta::BetaTextEditorCodeExecutionToolResultErrorParam, Anthropic::Models::Beta::BetaTextEditorCodeExecutionViewResultBlockParam, Anthropic::Models::Beta::BetaTextEditorCodeExecutionCreateResultBlockParam, Anthropic::Models::Beta::BetaTextEditorCodeExecutionStrReplaceResultBlockParam, Anthropic::Models::Beta::BetaToolSearchToolResultErrorParam, Anthropic::Models::Beta::BetaToolSearchToolSearchResultBlockParam, String, ArrayAnthropic::Models::Beta::BetaTextBlockParam, String, nil, Array<Anthropic::Models::Beta::BetaTextBlockParam, Anthropic::Models::Beta::BetaRequestToolAdditionBlock, Anthropic::Models::Beta::BetaRequestToolRemovalBlock>] :content Code execution result with encrypted stdout for PFC + web_search results.

    @option args [String] :signature The signature value of this thinking block, exactly as returned by the API in

    @option args [String] :thinking The thinking text of this block as returned by the API.

    @option args [String] :data The data value of this redacted thinking block, exactly as returned by the API

    @option args [String] :id

    @option args [HashSymbol=>Object] :input

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

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

    @option args [String] :tool_use_id

    @option args [Boolean] :is_error

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

    @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::BetaToolChangeToolReference, Anthropic::Models::Beta::BetaToolChangeMCPToolReference, Anthropic::Models::Beta::BetaToolChangeMCPToolsetReference] :tool Reference to a single tool the caller declared directly in

    @option args [Anthropic::Models::Beta::BetaFallbackInfoParam] :from Identifies one hop of a fallback transition.

    @option args [Anthropic::Models::Beta::BetaFallbackInfoParam] :to Identifies one hop of a fallback transition.

    @option args [Object] :trigger The response block's trigger, echoed verbatim. Accepted and ignored by the ser

Returns:

Raises:

  • (ArgumentError)


167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
# File 'lib/anthropic/models/beta/beta_content_block_param.rb', line 167

def self.new(type:, **args)
  case type.to_sym
  when :text
    Anthropic::Beta::BetaTextBlockParam.new(**args)
  when :image
    Anthropic::Beta::BetaImageBlockParam.new(**args)
  when :document
    Anthropic::Beta::BetaRequestDocumentBlock.new(**args)
  when :search_result
    Anthropic::Beta::BetaSearchResultBlockParam.new(**args)
  when :thinking
    Anthropic::Beta::BetaThinkingBlockParam.new(**args)
  when :redacted_thinking
    Anthropic::Beta::BetaRedactedThinkingBlockParam.new(**args)
  when :tool_use
    Anthropic::Beta::BetaToolUseBlockParam.new(**args)
  when :tool_result
    Anthropic::Beta::BetaToolResultBlockParam.new(**args)
  when :server_tool_use
    Anthropic::Beta::BetaServerToolUseBlockParam.new(**args)
  when :web_search_tool_result
    Anthropic::Beta::BetaWebSearchToolResultBlockParam.new(**args)
  when :web_fetch_tool_result
    Anthropic::Beta::BetaWebFetchToolResultBlockParam.new(**args)
  when :advisor_tool_result
    Anthropic::Beta::BetaAdvisorToolResultBlockParam.new(**args)
  when :code_execution_tool_result
    Anthropic::Beta::BetaCodeExecutionToolResultBlockParam.new(**args)
  when :bash_code_execution_tool_result
    Anthropic::Beta::BetaBashCodeExecutionToolResultBlockParam.new(**args)
  when :text_editor_code_execution_tool_result
    Anthropic::Beta::BetaTextEditorCodeExecutionToolResultBlockParam.new(**args)
  when :tool_search_tool_result
    Anthropic::Beta::BetaToolSearchToolResultBlockParam.new(**args)
  when :mcp_tool_use
    Anthropic::Beta::BetaMCPToolUseBlockParam.new(**args)
  when :mcp_tool_result
    Anthropic::Beta::BetaRequestMCPToolResultBlockParam.new(**args)
  when :container_upload
    Anthropic::Beta::BetaContainerUploadBlockParam.new(**args)
  when :compaction
    Anthropic::Beta::BetaCompactionBlockParam.new(**args)
  when :mid_conv_system
    Anthropic::Beta::BetaMidConversationSystemBlockParam.new(**args)
  when :tool_addition
    Anthropic::Beta::BetaRequestToolAdditionBlock.new(**args)
  when :tool_removal
    Anthropic::Beta::BetaRequestToolRemovalBlock.new(**args)
  when :fallback
    Anthropic::Beta::BetaFallbackBlockParam.new(**args)
  else
    raise ArgumentError, "unknown type: #{type}"
  end
end

.variantsArray(Anthropic::Models::Beta::BetaTextBlockParam, Anthropic::Models::Beta::BetaImageBlockParam, Anthropic::Models::Beta::BetaRequestDocumentBlock, Anthropic::Models::Beta::BetaSearchResultBlockParam, Anthropic::Models::Beta::BetaThinkingBlockParam, Anthropic::Models::Beta::BetaRedactedThinkingBlockParam, Anthropic::Models::Beta::BetaToolUseBlockParam, Anthropic::Models::Beta::BetaToolResultBlockParam, Anthropic::Models::Beta::BetaServerToolUseBlockParam, Anthropic::Models::Beta::BetaWebSearchToolResultBlockParam, Anthropic::Models::Beta::BetaWebFetchToolResultBlockParam, Anthropic::Models::Beta::BetaAdvisorToolResultBlockParam, Anthropic::Models::Beta::BetaCodeExecutionToolResultBlockParam, Anthropic::Models::Beta::BetaBashCodeExecutionToolResultBlockParam, Anthropic::Models::Beta::BetaTextEditorCodeExecutionToolResultBlockParam, Anthropic::Models::Beta::BetaToolSearchToolResultBlockParam, Anthropic::Models::Beta::BetaMCPToolUseBlockParam, Anthropic::Models::Beta::BetaRequestMCPToolResultBlockParam, Anthropic::Models::Beta::BetaContainerUploadBlockParam, Anthropic::Models::Beta::BetaCompactionBlockParam, Anthropic::Models::Beta::BetaMidConversationSystemBlockParam, Anthropic::Models::Beta::BetaRequestToolAdditionBlock, Anthropic::Models::Beta::BetaRequestToolRemovalBlock, Anthropic::Models::Beta::BetaFallbackBlockParam)



# File 'lib/anthropic/models/beta/beta_content_block_param.rb', line 106