Class: OpenAI::Models::Chat::CompletionCreateParams::PromptCacheOptions

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/openai/models/chat/completion_create_params.rb,
sig/openai/models/chat/completion_create_params.rbs

Defined Under Namespace

Modules: Mode, Ttl

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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(mode: nil, ttl: nil) ⇒ Object

Some parameter documentations has been truncated, see OpenAI::Models::Chat::CompletionCreateParams::PromptCacheOptions for more details.

Options for prompt caching. Supported for gpt-5.6 and later models. By default, OpenAI automatically chooses one implicit cache breakpoint. You can add explicit breakpoints to content blocks with prompt_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. Set mode to explicit to disable the implicit breakpoint. The ttl defaults to 30m, which is currently the only supported value. See the prompt caching guide for current details.

Parameters:



# File 'lib/openai/models/chat/completion_create_params.rb', line 729

Instance Attribute Details

#modeSymbol, ...

Controls whether OpenAI automatically creates an implicit cache breakpoint. Defaults to implicit. With implicit, OpenAI creates one implicit breakpoint and writes up to the latest three explicit breakpoints in the request. With explicit, 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.



719
# File 'lib/openai/models/chat/completion_create_params.rb', line 719

optional :mode, enum: -> { OpenAI::Chat::CompletionCreateParams::PromptCacheOptions::Mode }

#ttlSymbol, ...

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.



727
# File 'lib/openai/models/chat/completion_create_params.rb', line 727

optional :ttl, enum: -> { OpenAI::Chat::CompletionCreateParams::PromptCacheOptions::Ttl }

Class Method Details

.valuesArray<Symbol>

Returns:

  • (Array<Symbol>)


# File 'lib/openai/models/chat/completion_create_params.rb', line 762

Instance Method Details

#to_hash{

Returns:

  • ({)


434
# File 'sig/openai/models/chat/completion_create_params.rbs', line 434

def to_hash: -> {