Module: L::ClassMethods

Defined in:
lib/lammy.rb

Overview

Wrap generative methods with handlers

Instance Method Summary collapse

Instance Method Details

#llm(**kwargs) ⇒ Object



18
19
20
# File 'lib/lammy.rb', line 18

def llm(**kwargs)
  @next_llm_settings = kwargs
end

#method_added(method_name) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/lammy.rb', line 26

def method_added(method_name)
  if @next_llm_settings
    next_llm_settings = @next_llm_settings
    @next_llm_settings = nil

    Lammy::Chat.handle(self, method_name, next_llm_settings)
  end

  if @next_v_settings
    next_v_settings = @next_v_settings
    @next_v_settings = nil

    Lammy::Embeddings.handle(self, method_name, next_v_settings)
  end

  super
end

#v(**kwargs) ⇒ Object



22
23
24
# File 'lib/lammy.rb', line 22

def v(**kwargs)
  @next_v_settings = kwargs
end