Class ChatCompletionCreateParams.PromptCacheOptions
-
- All Implemented Interfaces:
public final class ChatCompletionCreateParams.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 classChatCompletionCreateParams.PromptCacheOptions.BuilderA builder for PromptCacheOptions.
public final classChatCompletionCreateParams.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 classChatCompletionCreateParams.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<ChatCompletionCreateParams.PromptCacheOptions.Mode>mode()Controls whether OpenAI automatically creates an implicit cache breakpoint. final Optional<ChatCompletionCreateParams.PromptCacheOptions.Ttl>ttl()The minimum lifetime applied to every implicit and explicit cache breakpoint written by the request. final JsonField<ChatCompletionCreateParams.PromptCacheOptions.Mode>_mode()Returns the raw JSON value of mode. final JsonField<ChatCompletionCreateParams.PromptCacheOptions.Ttl>_ttl()Returns the raw JSON value of ttl. final Map<String, JsonValue>_additionalProperties()final ChatCompletionCreateParams.PromptCacheOptions.BuildertoBuilder()final ChatCompletionCreateParams.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 ChatCompletionCreateParams.PromptCacheOptions.Builderbuilder()Returns a mutable builder for constructing an instance of PromptCacheOptions. -
-
Method Detail
-
mode
final Optional<ChatCompletionCreateParams.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<ChatCompletionCreateParams.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<ChatCompletionCreateParams.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<ChatCompletionCreateParams.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 ChatCompletionCreateParams.PromptCacheOptions.Builder toBuilder()
-
validate
final ChatCompletionCreateParams.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 ChatCompletionCreateParams.PromptCacheOptions.Builder builder()
Returns a mutable builder for constructing an instance of PromptCacheOptions.
-
-
-
-