Class: Telnyx::Models::AI::Anthropic::V1MessagesParams

Inherits:
Internal::Type::BaseModel show all
Extended by:
Internal::Type::RequestParameters::Converter
Includes:
Internal::Type::RequestParameters
Defined in:
lib/telnyx/models/ai/anthropic/v1_messages_params.rb,
sig/telnyx/models/ai/anthropic/v1_messages_params.rbs

Overview

See Also:

  • Telnyx::Resources::AI::Anthropic::V1#messages

Defined Under Namespace

Modules: System

Instance Attribute Summary collapse

Attributes included from Internal::Type::RequestParameters

#request_options

Instance Method Summary collapse

Methods included from Internal::Type::RequestParameters::Converter

dump_request

Methods included from Internal::Type::RequestParameters

included

Methods inherited from Internal::Type::BaseModel

==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, fields, hash, #hash, inherited, inspect, #inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, #inspect, inspect, meta_info, new_coerce_state, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(max_tokens:, messages:, model:, api_key_ref: nil, billing_group_id: nil, fallback_config: nil, max_retries: nil, mcp_servers: nil, metadata: nil, service_tier: nil, stop_sequences: nil, stream: nil, system_: nil, temperature: nil, thinking: nil, timeout: nil, tool_choice: nil, tools: nil, top_k: nil, top_p: nil, request_options: {}) ⇒ Object

Some parameter documentations has been truncated, see Telnyx::Models::AI::Anthropic::V1MessagesParams for more details.

