Class: Anthropic::Models::Beta::BetaRefusalStopDetails
- Inherits:
-
Internal::Type::BaseModel
- Object
- Internal::Type::BaseModel
- Anthropic::Models::Beta::BetaRefusalStopDetails
- Defined in:
- lib/anthropic/models/beta/beta_refusal_stop_details.rb
Defined Under Namespace
Modules: Category
Instance Attribute Summary collapse
-
#category ⇒ Symbol, ...
The policy category that triggered the refusal.
-
#explanation ⇒ String?
Human-readable explanation of the refusal.
-
#fallback_credit_token ⇒ String?
Opaque code that refunds the cache-miss cost when retrying this refused request on the fallback model.
-
#fallback_has_prefill_claim ⇒ Boolean?
Whether the accompanying ‘fallback_credit_token` may be redeemed with the appended-assistant retry form.
-
#recommended_model ⇒ String?
The server’s suggested retry target for this refusal.
- #type ⇒ Symbol, :refusal
Instance Method Summary collapse
-
#initialize(category:, explanation:, fallback_credit_token:, fallback_has_prefill_claim:, recommended_model:, type: :refusal) ⇒ Object
constructor
Some parameter documentations has been truncated, see BetaRefusalStopDetails for more details.
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.
|
|
# File 'lib/anthropic/models/beta/beta_refusal_stop_details.rb', line 85
|
Instance Attribute Details
#category ⇒ Symbol, ...
The policy category that triggered the refusal.
‘null` when the refusal doesn’t map to a named category.
13 |
# File 'lib/anthropic/models/beta/beta_refusal_stop_details.rb', line 13 required :category, enum: -> { Anthropic::Beta::BetaRefusalStopDetails::Category }, nil?: true |
#explanation ⇒ String?
Human-readable explanation of the refusal.
This text is not guaranteed to be stable. ‘null` when no explanation is available for the category.
22 |
# File 'lib/anthropic/models/beta/beta_refusal_stop_details.rb', line 22 required :explanation, String, nil?: true |
#fallback_credit_token ⇒ String?
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.
45 |
# File 'lib/anthropic/models/beta/beta_refusal_stop_details.rb', line 45 required :fallback_credit_token, String, nil?: true |
#fallback_has_prefill_claim ⇒ Boolean?
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.
69 |
# File 'lib/anthropic/models/beta/beta_refusal_stop_details.rb', line 69 required :fallback_has_prefill_claim, Anthropic::Internal::Type::Boolean, nil?: true |
#recommended_model ⇒ String?
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.
78 |
# File 'lib/anthropic/models/beta/beta_refusal_stop_details.rb', line 78 required :recommended_model, String, nil?: true |
#type ⇒ Symbol, :refusal
83 |
# File 'lib/anthropic/models/beta/beta_refusal_stop_details.rb', line 83 required :type, const: :refusal |