Module: LlmGateway::Adapters::OpenAI::PromptCacheOptionMapper
- Included in:
- ChatCompletions::OptionMapper, Responses::OptionMapper
- Defined in:
- lib/llm_gateway/adapters/openai/prompt_cache_option_mapper.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
7 8 9 |
# File 'lib/llm_gateway/adapters/openai/prompt_cache_option_mapper.rb', line 7 def self.included(base) base.extend(self) end |
Instance Method Details
#map_cache_key!(mapped_options) ⇒ Object
11 12 13 14 15 |
# File 'lib/llm_gateway/adapters/openai/prompt_cache_option_mapper.rb', line 11 def map_cache_key!() cache_key = .delete(:cache_key) .delete(:prompt_cache_key) [:prompt_cache_key] = cache_key unless cache_key.nil? end |
#map_prompt_cache_retention!(mapped_options) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/llm_gateway/adapters/openai/prompt_cache_option_mapper.rb', line 17 def map_prompt_cache_retention!() retention = .delete(:cache_retention) .delete(:prompt_cache_retention) retention ||= "short" if .key?(:prompt_cache_key) case retention&.to_s when nil nil when "short" [:prompt_cache_retention] = "in_memory" when "long" [:prompt_cache_retention] = "24h" when "none" .delete(:prompt_cache_key) else raise ArgumentError, "Invalid cache_retention '#{retention}'. Use 'short', 'long', or 'none'." end end |