Class: OpenAI::Models::Beta::BetaResponsesClientEvent::ResponseCreate::PromptCacheOptions

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/openai/models/beta/beta_responses_client_event.rb

Overview

See Also:

  • OpenAI::Models::Beta::BetaResponsesClientEvent::ResponseCreate#prompt_cache_options

Defined Under Namespace

Modules: Mode, Ttl

Instance Attribute Summary collapse

Attributes inherited from Internal::Type::BaseModel

#last_response

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], #_request_id, #_set_last_response, coerce, #deconstruct_keys, #deep_to_h, dump, #encode_with, 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, coerce_with_error, 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(comparison_response_id: nil, mode: nil, prewarm: nil, ttl: nil) ⇒ Object

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:

  • comparison_response_id (String, nil) (defaults to: nil)

    The ID of a response to compare when diagnosing prompt cache reuse. Supplying this field requests prompt cache diagnostics when the feature is enabled.

  • mode (Symbol, OpenAI::Models::Beta::BetaResponsesClientEvent::ResponseCreate::PromptCacheOptions::Mode) (defaults to: nil)

    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.

  • prewarm (Boolean) (defaults to: nil)

    Prepares the prompt cache without generating output. Defaults to false. When set to true, overrides the generate field to false.

  • ttl (Symbol, OpenAI::Models::Beta::BetaResponsesClientEvent::ResponseCreate::PromptCacheOptions::Ttl) (defaults to: nil)

    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.



# File 'lib/openai/models/beta/beta_responses_client_event.rb', line 1549


Instance Attribute Details

#comparison_response_idString?

The ID of a response to compare when diagnosing prompt cache reuse. Supplying this field requests prompt cache diagnostics when the feature is enabled.

Returns:

  • (String, nil)


1515
# File 'lib/openai/models/beta/beta_responses_client_event.rb', line 1515

optional :comparison_response_id, String, nil?: true

#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.



1526
1527
1528
1529
# File 'lib/openai/models/beta/beta_responses_client_event.rb', line 1526

optional(
  :mode,
  enum: -> { OpenAI::Beta::BetaResponsesClientEvent::ResponseCreate::PromptCacheOptions::Mode }
)

#prewarmBoolean?

Prepares the prompt cache without generating output. Defaults to false. When set to true, overrides the generate field to false.

Returns:



1536
# File 'lib/openai/models/beta/beta_responses_client_event.rb', line 1536

optional :prewarm, OpenAI::Internal::Type::Boolean

#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.



1544
1545
1546
1547
# File 'lib/openai/models/beta/beta_responses_client_event.rb', line 1544

optional(
  :ttl,
  enum: -> { OpenAI::Beta::BetaResponsesClientEvent::ResponseCreate::PromptCacheOptions::Ttl }
)

Class Method Details

.valuesArray<Symbol>

Returns:

  • (Array<Symbol>)


# File 'lib/openai/models/beta/beta_responses_client_event.rb', line 1595