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.

Defined Under Namespace

Modules: Type

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 [Anthropic::Models::Beta::BetaImageTransformationsParam, nil] :transformations Configures the transformations the server applies to this image before the model

    @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, Anthropic::Models::Beta::BetaBrowserStateBlockParam>, 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] :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, nil] :toolset_name For a toolset member tool_use, the toolset family this member belongs to.

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


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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
# File 'lib/anthropic/models/beta/beta_content_block_param.rb', line 196

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 :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

.valuesArray<Symbol>

Returns:

  • (Array<Symbol>)


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

.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::BetaRequestToolAdditionBlock, Anthropic::Models::Beta::BetaRequestToolRemovalBlock, Anthropic::Models::Beta::BetaFallbackBlockParam)



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