Module: Anthropic::Models::Beta::BetaSystemMessageParam::Content::Block

Extended by:
Internal::Type::Union
Defined in:
lib/anthropic/models/beta/beta_system_message_param.rb,
sig/anthropic/models/beta/beta_system_message_param.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:, cache_control:, citations:) ⇒ Anthropic::Beta::BetaTextBlockParam .new(type:, tool:, cache_control:) ⇒ Anthropic::Beta::BetaRequestToolAdditionBlock .new(type:, tool:, cache_control:) ⇒ Anthropic::Beta::BetaRequestToolRemovalBlock .new(type:, text:, cache_control:, citations:, tool:) ⇒ Anthropic::Models::Beta::BetaSystemMessageParam::Content::block

Creates a new instance of the variant class whose type matches the given value, passing the remaining arguments to its constructor.

Overloads:

  • .new(type:, text:, cache_control:, citations:) ⇒ Anthropic::Beta::BetaTextBlockParam

    Parameters:

    • type: (:text, "text")
    • text: (String)
    • cache_control: (Anthropic::Beta::BetaCacheControlEphemeral, nil)
    • citations: (::Array[Anthropic::Models::Beta::beta_text_citation_param], nil)

    Returns:

    • (Anthropic::Beta::BetaTextBlockParam)
  • .new(type:, tool:, cache_control:) ⇒ Anthropic::Beta::BetaRequestToolAdditionBlock

    Parameters:

    • type: (:tool_addition, "tool_addition")
    • tool: (Anthropic::Models::Beta::BetaRequestToolAdditionBlock::tool)
    • cache_control: (Anthropic::Beta::BetaCacheControlEphemeral, nil)

    Returns:

    • (Anthropic::Beta::BetaRequestToolAdditionBlock)
  • .new(type:, tool:, cache_control:) ⇒ Anthropic::Beta::BetaRequestToolRemovalBlock

    Parameters:

    • type: (:tool_removal, "tool_removal")
    • tool: (Anthropic::Models::Beta::BetaRequestToolRemovalBlock::tool)
    • cache_control: (Anthropic::Beta::BetaCacheControlEphemeral, nil)

    Returns:

    • (Anthropic::Beta::BetaRequestToolRemovalBlock)
  • .new(type:, text:, cache_control:, citations:, tool:) ⇒ Anthropic::Models::Beta::BetaSystemMessageParam::Content::block

    Parameters:

    • type: (Anthropic::Models::Beta::BetaSystemMessageParam::Content::Block::type_, String)
    • text: (String)
    • cache_control: (Anthropic::Beta::BetaCacheControlEphemeral, nil)
    • citations: (::Array[Anthropic::Models::Beta::beta_text_citation_param], nil)
    • tool: (Anthropic::Models::Beta::BetaRequestToolAdditionBlock::tool, Anthropic::Models::Beta::BetaRequestToolRemovalBlock::tool)

    Returns:

    • (Anthropic::Models::Beta::BetaSystemMessageParam::Content::block)

Parameters:

  • type (Symbol, Anthropic::Models::Beta::BetaSystemMessageParam::Content::Block::Type, 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] :citations

    @option args [Anthropic::Models::Beta::BetaToolChangeToolReference, Anthropic::Models::Beta::BetaToolChangeMCPToolReference, Anthropic::Models::Beta::BetaToolChangeMCPToolsetReference, Anthropic::Models::Beta::BetaToolChangeToolDefinitionParam, Anthropic::Models::Beta::BetaToolChangeToolReference, Anthropic::Models::Beta::BetaToolChangeMCPToolReference, Anthropic::Models::Beta::BetaToolChangeMCPToolsetReference] :tool

Returns:

Raises:

  • (ArgumentError)


132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/anthropic/models/beta/beta_system_message_param.rb', line 132

def self.new(type:, **args)
  case type.to_sym
  when :text
    Anthropic::Beta::BetaTextBlockParam.new(**args)
  when :tool_addition
    Anthropic::Beta::BetaRequestToolAdditionBlock.new(**args)
  when :tool_removal
    Anthropic::Beta::BetaRequestToolRemovalBlock.new(**args)
  else
    raise ArgumentError, "unknown type: #{type}"
  end
end

.values ⇒ Array<Symbol>

Returns:

  • (Array<Symbol>)


# File 'lib/anthropic/models/beta/beta_system_message_param.rb', line 108

.variants ⇒ Array(Anthropic::Models::Beta::BetaTextBlockParam, Anthropic::Models::Beta::BetaRequestToolAdditionBlock, Anthropic::Models::Beta::BetaRequestToolRemovalBlock)



# File 'lib/anthropic/models/beta/beta_system_message_param.rb', line 112