Class OpenAiPromptCacheOptions
java.lang.Object
dev.langchain4j.model.openai.OpenAiPromptCacheOptions
Represents the
prompt_cache_options request object supported by gpt-5.6 and later.
On these models a cached prefix is matched exactly at a
breakpoint, without falling back to a shorter unmarked prefix.
The mode controls where breakpoints come from:
MODE_IMPLICIT- OpenAI places a breakpoint at the end of the newest eligible message.MODE_EXPLICIT- only the breakpoints set viaOpenAiPromptCacheBreakpointare used. Without any breakpoint, nothing is cached.
Note that prompt_cache_options.ttl supersedes prompt_cache_retention, which applies to
earlier models only. Setting both on the same request is rejected by OpenAI.
- Since:
- 1.21.0
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionbuilder()booleanstatic OpenAiPromptCacheOptionsexplicit()Creates options withMODE_EXPLICIT.inthashCode()static OpenAiPromptCacheOptionsimplicit()Creates options withMODE_IMPLICIT.mode()Returnsprompt_cache_options.mode.toString()ttl()Returnsprompt_cache_options.ttl.
-
Field Details
-
MODE_IMPLICIT
OpenAI places a breakpoint at the end of the newest eligible message.- See Also:
-
MODE_EXPLICIT
-
TTL_30M
The only TTL currently accepted by OpenAI. It is also the default.- See Also:
-
-
Method Details
-
mode
Returnsprompt_cache_options.mode. -
ttl
Returnsprompt_cache_options.ttl. -
implicit
Creates options withMODE_IMPLICIT. -
explicit
Creates options withMODE_EXPLICIT. -
equals
-
hashCode
-
toString
-
builder
-