Module: Anthropic::Models::MessageParam
- Extended by:
- Internal::Type::Union
- Defined in:
- lib/anthropic/models/message_param.rb,
sig/anthropic/models/message_param.rbs
Defined Under Namespace
Modules: Role
Class Method Summary collapse
-
.new(role:, **args) ⇒ Anthropic::Models::UserMessageParam, ...
Creates a new instance of the variant class whose
rolematches the given value, passing the remaining arguments to its constructor. - .values ⇒ Array<Symbol>
- .variants ⇒ Array(Anthropic::Models::UserMessageParam, Anthropic::Models::AssistantMessageParam, Anthropic::Models::SystemMessageParam)
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(role:, content:) ⇒ Anthropic::UserMessageParam .new(role:, content:) ⇒ Anthropic::AssistantMessageParam .new(role:, content:) ⇒ Anthropic::SystemMessageParam .new(role:, content:) ⇒ Anthropic::Models::message_param
Creates a new instance of the variant class whose role matches the given
value, passing the remaining arguments to its constructor.
41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/anthropic/models/message_param.rb', line 41 def self.new(role:, **args) case role.to_sym when :user Anthropic::UserMessageParam.new(**args) when :assistant Anthropic::AssistantMessageParam.new(**args) when :system Anthropic::SystemMessageParam.new(**args) else raise ArgumentError, "unknown role: #{role}" end end |
.values ⇒ Array<Symbol>
|
|
# File 'lib/anthropic/models/message_param.rb', line 23
|
.variants ⇒ Array(Anthropic::Models::UserMessageParam, Anthropic::Models::AssistantMessageParam, Anthropic::Models::SystemMessageParam)
|
|
# File 'lib/anthropic/models/message_param.rb', line 27
|