Class: Anthropic::Models::Beta::BetaRefusalStopDetails

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

Defined Under Namespace

Modules: Category

Instance Attribute 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(category:, explanation:, fallback_credit_token:, fallback_has_prefill_claim:, recommended_model:, type: :refusal) ⇒ Object

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

Structured information about a refusal.

Parameters:

  • category (Symbol, Anthropic::Models::Beta::BetaRefusalStopDetails::Category, nil)

    The policy category that triggered a refusal.

  • explanation (String, nil)

    Human-readable explanation of the refusal.

  • fallback_credit_token (String, nil)

    Opaque code that refunds the cache-miss cost when retrying this refused

  • fallback_has_prefill_claim (Boolean, nil)

    Whether the accompanying fallback_credit_token may be redeemed with the

  • recommended_model (String, nil)

    The server's suggested retry target for this refusal. Populated when a fallback

  • type (Symbol, :refusal) (defaults to: :refusal)


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

Instance Attribute Details

#categorySymbol, ...

The policy category that triggered a refusal.

Parameters:

  • value (Anthropic::Models::Beta::BetaRefusalStopDetails::category, nil)

Returns:



11
# File 'lib/anthropic/models/beta/beta_refusal_stop_details.rb', line 11

required :category, enum: -> { Anthropic::Beta::BetaRefusalStopDetails::Category }, nil?: true

#explanationString?

Human-readable explanation of the refusal.

This text is not guaranteed to be stable. null when no explanation is available for the category.

Parameters:

  • value (String, nil)

Returns:

  • (String, nil)


20
# File 'lib/anthropic/models/beta/beta_refusal_stop_details.rb', line 20

required :explanation, String, nil?: true

#fallback_credit_tokenString?

Opaque code that refunds the cache-miss cost when retrying this refused request on the fallback model. Pass it as fallback_credit_token on the retry request. Expires 5 minutes after the refusal.

The retry is sent either with the same request body (system, messages, tools, and other render-shaping fields), or with the same body plus one appended assistant message whose content is the partial text (with any trailing whitespace stripped from the final text block) and paired server-tool blocks from this refusal — which also authorizes that appended turn as an assistant-prefill continuation on models that otherwise disallow prefill. A token minted mid-server-tool-loop whose partial content was continuable may only be redeemed the second way — if a same-body retry is rejected with a 400 saying the token must be redeemed by continuing the partial response, retry the second way instead. Either way: same workspace, same platform; a mismatch is a 400. Resending a token for an already-warm prefix is permitted but yields no additional credit.

null when the refused model isn't eligible for a fallback credit.

Parameters:

  • value (String, nil)

Returns:

  • (String, nil)


43
# File 'lib/anthropic/models/beta/beta_refusal_stop_details.rb', line 43

required :fallback_credit_token, String, nil?: true

#fallback_has_prefill_claimBoolean?

Whether the accompanying fallback_credit_token may be redeemed with the appended-assistant retry form. Only set when fallback_credit_token is present.

true: retry by resending the same request body plus one appended assistant message whose content is this response's content with any trailing whitespace stripped from the final text block and unpaired tool_use blocks omitted (the same appended-turn shape described on fallback_credit_token), with the token attached. false: retry by resending the original request body unchanged, with the token attached — the appended-assistant form is not available for this refusal (no continuable partial content, or the request uses output_format or a tool_choice that forces tool use). One exception: when the request used output_format or a forced tool_choice and the refusal arrived after server tools (including MCP connector tools) had already executed, the token may not be redeemable by either retry form; if the exact-body retry is then rejected with a 400 saying the token must be redeemed by continuing the partial response, discard the token and retry without it.

Advisory: if an appended-assistant retry is rejected with a 400 despite true, fall back to resending the original request body with the token.

Parameters:

Returns:



67
# File 'lib/anthropic/models/beta/beta_refusal_stop_details.rb', line 67

required :fallback_has_prefill_claim, Anthropic::Internal::Type::Boolean, nil?: true

The server's suggested retry target for this refusal. Populated when a fallback attempt could not be made (the fallback model's rate limit was exhausted, or it was overloaded); names the fallback model the caller can retry directly. Null otherwise.

Parameters:

  • value (String, nil)

Returns:

  • (String, nil)


76
# File 'lib/anthropic/models/beta/beta_refusal_stop_details.rb', line 76

required :recommended_model, String, nil?: true

#typeSymbol, :refusal

Parameters:

  • value (:refusal)

Returns:

  • (Symbol, :refusal)


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

required :type, const: :refusal

Instance Method Details

#to_hash{

Returns:

  • ({)


38
# File 'sig/anthropic/models/beta/beta_refusal_stop_details.rbs', line 38

def to_hash: -> {