Class ResponseCreateParams.PromptCacheOptions
-
- All Implemented Interfaces:
public final class ResponseCreateParams.PromptCacheOptionsOptions for prompt caching. Supported for
gpt-5.6and later models. By default, OpenAI automatically chooses one implicit cache breakpoint. You can add explicit breakpoints to content blocks withprompt_cache_breakpoint. Each request can write up to four breakpoints. For cache matching, OpenAI considers up to the latest 80 breakpoints in the conversation, without a content-block lookback limit. Setmodetoexplicitto disable the implicit breakpoint. Thettldefaults to30m, which is currently the only supported value. See the prompt caching guide for current details.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classResponseCreateParams.PromptCacheOptions.BuilderA builder for PromptCacheOptions.
public final classResponseCreateParams.PromptCacheOptions.ModeControls whether OpenAI automatically creates an implicit cache breakpoint. Defaults to
implicit. Withimplicit, OpenAI creates one implicit breakpoint and writes up to the latest three explicit breakpoints in the request. Withexplicit, OpenAI does not create an implicit breakpoint and writes up to the latest four explicit breakpoints. If there are no explicit breakpoints, the request does not use prompt caching.public final classResponseCreateParams.PromptCacheOptions.TtlThe minimum lifetime applied to every implicit and explicit cache breakpoint written by the request. Defaults to
30m, which is currently the only supported value. The backend may retain cache entries for longer.
-
Method Summary
Modifier and Type Method Description final Optional<ResponseCreateParams.PromptCacheOptions.Mode>mode()Controls whether OpenAI automatically creates an implicit cache breakpoint. final Optional<ResponseCreateParams.PromptCacheOptions.Ttl>ttl()The minimum lifetime applied to every implicit and explicit cache breakpoint written by the request. final JsonField<ResponseCreateParams.PromptCacheOptions.Mode>_mode()Returns the raw JSON value of mode. final JsonField<ResponseCreateParams.PromptCacheOptions.Ttl>_ttl()Returns the raw JSON value of ttl. final Map<String, JsonValue>_additionalProperties()final ResponseCreateParams.PromptCacheOptions.BuildertoBuilder()final ResponseCreateParams.PromptCacheOptionsvalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static ResponseCreateParams.PromptCacheOptions.Builderbuilder()Returns a mutable builder for constructing an instance of PromptCacheOptions. -
-
Method Detail
-
mode
final Optional<ResponseCreateParams.PromptCacheOptions.Mode> mode()
Controls whether OpenAI automatically creates an implicit cache breakpoint. Defaults to
implicit. Withimplicit, OpenAI creates one implicit breakpoint and writes up to the latest three explicit breakpoints in the request. Withexplicit, OpenAI does not create an implicit breakpoint and writes up to the latest four explicit breakpoints. If there are no explicit breakpoints, the request does not use prompt caching.
-
ttl
final Optional<ResponseCreateParams.PromptCacheOptions.Ttl> ttl()
The minimum lifetime applied to every implicit and explicit cache breakpoint written by the request. Defaults to
30m, which is currently the only supported value. The backend may retain cache entries for longer.
-
_mode
final JsonField<ResponseCreateParams.PromptCacheOptions.Mode> _mode()
Returns the raw JSON value of mode.
Unlike mode, this method doesn't throw if the JSON field has an unexpected type.
-
_ttl
final JsonField<ResponseCreateParams.PromptCacheOptions.Ttl> _ttl()
Returns the raw JSON value of ttl.
Unlike ttl, this method doesn't throw if the JSON field has an unexpected type.
-
_additionalProperties
final Map<String, JsonValue> _additionalProperties()
-
toBuilder
final ResponseCreateParams.PromptCacheOptions.Builder toBuilder()
-
validate
final ResponseCreateParams.PromptCacheOptions validate()
Validates that the types of all values in this object match their expected types recursively.
This method is not forwards compatible with new types from the API for existing fields.
-
builder
final static ResponseCreateParams.PromptCacheOptions.Builder builder()
Returns a mutable builder for constructing an instance of PromptCacheOptions.
-
-
-
-