Module: SimpleLLM::Common

Included in:
Yandex::Sync
Defined in:
lib/simple_llm.rb

Instance Method Summary collapse

Instance Method Details

#initialize(cache_filename = "simple_llm_cache.jsonl", &cache_key_string_function) ⇒ Object

Parameters:

  • cache_filename (String, nil, false) (defaults to: "simple_llm_cache.jsonl")

    если передать nil или false, кеширования не будет



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/simple_llm.rb', line 13

def initialize cache_filename = "simple_llm_cache.jsonl", &cache_key_string_function
  @cache_key_string_function = cache_key_string_function || lambda do |
    cls,
    time,
    auth,
    pid,
    model,
    input,
    max_output_tokens,
    temperature,
    instructions,
  |
    "#{instructions} #{input}"
  end
  @cache = ::SKJVS::OneFile.new cache_filename if cache_filename
end