Class: OpenAI::Models::Realtime::RealtimeTruncationRetentionRatio

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/openai/models/realtime/realtime_truncation_retention_ratio.rb

Defined Under Namespace

Classes: TokenLimits

Instance Attribute 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(retention_ratio:, token_limits: nil, type: :retention_ratio) ⇒ Object

Some parameter documentations has been truncated, see OpenAI::Models::Realtime::RealtimeTruncationRetentionRatio for more details.

Retain a fraction of the conversation tokens when the conversation exceeds the input token limit. This allows you to amortize truncations across multiple turns, which can help improve cached token usage.

Parameters:

  • retention_ratio (Float)

    Fraction of post-instruction conversation tokens to retain (‘0.0` - `1.0`) when

  • token_limits (OpenAI::Models::Realtime::RealtimeTruncationRetentionRatio::TokenLimits) (defaults to: nil)

    Optional custom token limits for this truncation strategy. If not provided, the

  • type (Symbol, :retention_ratio) (defaults to: :retention_ratio)

    Use retention ratio truncation.



# File 'lib/openai/models/realtime/realtime_truncation_retention_ratio.rb', line 29

Instance Attribute Details

#retention_ratioFloat

Fraction of post-instruction conversation tokens to retain (‘0.0` - `1.0`) when the conversation exceeds the input token limit. Setting this to `0.8` means that messages will be dropped until 80% of the maximum allowed tokens are used. This helps reduce the frequency of truncations and improve cache rates.

Returns:

  • (Float)


14
# File 'lib/openai/models/realtime/realtime_truncation_retention_ratio.rb', line 14

required :retention_ratio, Float

#token_limitsOpenAI::Models::Realtime::RealtimeTruncationRetentionRatio::TokenLimits?

Optional custom token limits for this truncation strategy. If not provided, the model’s default token limits will be used.



27
# File 'lib/openai/models/realtime/realtime_truncation_retention_ratio.rb', line 27

optional :token_limits, -> { OpenAI::Realtime::RealtimeTruncationRetentionRatio::TokenLimits }

#typeSymbol, :retention_ratio

Use retention ratio truncation.

Returns:

  • (Symbol, :retention_ratio)


20
# File 'lib/openai/models/realtime/realtime_truncation_retention_ratio.rb', line 20

required :type, const: :retention_ratio