Class BetaRefusalStopDetails.Builder
-
- All Implemented Interfaces:
public final class BetaRefusalStopDetails.BuilderA builder for BetaRefusalStopDetails.
-
-
Method Summary
-
-
Method Detail
-
category
final BetaRefusalStopDetails.Builder category(BetaRefusalStopDetails.Category category)
The policy category that triggered the refusal.
nullwhen the refusal doesn't map to a named category.
-
category
final BetaRefusalStopDetails.Builder category(Optional<BetaRefusalStopDetails.Category> category)
Alias for calling Builder.category with
category.orElse(null).
-
category
final BetaRefusalStopDetails.Builder category(JsonField<BetaRefusalStopDetails.Category> category)
Sets Builder.category to an arbitrary JSON value.
You should usually call Builder.category with a well-typed Category value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
explanation
final BetaRefusalStopDetails.Builder explanation(String explanation)
Human-readable explanation of the refusal.
This text is not guaranteed to be stable.
nullwhen no explanation is available for the category.
-
explanation
final BetaRefusalStopDetails.Builder explanation(Optional<String> explanation)
Alias for calling Builder.explanation with
explanation.orElse(null).
-
explanation
final BetaRefusalStopDetails.Builder explanation(JsonField<String> explanation)
Sets Builder.explanation to an arbitrary JSON value.
You should usually call Builder.explanation with a well-typed String value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
fallbackCreditToken
final BetaRefusalStopDetails.Builder fallbackCreditToken(String fallbackCreditToken)
Opaque code that refunds the cache-miss cost when retrying this refused request on the fallback model. Pass it as
fallback_credit_tokenon 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 appendedassistantmessage 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.nullwhen the refused model isn't eligible for a fallback credit.
-
fallbackCreditToken
final BetaRefusalStopDetails.Builder fallbackCreditToken(Optional<String> fallbackCreditToken)
Alias for calling Builder.fallbackCreditToken with
fallbackCreditToken.orElse(null).
-
fallbackCreditToken
final BetaRefusalStopDetails.Builder fallbackCreditToken(JsonField<String> fallbackCreditToken)
Sets Builder.fallbackCreditToken to an arbitrary JSON value.
You should usually call Builder.fallbackCreditToken with a well-typed String value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
fallbackHasPrefillClaim
final BetaRefusalStopDetails.Builder fallbackHasPrefillClaim(Boolean fallbackHasPrefillClaim)
Whether the accompanying
fallback_credit_tokenmay be redeemed with the appended-assistant retry form. Only set whenfallback_credit_tokenis present.true: retry by resending the same request body plus one appendedassistantmessage whose content is this response'scontentwith any trailing whitespace stripped from the final text block and unpairedtool_useblocks omitted (the same appended-turn shape described onfallback_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 usesoutput_formator atool_choicethat forces tool use). One exception: when the request usedoutput_formator a forcedtool_choiceand 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.
-
fallbackHasPrefillClaim
final BetaRefusalStopDetails.Builder fallbackHasPrefillClaim(Boolean fallbackHasPrefillClaim)
Alias for Builder.fallbackHasPrefillClaim.
This unboxed primitive overload exists for backwards compatibility.
-
fallbackHasPrefillClaim
final BetaRefusalStopDetails.Builder fallbackHasPrefillClaim(Optional<Boolean> fallbackHasPrefillClaim)
Alias for calling Builder.fallbackHasPrefillClaim with
fallbackHasPrefillClaim.orElse(null).
-
fallbackHasPrefillClaim
final BetaRefusalStopDetails.Builder fallbackHasPrefillClaim(JsonField<Boolean> fallbackHasPrefillClaim)
Sets Builder.fallbackHasPrefillClaim to an arbitrary JSON value.
You should usually call Builder.fallbackHasPrefillClaim with a well-typed Boolean value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
recommendedModel
final BetaRefusalStopDetails.Builder recommendedModel(String recommendedModel)
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.
-
recommendedModel
final BetaRefusalStopDetails.Builder recommendedModel(Optional<String> recommendedModel)
Alias for calling Builder.recommendedModel with
recommendedModel.orElse(null).
-
recommendedModel
final BetaRefusalStopDetails.Builder recommendedModel(JsonField<String> recommendedModel)
Sets Builder.recommendedModel to an arbitrary JSON value.
You should usually call Builder.recommendedModel with a well-typed String value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
type
final BetaRefusalStopDetails.Builder type(JsonValue type)
Sets the field to an arbitrary JSON value.
It is usually unnecessary to call this method because the field defaults to the following:
JsonValue.from("refusal")This method is primarily for setting the field to an undocumented or not yet supported value.
-
additionalProperties
final BetaRefusalStopDetails.Builder additionalProperties(Map<String, JsonValue> additionalProperties)
-
putAdditionalProperty
final BetaRefusalStopDetails.Builder putAdditionalProperty(String key, JsonValue value)
-
putAllAdditionalProperties
final BetaRefusalStopDetails.Builder putAllAdditionalProperties(Map<String, JsonValue> additionalProperties)
-
removeAdditionalProperty
final BetaRefusalStopDetails.Builder removeAdditionalProperty(String key)
-
removeAllAdditionalProperties
final BetaRefusalStopDetails.Builder removeAllAdditionalProperties(Set<String> keys)
-
build
final BetaRefusalStopDetails build()
Returns an immutable instance of BetaRefusalStopDetails.
Further updates to this Builder will not mutate the returned instance.
The following fields are required:
.category() .explanation() .fallbackCreditToken() .fallbackHasPrefillClaim() .recommendedModel()
-
-
-
-