Parameters:

  • max_tokens (Integer)

    The maximum number of tokens to generate in the response.

  • messages (Array<Hash{Symbol=>Object}>)

    The messages to send to the model, following the [Anthropic Messages API](https:

  • model (String)

    The model to use for generating the response, for example zai-org/GLM-5.2 or a

  • api_key_ref (String) (defaults to: nil)

    If you are using an external inference provider, this field allows you to pass a

  • billing_group_id (String) (defaults to: nil)

    The billing group ID to associate with this request.

  • fallback_config (Hash{Symbol=>Object}) (defaults to: nil)

    Configuration for model fallback behavior when the primary model is unavailable.

  • max_retries (Integer) (defaults to: nil)

    Maximum number of retries for the request.

  • mcp_servers (Array<Hash{Symbol=>Object}>) (defaults to: nil)

    List of MCP (Model Context Protocol) servers to make available to the model.

  • metadata (Hash{Symbol=>Object}) (defaults to: nil)

    An object describing metadata about the request.

  • service_tier (String) (defaults to: nil)

    Service tier for the request.

  • stop_sequences (Array<String>) (defaults to: nil)

    Custom sequences that will cause the model to stop generating.

  • stream (Boolean) (defaults to: nil)

    Whether to stream the response as Anthropic-format Server-Sent Events.

  • system_ (String, Array<Hash{Symbol=>Object}>) (defaults to: nil)

    System prompt. Can be a string or an array of content blocks following the Anthr

  • temperature (Float) (defaults to: nil)

    Amount of randomness injected into the response. Ranges from 0 to 1.

  • thinking (Hash{Symbol=>Object}) (defaults to: nil)

    Extended thinking configuration for models that support it. Set type to `enabl

  • timeout (Float) (defaults to: nil)

    Request timeout in seconds.

  • tool_choice (Hash{Symbol=>Object}) (defaults to: nil)

    Controls how the model uses tools, following the Anthropic API format.

  • tools (Array<Hash{Symbol=>Object}>) (defaults to: nil)

    Definitions of tools that the model may use, following the Anthropic API format.

  • top_k (Integer) (defaults to: nil)

    Top-k sampling parameter. Only sample from the top K options for each subsequent

  • top_p (Float) (defaults to: nil)

    Nucleus sampling parameter. Use temperature or top_p, but not both.

  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}) (defaults to: {})


# File 'lib/telnyx/models/ai/anthropic/v1_messages_params.rb', line 143

Instance Attribute Details

#api_key_refString?

If you are using an external inference provider, this field allows you to pass along a reference to your API key. After creating an integration secret for your API key, pass the secret's identifier in this field.

Parameters:

  • (String)

Returns:

  • (String, nil)


40
# File 'lib/telnyx/models/ai/anthropic/v1_messages_params.rb', line 40

optional :api_key_ref, String

#billing_group_idString?

The billing group ID to associate with this request.

Parameters:

  • (String)

Returns:

  • (String, nil)


46
# File 'lib/telnyx/models/ai/anthropic/v1_messages_params.rb', line 46

optional :billing_group_id, String

#fallback_configHash{Symbol=>Object}?

Configuration for model fallback behavior when the primary model is unavailable.

Parameters:

  • (::Hash[Symbol, top])

Returns:

  • (Hash{Symbol=>Object}, nil)


52
# File 'lib/telnyx/models/ai/anthropic/v1_messages_params.rb', line 52

optional :fallback_config, Telnyx::Internal::Type::HashOf[Telnyx::Internal::Type::Unknown]

#max_retriesInteger?

Maximum number of retries for the request.

Parameters:

  • (Integer)

Returns:

  • (Integer, nil)


58
# File 'lib/telnyx/models/ai/anthropic/v1_messages_params.rb', line 58

optional :max_retries, Integer

#max_tokensInteger

The maximum number of tokens to generate in the response.

Parameters:

  • value (Integer)

Returns:

  • (Integer)


16
# File 'lib/telnyx/models/ai/anthropic/v1_messages_params.rb', line 16

required :max_tokens, Integer

#mcp_serversArray<Hash{Symbol=>Object}>?

List of MCP (Model Context Protocol) servers to make available to the model.

Returns:

  • (Array<Hash{Symbol=>Object}>, nil)


64
65
# File 'lib/telnyx/models/ai/anthropic/v1_messages_params.rb', line 64

optional :mcp_servers,
Telnyx::Internal::Type::ArrayOf[Telnyx::Internal::Type::HashOf[Telnyx::Internal::Type::Unknown]]

#messagesArray<Hash{Symbol=>Object}>

The messages to send to the model, following the Anthropic Messages API format.

Parameters:

  • value (::Array[::Hash[Symbol, top]])

Returns:

  • (Array<Hash{Symbol=>Object}>)


23
24
# File 'lib/telnyx/models/ai/anthropic/v1_messages_params.rb', line 23

required :messages,
Telnyx::Internal::Type::ArrayOf[Telnyx::Internal::Type::HashOf[Telnyx::Internal::Type::Unknown]]

#metadataHash{Symbol=>Object}?

An object describing metadata about the request.

Parameters:

  • (::Hash[Symbol, top])

Returns:

  • (Hash{Symbol=>Object}, nil)


71
# File 'lib/telnyx/models/ai/anthropic/v1_messages_params.rb', line 71

optional :metadata, Telnyx::Internal::Type::HashOf[Telnyx::Internal::Type::Unknown]

#modelString

The model to use for generating the response, for example zai-org/GLM-5.2 or another model available from the Telnyx models endpoint.

Parameters:

  • value (String)

Returns:

  • (String)


31
# File 'lib/telnyx/models/ai/anthropic/v1_messages_params.rb', line 31

required :model, String

#service_tierString?

Service tier for the request.

Parameters:

  • (String)

Returns:

  • (String, nil)


77
# File 'lib/telnyx/models/ai/anthropic/v1_messages_params.rb', line 77

optional :service_tier, String

#stop_sequencesArray<String>?

Custom sequences that will cause the model to stop generating.

Parameters:

  • (::Array[String])

Returns:

  • (Array<String>, nil)


83
# File 'lib/telnyx/models/ai/anthropic/v1_messages_params.rb', line 83

optional :stop_sequences, Telnyx::Internal::Type::ArrayOf[String]

#streamBoolean?

Whether to stream the response as Anthropic-format Server-Sent Events.

Parameters:

  • (Boolean)

Returns:

  • (Boolean, nil)


89
# File 'lib/telnyx/models/ai/anthropic/v1_messages_params.rb', line 89

optional :stream, Telnyx::Internal::Type::Boolean

#system_String, ...

System prompt. Can be a string or an array of content blocks following the Anthropic API format.

Returns:

  • (String, Array<Hash{Symbol=>Object}>, nil)


96
# File 'lib/telnyx/models/ai/anthropic/v1_messages_params.rb', line 96

optional :system_, union: -> { Telnyx::AI::Anthropic::V1MessagesParams::System }, api_name: :system

#temperatureFloat?

Amount of randomness injected into the response. Ranges from 0 to 1.

Parameters:

  • (Float)

Returns:

  • (Float, nil)


102
# File 'lib/telnyx/models/ai/anthropic/v1_messages_params.rb', line 102

optional :temperature, Float

#thinkingHash{Symbol=>Object}?

Extended thinking configuration for models that support it. Set type to enabled to turn on extended thinking.

Parameters:

  • (::Hash[Symbol, top])

Returns:

  • (Hash{Symbol=>Object}, nil)


109
# File 'lib/telnyx/models/ai/anthropic/v1_messages_params.rb', line 109

optional :thinking, Telnyx::Internal::Type::HashOf[Telnyx::Internal::Type::Unknown]

#timeoutFloat?

Request timeout in seconds.

Parameters:

  • (Float)

Returns:

  • (Float, nil)


115
# File 'lib/telnyx/models/ai/anthropic/v1_messages_params.rb', line 115

optional :timeout, Float

#tool_choiceHash{Symbol=>Object}?

Controls how the model uses tools, following the Anthropic API format.

Parameters:

  • (::Hash[Symbol, top])

Returns:

  • (Hash{Symbol=>Object}, nil)


121
# File 'lib/telnyx/models/ai/anthropic/v1_messages_params.rb', line 121

optional :tool_choice, Telnyx::Internal::Type::HashOf[Telnyx::Internal::Type::Unknown]

#toolsArray<Hash{Symbol=>Object}>?

Definitions of tools that the model may use, following the Anthropic API format.

Returns:

  • (Array<Hash{Symbol=>Object}>, nil)


127
128
# File 'lib/telnyx/models/ai/anthropic/v1_messages_params.rb', line 127

optional :tools,
Telnyx::Internal::Type::ArrayOf[Telnyx::Internal::Type::HashOf[Telnyx::Internal::Type::Unknown]]

#top_kInteger?

Top-k sampling parameter. Only sample from the top K options for each subsequent token.

Parameters:

  • (Integer)

Returns:

  • (Integer, nil)


135
# File 'lib/telnyx/models/ai/anthropic/v1_messages_params.rb', line 135

optional :top_k, Integer

#top_pFloat?

Nucleus sampling parameter. Use temperature or top_p, but not both.

Parameters:

  • (Float)

Returns:

  • (Float, nil)


141
# File 'lib/telnyx/models/ai/anthropic/v1_messages_params.rb', line 141

optional :top_p, Float

Instance Method Details

#to_hash{

Returns:

  • ({)


138
# File 'sig/telnyx/models/ai/anthropic/v1_messages_params.rbs', line 138

def to_hash: -> {