Class: OpenAI::Models::Beta::ResponseCreateParams::PromptCacheOptions

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

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_cached, coerce_with_error, #dump, dump, #inspect, inspect, meta_info, new_coerce_state, resolve_type, 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) ⇒ PromptCacheOptions

Returns a new instance of PromptCacheOptions.

Parameters:

  • comparison_response_id (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 (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 (defaults to: nil) —

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

  • ttl (defaults to: nil) —

    The minimum lifetime applied to every implicit and explicit cache breakpoint written by the request. Supported values are 30m (the default) and 12h. The backend may retain cache entries for longer.

  • comparison_response_id: (String, nil) (defaults to: nil)
  • mode: (OpenAI::Models::Beta::ResponseCreateParams::PromptCacheOptions::mode) (defaults to: nil)
  • prewarm: (Boolean) (defaults to: nil)
  • ttl: (OpenAI::Models::Beta::ResponseCreateParams::PromptCacheOptions::ttl) (defaults to: nil)


# File 'lib/openai/models/beta/response_create_params.rb', line 1664

Instance Attribute Details

#comparison_response_id ⇒ String?

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)


1636
# File 'lib/openai/models/beta/response_create_params.rb', line 1636

optional :comparison_response_id, String, nil?: true

#mode ⇒ OpenAI::Models::Beta::ResponseCreateParams::PromptCacheOptions::mode?

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.

Returns:

  • (OpenAI::Models::Beta::ResponseCreateParams::PromptCacheOptions::mode, nil)


1647
# File 'lib/openai/models/beta/response_create_params.rb', line 1647

optional :mode, enum: -> { OpenAI::Beta::ResponseCreateParams::PromptCacheOptions::Mode }

#prewarm ⇒ Boolean?

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

Returns:



1654
# File 'lib/openai/models/beta/response_create_params.rb', line 1654

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

#ttl ⇒ OpenAI::Models::Beta::ResponseCreateParams::PromptCacheOptions::ttl?

The minimum lifetime applied to every implicit and explicit cache breakpoint written by the request. Supported values are 30m (the default) and 12h. The backend may retain cache entries for longer.

Returns:

  • (OpenAI::Models::Beta::ResponseCreateParams::PromptCacheOptions::ttl, nil)


1662
# File 'lib/openai/models/beta/response_create_params.rb', line 1662

optional :ttl, enum: -> { OpenAI::Beta::ResponseCreateParams::PromptCacheOptions::Ttl }

Class Method Details

.values ⇒ Array<Symbol>

Returns:

  • (Array<Symbol>)


# File 'lib/openai/models/beta/response_create_params.rb', line 1710

Instance Method Details

#to_hash ⇒ { ?comparison_response_id: String?, ?mode: OpenAI::Models::Beta::ResponseCreateParams::PromptCacheOptions::mode, ?prewarm: bool, ?ttl: OpenAI::Models::Beta::ResponseCreateParams::PromptCacheOptions::ttl }

Returns:

  • ({ ?comparison_response_id: String?, ?mode: OpenAI::Models::Beta::ResponseCreateParams::PromptCacheOptions::mode, ?prewarm: bool, ?ttl: OpenAI::Models::Beta::ResponseCreateParams::PromptCacheOptions::ttl })


1391
1392
1393
1394
1395
1396
# File 'sig/openai/models/beta/response_create_params.rbs', line 1391

def to_hash: -> {
  ?comparison_response_id: String?,
  ?mode: OpenAI::Models::Beta::ResponseCreateParams::PromptCacheOptions::mode,
  ?prewarm: bool,
  ?ttl: OpenAI::Models::Beta::ResponseCreateParams::PromptCacheOptions::ttl
}