Class: Anthropic::Models::Beta::BetaFallbackParam

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/anthropic/models/beta/beta_fallback_param.rb,
sig/anthropic/models/beta/beta_fallback_param.rbs

Defined Under Namespace

Modules: Speed, Thinking

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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(model:, max_tokens: nil, output_config: nil, speed: nil, thinking: nil) ⇒ BetaFallbackParam

One entry in the fallbacks chain on a /v1/messages request.

model is required. The override fields (max_tokens, thinking, output_config, and speed) set the corresponding parameter for this attempt only and are validated as if the request were made to model. Any other key is rejected at parse time.

Some parameter documentations has been truncated, see Anthropic::Models::Beta::BetaFallbackParam for more details.

Parameters:



# File 'lib/anthropic/models/beta/beta_fallback_param.rb', line 83

Instance Attribute Details

#max_tokens ⇒ Integer?

The max_tokens for the fallback attempt that uses this fallbacks entry's model, in place of the request's max_tokens. If you leave it out or set it to null, the attempt uses the request's max_tokens.

See the refusals and fallback guide to learn more about fallback entries.

Parameters:

  • value (Integer, nil)

Returns:

  • (Integer, nil)


26
# File 'lib/anthropic/models/beta/beta_fallback_param.rb', line 26

optional :max_tokens, Integer, nil?: true

#model ⇒ Symbol, ...

The model that will complete your prompt.

See models for additional details and options.

Parameters:

  • value (Anthropic::Models::model)

Returns:



14
# File 'lib/anthropic/models/beta/beta_fallback_param.rb', line 14

required :model, union: -> { Anthropic::Model }

#output_config ⇒ Anthropic::Models::Beta::BetaOutputConfig?

Output parameters for the fallback attempt that uses this fallbacks entry's model, combined with the request's output_config one field at a time.

  • format: If you leave it out, the attempt uses the request's format. If you set it to null, the attempt runs without a format.
  • effort: If you leave it out, the attempt uses the request's effort when model supports that level with the attempt's thinking. If the request doesn't set effort, if model doesn't support the level, or if you set effort to null, the attempt runs at the default effort of model.
  • task_budget: If you leave it out, the attempt uses the request's task_budget when model accepts a task budget of that size. If the request doesn't set task_budget, if model doesn't accept it, or if you set task_budget to null, the attempt runs without a task budget.

Set output_config to null to run the attempt without a format or a task budget, at the default effort of model.

These rules apply with the server-side-fallback-2026-07-01 beta header.

Parameters:

  • value (Anthropic::Beta::BetaOutputConfig, nil)

Returns:



49
# File 'lib/anthropic/models/beta/beta_fallback_param.rb', line 49

optional :output_config, -> { Anthropic::Beta::BetaOutputConfig }, nil?: true

#speed ⇒ Symbol, ...

The inference speed mode for the fallback attempt that uses this fallbacks entry's model. If you leave it out, the attempt runs at fast speed only when the request sets speed to fast and your organization can use fast mode on model.

Otherwise, or when you set this field to null, the attempt runs at standard speed.

These rules apply with the server-side-fallback-2026-07-01 beta header.

Parameters:

  • value (Anthropic::Models::Beta::BetaFallbackParam::speed, nil)

Returns:



63
# File 'lib/anthropic/models/beta/beta_fallback_param.rb', line 63

optional :speed, enum: -> { Anthropic::Beta::BetaFallbackParam::Speed }, nil?: true

#thinking ⇒ Anthropic::Models::Beta::BetaThinkingConfigEnabled, ...

The thinking configuration for the fallback attempt that uses this fallbacks entry's model. If you leave it out, the attempt uses the request's thinking when model supports that thinking type.

If you leave it out and the request's thinking type is between_tools but model doesn't support between_tools, the attempt uses disabled if model supports it. Otherwise, if model doesn't support the request's thinking type, if the request doesn't set thinking, or if you set this field to null, the attempt uses the thinking type that model uses when a request leaves out thinking. The request's thinking.display still applies where model allows it.

These rules apply with the server-side-fallback-2026-07-01 beta header.



81
# File 'lib/anthropic/models/beta/beta_fallback_param.rb', line 81

optional :thinking, union: -> { Anthropic::Beta::BetaFallbackParam::Thinking }, nil?: true

Class Method Details

.values ⇒ Array<Symbol>

Returns:

  • (Array<Symbol>)


# File 'lib/anthropic/models/beta/beta_fallback_param.rb', line 121

Instance Method Details

#to_hash ⇒ { model: Anthropic::Models::model, max_tokens: Integer?, output_config: Anthropic::Beta::BetaOutputConfig?, speed: Anthropic::Models::Beta::BetaFallbackParam::speed?, thinking: Anthropic::Models::Beta::BetaFallbackParam::thinking? }

Returns:

  • ({ model: Anthropic::Models::model, max_tokens: Integer?, output_config: Anthropic::Beta::BetaOutputConfig?, speed: Anthropic::Models::Beta::BetaFallbackParam::speed?, thinking: Anthropic::Models::Beta::BetaFallbackParam::thinking? })


34
35
36
37
38
39
40
# File 'sig/anthropic/models/beta/beta_fallback_param.rbs', line 34

def to_hash: -> {
  model: Anthropic::Models::model,
  max_tokens: Integer?,
  output_config: Anthropic::Beta::BetaOutputConfig?,
  speed: Anthropic::Models::Beta::BetaFallbackParam::speed?,
  thinking: Anthropic::Models::Beta::BetaFallbackParam::thinking?
}